Quick Start
Now you’re ready to generate PDFs! Follow these simple steps:
Generate Your First Document
Section titled “Generate Your First Document”Use your template ID and pass dynamic data to generate a PDF:
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)
Response Options
Section titled “Response Options”Choose how you want to receive your generated PDF:
1. Direct PDF Response
Section titled “1. Direct PDF Response”Get the PDF file instantly in the HTTP response. Perfect for immediate downloads.
Set response_type
to pdf
.
2. JSON with Base64
Section titled “2. JSON with Base64”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 }}
3. Document ID
Section titled “3. Document ID”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 }}
Need Help?
Section titled “Need Help?”If you have questions about applications or need assistance:
- 📧 Email: support@docstron.com
- 💬 Live Chat: Available in your dashboard
- 📚 Documentation: You’re reading it!