Skip to content

Quick Start

Now you’re ready to generate PDFs! Follow these simple steps:

Use your template ID and pass dynamic data to generate a PDF:

Terminal window
curl -X POST https://api.docstron.com/v1/documents/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_id": "your_template_id",
"data": {
"customer_name": "John Doe",
"amount": "$299.00"
},
"response_type": "pdf"
}'

Parameters:

  • template_id - Your template’s unique identifier (required)
  • data - JSON object with variables to populate in your template (required)
  • response_type - How you want to receive the PDF (required)

Choose how you want to receive your generated PDF:

Get the PDF file instantly in the HTTP response. Perfect for immediate downloads.

Set response_type to pdf.

Receive a JSON response containing the PDF as base64-encoded content. Useful for processing or storing the PDF programmatically.

Set response_type to json_with_base64.

{
"success": true,
"message": "Request successful",
"data": {
"document_id": "document-fb5cf3c7-eddc-4edd-9683-81ff7fc64f15",
"template_id": "template-8c043edf-fa70-4e51-a8a2-36f67958ca16",
"pdf_content": "JVBERi0xLjcKJfCflqQKNiAwIG9GaWx0ZXIgL0ZsYXRlRGVjb2RlL0xlbmd0aC...",
"filename": "file_2025-10-12_17-07-54_90094aa5.pdf",
"content_type": "application/pdf",
"size_bytes": 5370
}
}

Get a document ID and download URL to retrieve the PDF later. Best for asynchronous workflows.

Set response_type to document_id.

{
"success": true,
"message": "Request successful",
"data": {
"document_id": "document-489a79af-8680-4a08-a777-df52f26f296f",
"template_id": "template-8c043edf-fa70-4e51-a8a2-36f67958ca16",
"download_url": "https://api.docstron.com/v1/documents/download/document-489a79af-8680-4a08-a777-df52f26f296f",
"size_bytes": 5370
}
}

If you have questions about applications or need assistance:

  • 📧 Email: support@docstron.com
  • 💬 Live Chat: Available in your dashboard
  • 📚 Documentation: You’re reading it!