PDF Generation API Documentation

This API provides endpoints to generate PDF documents from web URLs.

Generate PDF

Generates a PDF document from a publicly accessible URL or raw HTML content provided in the request body.

POST /

Authentication

TypeLocationNameDescription
API KeyHeaderX-API-KeyYour provisioned API key must be included.

Request Body

The request body must be a JSON object containing EITHER a URL OR raw HTML content:

// Option 1: Convert URL
{
  "url": "https://www.example.com"
}

// Option 2: Convert HTML
{
  "html": "<h1>Hello World</h1>"
}
FieldTypeRequiredDescription
urlstringConditionalThe fully qualified URL (including http:// or https://) of the webpage to convert into a PDF.
htmlstringConditionalRaw HTML content to render and convert into a PDF.
Note: You must provide either url or html, but not both.

Success Response (200 OK)

HeaderValue
Content-Typeapplication/pdf
Content-Dispositionattachment; filename="generated_document.pdf" (or generated_from_html.pdf)
Content-Length<PDF size in bytes>

Body: The binary data of the generated PDF file.

Error Responses

Status CodeReasonExample Body
401 Unauthorized API key missing, invalid, expired, or request limit exceeded.
{ "error": "Reason description" }
422 Unprocessable Entity Request body missing url/html, or invalid format.
{ "error": "Request body must contain either \"url\" or \"html\"" }
500 Internal Server Error PDF generation failed (e.g., Puppeteer error, timeout) or other server issue.
{ "error": "Failed to process request..." }