Search the docs
Start for FreeQuick Start
Generate your first PDF in under 5 minutes.
1. Create an account
Sign up at PDF-API. You get a free plan with 100 PDF generations per month to start.
2. Create an API token
- Go to Settings → API Tokens
- Click Create New Token
- Give your token a name
- Copy the token immediately
Important
The token is only shown once. Store it securely (e.g. as an environment variable). Never commit it to version control.
3. Create a template
Go to Templates and click Create Template. You can choose between two editor types:
- WYSIWYG Editor — drag-and-drop visual editor, ideal for simple layouts
- HTML Editor — write HTML with Twig syntax for full control over the output
Add dynamic fields to your template using variable names. For example, a text element with the variable customer_name can be filled dynamically when generating the PDF.
4. Generate your first PDF
Call the API with your template ID and the data to inject:
cURLbash
curl -X POST https://pdfstork.com/api/v1/templates/{template_id}/generate \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"data": {
"customer_name": "Jane Doe",
"invoice_number": "INV-001"
}
}'The API returns the generated PDF as base64 by default:
Responsejson
{
"success": true,
"pdf": "JVBERi0xLjQKJeLj...",
"filename": "document.pdf",
"size": 12345,
"usage": {
"current": 1,
"limit": 100,
"percentage": 1.0
}
}You can also request a temporary download URL or a raw binary response. See the Generate a PDF guide for all output options.
