PDF Munk API Reference

Generate PDF from HTML or URL

post

Creates a PDF from either HTML content or a URL. Supports custom page sizes, fonts, viewport dimensions, and dynamic parameters.

Note: Either url or html_content must be provided, but not both.

Authorizations
CLIENT-API-KEYstringRequired

API key for authentication. Get your key from https://pdfmunk.com/dashboard

Body
urlstring · uriOptional

URL of the webpage to convert to PDF

Example: https://example.com
html_contentstringRequired

HTML content to convert to PDF

Example: <html><body><h1>Hello World</h1></body></html>
css_contentstringOptional

Optional CSS to apply to the HTML

Example: body { font-family: Arial; }
output_formatstring · enumOptional

Output format:

  • url: Returns a URL to the uploaded PDF (default)
  • pdf, binary, file: Returns the PDF file directly
Default: urlPossible values:
paper_sizestring · enumOptional

Paper size for the PDF

Default: A4Possible values:
landscapebooleanOptional

Set to true for landscape orientation

Default: false
printBackgroundbooleanOptional

Whether to print background graphics

Default: true
displayHeaderFooterbooleanOptional

Whether to display header and footer

Default: false
preferCSSPageSizebooleanOptional

Whether to prefer CSS-defined page size

Default: true
page_sizeinteger · min: 1 · max: 20Optional

Maximum number of pages to generate (tier-dependent)

Example: 10
paperWidthnumberOptional

Custom paper width in pixels

Example: 800
paperHeightnumberOptional

Custom paper height in pixels

Example: 1200
viewPortWidthintegerOptional

Viewport width for rendering

Default: 1080Example: 1920
viewPortHeightintegerOptional

Viewport height for rendering

Default: 720Example: 1080
fontstringOptional

Google Font name(s) to include (use | separator for multiple)

Example: Roboto|Open Sans
wait_tillintegerOptional

Time to wait in seconds before generating PDF

Default: 0Example: 2
Responses
200

PDF generated successfully

post
/v1/generatePdf

Generate image from HTML or URL

post

Creates a PNG image from either HTML content or a URL. Supports custom dimensions, quality settings, fonts, and dynamic parameters.

Note: Either url or html_content must be provided, but not both.

Authorizations
CLIENT-API-KEYstringRequired

API key for authentication. Get your key from https://pdfmunk.com/dashboard

Body
urlstring · uriOptional

URL of the webpage to capture as image

Example: https://example.com
html_contentstringOptional

HTML content to render as image

Example: <div style='padding: 20px;'><h1>Hello</h1></div>
css_contentstringOptional

Optional CSS to apply to the HTML

Example: div { background: white; }
output_formatstring · enumOptional

Output format:

  • url: Returns a URL to the uploaded image (default)
  • base64: Returns base64-encoded image string
  • both: Returns both URL and base64
  • image, png, binary, file: Returns the image file directly
Default: urlPossible values:
widthintegerOptional

Width of the output image in pixels

Default: 1280Example: 800
heightintegerOptional

Height of the output image in pixels

Default: 720Example: 600
viewPortWidthintegerOptional

Viewport width for rendering (if different from output width)

Example: 1920
viewPortHeightintegerOptional

Viewport height for rendering (if different from output height)

Example: 1080
device_scale_factornumber · min: 1 · max: 3Optional

Device scale factor for higher resolution

Default: 1Example: 2
qualityinteger · min: 30 · max: 100Optional

Image quality (30-100)

Default: 80Example: 90
full_pagebooleanOptional

Capture full page (for URLs only)

Default: false
wait_tillintegerOptional

Time to wait in seconds before capturing

Default: 0Example: 2
wait_untilstring · enumOptional

When to consider navigation successful (for URLs)

Default: loadPossible values:
fontstringOptional

Google Font name(s) to include (use | separator for multiple)

Example: Poppins|Montserrat
Responses
200

Image generated successfully

post
/v1/generateImage

Generate chart image using Chart.js

post

Creates a chart image using Chart.js library. Supports various chart types including line, bar, pie, doughnut, radar, and more.

Authorizations
CLIENT-API-KEYstringRequired

