Save any page as PDF

PDF Mage API for developers

API is a programmable interface used for creating PDF files from HTML markup. PDF Mage API is currently in beta version and is provided free of charge.


The interface is located at the address

API uses REST architecture. The parameters are sent using POST method in the request body in “key=value” format or in JSON. The format is determined on client side, by the providing the "Content-Type" header:

  • For “key=value” parameters Content-Type should be: application/x-www-form-urlencoded
  • For JSON parameters Content-Type should be: application/json

The system will normally respond with HTTP 200 status, sending a JSON response body which will have a "Success" parameter, and optional "Error" message and "Data":

Request authentication

Requests are authenticated based on the "X-Api-Key" HTTP header, which should contain your unique API key. API keys can be obtained after purchasing API access.

If the request does not have a header with authentication information, or the information sent in the request is incorrect, the system will return a HTTP 401 status – Unauthorized.

Test method

To check interaction with API you can call a test method at without sending any parameters. The system will return a sample PDF download URL.

Sample request:

Sample response:

Generate PDF from HTML

To generate PDF from custom HTML, make a request to the following address: These are the parameters you can use:

Parameter Format Required Description
Html String Yes HTML markup that needs to be converted to PDF
TargetUrl String No The URL at which HTML page is located (used to download scripts, styles, images and other files needed for HTML page to be displayed properly )
PageWidth Numeric No HTML viewer width in pixels (default is 1024)
PageOrientation String No Determines PDF page orientation. Possible values are:
  • Portrait
  • Landscape
Default value is Portrait.
SinglePage Boolean No Determines whether to split PDF file into pages, or use single page regardless of HTML page size

Sample request:

Sample response:

Check your API key

To check your API key, make a request to the following address: without sending any parameters. You should pass your key in request headers, like for all other methods.

Sample request:

Sample response:

Rate limiting

Our API is currently in test mode, and it is rate limited. You may only perform requests from a single IP address every 5 seconds.

If you attempt to make more frequent requests, the system will return a HTTP 409 status – Conflict.