Our Documentation

Getting Started

To convert a website send a GET or POST request to this endpoint.

https://pdfbird.com/api/v1/convert

Example

To convert medium.com add the url parameter to the request.

https://pdfbird.com/api/v1/convert?url=medium.com

Authentication

Add the token parameter with your API token to the request to authorize yourself.

https://pdfbird.com/api/v1/convert
        ?url=medium.com
        &token=YOUR_API_TOKEN

Parameters

This is a list of all parameters that you can add to the request.

Note that parameters should be URL encoded when sending a GET request.

Parameter Type Default value Description
token string '' Your API token.
url string '' The url of the website.
format string 'A4' The format of the generated PDF. Accepted values are A0, A1, A2, A3, A4, A5or widthxheight. For example 800x400
display_mode string 'screen' Can be screen or print
landscape boolean false If true a landscape mode will be used for the PDF document.
margin int 0 The margin around the edges of the pages.
retina boolean false This will set the device scale factor to 2, simulating a retina display.
fresh boolean false If true this will force a fresh conversion.
output string 'json' You can select json as output, or the raw pdf file by setting it to pdf.
delay int 0 How many milliseconds to wait before making the conversion.
accept_languages string 'en-US,en;q=0.8' The accept languages header to set.
user_agent string '' The user agent string to set.
ttl int 2592000 How many seconds the pdf file should be cached. Default is 30 days.
css_url string '' A specific CSS stylesheet URL to inject in the page.
css string '' CSS code to inject in the page.
cookies string '' The cookies to set in the browser. If sending multiple cookies use a ; to seperate them. For example: cookie1=myValue;cookie2=myOtherValue
headers string '' The headers to add to the request. If sending multiple use a ; to seperate them. For example: X-MY-HEADER-1: myValue;X-MY-HEADER-2: myOtherValue
block_ads boolean false If true advertisements will be blocked.
Available for the Essentials, Startup and Business plans
proxy string '' Connect to a custom proxy. You should use the following format: address:port or username:[email protected]:port

Errors

If the API encounters an error a 4xx or 5xx status code along with the error message is returned.
This is an example of 2 error messages that are returned for the format and fresh parameters.

{
    errors: {
        format: [
            "Invalid value. Valid values are A0, A1, A2, A3, A4, A5 or widthxheight"
        ],
        fresh: [
            "The fresh parameter must be either true or false."
        ]
    }
}

Quota

With each API call the following quota headers are sent.

Header Description
X-Quota-Limit The total number of conversions you can take per month
X-Quota-Remaining The number of conversions you can still make this month
X-Quota-Reset-At A unix timestamp of when the quota resets (the first of each month)

Query builder

Use our query builder to explore our API.
(If you are logged in your API token is automatically added)

Code Examples

These code examples show how to convert a website to a pdf file.