API key for authentication. Get your key from https://pdfmunk.com/dashboard

Body
chart_typestring · enumRequired

Type of chart to generate

Example: barPossible values:
widthintegerOptional

Width of the chart in pixels

Default: 800Example: 1000
heightintegerOptional

Height of the chart in pixels

Default: 600Example: 600
output_formatstring · enumOptional

Output format for the chart image

Default: urlPossible values:
Responses
200

Chart generated successfully

post
/v1/generateChart

Compress an image

post

Compresses an image from a URL or base64 string with adjustable quality settings. Maximum file size: 3MB.

Authorizations
CLIENT-API-KEYstringRequired

API key for authentication. Get your key from https://pdfmunk.com/dashboard

Body
image_urlstring · uriOptional

URL of the image to compress

Example: https://example.com/image.jpg
base64_imagestringOptional

Base64-encoded image (alternative to image_url)

Example: data:image/jpeg;base64,/9j/4AAQSkZJRg...
output_formatstring · enumOptional

Format of the compressed image output

Default: urlPossible values:
qualityinteger · min: 1 · max: 100Optional

Compression quality (1-100, higher = better quality)

Default: 85Example: 80
Responses
200

Image compressed successfully

application/json
post
/v1/compress

Merge multiple PDFs

post

Merges multiple PDF files from URLs into a single PDF document.

Limits:

  • Maximum 15 input PDFs

  • Maximum 200 pages per PDF

  • Maximum 500 total pages combined

Authorizations
CLIENT-API-KEYstringRequired

API key for authentication. Get your key from https://pdfmunk.com/dashboard

Body
urlsstring · uri[] · min: 2 · max: 15Required

Array of PDF URLs to merge

Example: ["https://example.com/doc1.pdf","https://example.com/doc2.pdf","https://example.com/doc3.pdf"]
Responses
200

PDFs merged successfully

application/json
post
/v1/pdf/merge

Split or extract pages from a PDF

post

Splits a PDF or extracts specific pages based on page ranges.

Page Range Format:

  • Single page: "3"

  • Range: "1-5"

  • Multiple ranges: "1-3,5,7-10"

  • Open-ended: "10-" (from page 10 to end)

Limits:

  • Maximum 200 pages per PDF

Authorizations
CLIENT-API-KEYstringRequired

API key for authentication. Get your key from https://pdfmunk.com/dashboard

Body
urlstring · uriRequired

URL of the PDF to split

Example: https://example.com/document.pdf
pagesstringRequired

Page range specification

Example: 1-5,8,10-
Responses
200

PDF split successfully

application/json
post
/v1/pdf/split

Unlock a password-protected PDF

post

Removes password protection from a PDF file. Supports both user and owner passwords.

Maximum file size: 10MB

Authorizations
CLIENT-API-KEYstringRequired

API key for authentication. Get your key from https://pdfmunk.com/dashboard

Body
filestring · binaryRequired

PDF file to unlock

passwordstringRequired

Password to unlock the PDF

Example: secret123
output_namestringOptional

Optional custom name for output file

Example: unlocked_document.pdf
Responses
200

PDF unlocked successfully

application/json
post
/v1/unlockPdf

Fetch HTML content from a URL

post

Fetches and returns the HTML content of a webpage with configurable wait conditions and viewport settings.

Authorizations
CLIENT-API-KEYstringRequired

API key for authentication. Get your key from https://pdfmunk.com/dashboard

Body
urlstring · uriRequired

URL to fetch HTML from

Example: https://example.com
wait_tillstring · enumOptional

When to consider navigation successful

Default: loadPossible values:
timeoutintegerOptional

Maximum wait time in milliseconds

Default: 30000Example: 60000
wait_for_selectorstringOptional

CSS selector to wait for before returning HTML

Example: #content
wait_for_timeoutintegerOptional

Additional wait time in milliseconds after page load

Default: 0Example: 2000
viewport_widthintegerOptional

Viewport width

Default: 1920Example: 1920
viewport_heightintegerOptional

Viewport height

Default: 1080Example: 1080
user_agentstringOptional

Custom user agent string

Example: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
Responses
200

HTML fetched successfully

application/json
post
/v1/url-to-html

Last updated