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:
- Create a DocuZen account.
- Create an API Key.
- Create a Template.
- 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
- Copy the example snippet above.
- Past the snippet into your favourite text editor.
- Copy your API Key and paste it into the "Authorization" header.
- Copy your template's ID and paste it into the data section.
- Specify any template data that your template requires in the data section.
- Copy the code and paste it in your terminal.
- Hit Enter.
- Check the new
output.pdf
file in your current working directory to see your PDF!