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

API-level failures return a JSON error object. Infrastructure-generated responses, such as 503 and 504, may use a different format. See Error Handling for shared error codes and recommended actions, and the OpenAPI Reference for the exact responses supported by this endpoint.

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

Body Parameters

Common Parameters

Below is the only parameter specific to /v1/direct. For parameters shared across the Conversion API 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