Getting Started#

Introducing the general concepts for using the PDF.co API, authentication methods, response codes and sample code.

API Reference#

The PDF.co Web API is REST-based, making it intuitive and easy to use. To prioritize your data’s security and privacy, all requests are securely transmitted using HTTPS. Kindly note, unsecured HTTP connections are not supported.

All requests contain the following base URL:

https://api.pdf.co/v1

Authenticating Your API Request#

To authenticate you need to add a header named x-api-key using your API Key as the value.

"x-api-key": "sample@sample.com_123a4b567c890d123e456f789g01"

Note

The key provided above is just a sample and won’t work for actual API calls. Don’t forget to replace it with your real API Key, which you can find in your PDF.co Dashboard, when making requests.

Response codes#

After making a request you will receive a response from the PDF.co API. A code 200 means the request was successfull, a 400 means there was an error. However there could be other codes - see the complete list of available response codes.

Sample Code#

Here is some sample code which would convert a PDF to a CSV file.

var data = {
              "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-csv/sample.pdf",
              "lang": "eng",
              "inline": true,
              "pages": "0-",
              "async": false,
              "name": "result.csv"
            }

fetch('https://api.pdf.co/v1/pdf/convert/to/csv', {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'x-api-key': 'sample@sample.com_123a4b567c890d123e456f789g01'
    },
    body: JSON.stringify(data)
})
   .then(response => response.json())
   .then(response => console.log(JSON.stringify(response)))
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/to/csv' \
--header 'Content-Type: application/json' \
--header 'x-api-key: sample@sample.com_123a4b567c890d123e456f789g01' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-csv/sample.pdf",
    "lang": "eng",
    "inline": true,
    "pages": "0-",
    "async": false,
    "name": "result.csv"
}'