Skip to main content
POST
Convert HTML to PDF

Authorizations

Authorization
string
header
required

Short-lived, Developer-API-audience token obtained by the trusted MCP service through token exchange (mcp_at_...). Raw MCP resource tokens are rejected.

Body

application/json
fileId
string
required

File ID of the HTML file to convert

Example:

"550e8400-e29b-41d4-a716-446655440000"

landscape
enum<string>

Page orientation. Default: "portrait"

Available options:
portrait,
landscape
Example:

"portrait"

format
enum<string>

Page format. Default: "A4". Ignored when preferCssPageSize is true.

Available options:
A4,
A3,
A5,
Letter,
Legal,
Tabloid
Example:

"A4"

emulatedMediaType
enum<string>

CSS media type emulation. Use "screen" to preserve CSS framework styles (e.g. Tailwind, Bootstrap). Default: "print"

Available options:
screen,
print
Example:

"print"

margin
object

Page margins. Defaults: top/bottom 20mm, left/right 15mm.

scale
number

Scale of the webpage rendering. Must be between 0.1 and 2.0. Default: 1.0

Required range: 0.1 <= x <= 2
Example:

1

preferCssPageSize
boolean

Give any CSS @page size declared in the HTML priority over the format option. Default: false

Example:

false

headerTemplate
string

HTML template for the page header. Use the following placeholders: for current page, for total pages. Must be valid HTML. Requires a non-zero top margin.

Example:

"<div style=\"font-size:10px;text-align:center;width:100%;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>"

HTML template for the page footer. Use the following placeholders: for current page, for total pages. Must be valid HTML. Requires a non-zero bottom margin.

Example:

"<div style=\"font-size:10px;text-align:center;width:100%;\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>"

webhook
object

Optional webhook configuration

Response

201 - application/json

Conversion job created

id
string
required

Job ID

Example:

"550e8400-e29b-41d4-a716-446655440000"

action
string
required

Action that was performed

Example:

"pdf.merge"

status
enum<string>
required

Current job status

Available options:
PENDING,
PROCESSING,
COMPLETED,
FAILED
Example:

"PENDING"

inputFileIds
string[]
required

Input file IDs used for this job

Example:
outputFileId
object | null
required

Output file ID (available when COMPLETED)

Example:

null

error
object | null
required

Error message (available when FAILED)

Example:

null

createdAt
string<date-time>
required

Job creation timestamp

startedAt
object | null
required

Job start timestamp

completedAt
object | null
required

Job completion timestamp

result
object

Structured job result data (e.g. OCR markdown/JSON, generated filename, PDF metadata, form fields). Available when the job produces a direct result instead of an output file.

metadata
object
deprecated

Deprecated — use result instead. Additional metadata, duplicated from result for backward compatibility.