Skip to main content

Direct Conversion

The /v1/direct endpoint generates a PDF from a URL, HTML, or template ID and returns it directly in the response body. Use it when you need the PDF immediately: save to disk, attach to an email, or show an in-app preview while your user is waiting.

Endpoint Details

Method: POST

https://api.pdfbolt.com/v1/direct

Success Example

Example request body for converting a URL to PDF:

{
"url": "https://example.com"
}

Failure Example

If the request fails (e.g., unauthorized, bad request, conversion timeout), the response is a JSON error object. See Error Handling for all error codes and recommended actions.

{
"url": "https://example.com",
"waitForFunction": "() => document.body.innerText.includes('Ready to Download')"
}

Body Parameters

Common Parameters

Below are only the parameters specific to the /direct endpoint. For common parameters shared across all endpoints, see Conversion Parameters.

isEncoded

Type: boolean

Required: No

Default Value: false

Details: The isEncoded parameter determines the format of the PDF data returned in the response:

  • When true: returns Base64-encoded PDF with Content-Type: text/plain.
  • When false (default): returns raw PDF binary with Content-Type: application/pdf.

Usage:

{
"url": "https://example.com",
"isEncoded": true
}
Base64 Size Overhead

Base64-encoded responses are approximately 33% larger than raw binary, increasing transfer time and storage usage.

Response

The response format depends on the isEncoded parameter:

ValueResponse FormatContent Type
trueBase64-encoded PDFtext/plain
falseRaw PDF binaryapplication/pdf

For response headers, see API Response Headers.

Next Steps