Getting started with the DocuZen API

Prerequisites for generating your first PDF with the DocuZen API

These instructions describe how to generate your first PDF using cURL calls. This is one of many ways to generate PDFs with the DocuZen API - we also have C#, Node.js, Java, PHP, Python, Go, and Ruby libraries.

Before you can start using the API, you need to do the following:

  1. Create a DocuZen account.
  2. Create an API Key.
  3. Create a Template.
  4. Make sure you have cURL installed on your machine.

How to generate a PDF

Build your API call

Your API call must have the following components:

  • A host. The host for DocuZen API requests is always `https://api.docuzen.co/v1/\`
  • An Authorization header. An API Key must be included in the Authorization header.
  • A request. The payload must be submitted in JSON.
Generate your PDF using the API

To generate a PDF using the DocuZen API:

curl --request GET 'https://api.docuzen.co/v1/pdf/generate' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "templateId": "YOUR_TEMPLATE_ID",
    "templateData": {
        "productName": "DocuZen"
    }
  }' \
  --output output.pdf
  1. Copy the example snippet above.
  2. Past the snippet into your favourite text editor.
  3. Copy your API Key and paste it into the "Authorization" header.
  4. Copy your template's ID and paste it into the data section.
  5. Specify any template data that your template requires in the data section.
  6. Copy the code and paste it in your terminal.
  7. Hit Enter.
  8. Check the new output.pdf file in your current working directory to see your PDF!