Generate PDFs via API
DocSpring generates PDFs by filling your templates with submission data. Templates can either be uploads that you annotate in the Template Editor or fully custom HTML/CSS layouts that you host in DocSpring.
Endpoint
Section titled “Endpoint”POST /api/v1/templates/{template_id}/submissions
API Reference: Generate PDF Review every request parameter, see example payloads, and run test calls
Request Payload Basics
Section titled “Request Payload Basics”Every submission must include:
data
— Field values that match your template schema.test
— Usetrue
for free, watermarked PDFs while building your integration.metadata
— Optional map for values you want echoed back in webhooks.version
— Choosedraft
,latest
, or a specific version such as1.2.3
.
Optional parameters:
wait
— Decide between synchronous and asynchronous processing.editable
— Keep the resulting PDF fillable or flatten the form fields.expires_in
— Set a TTL for the generated PDF download link.field_overrides
— Temporarily adjust field requirements or defaults.data_requests
— Kick off a data collection or signature workflow before finalizing the PDF.
Processing Modes
Section titled “Processing Modes”Submissions sent to sync.api.docspring.com
wait for processing and return the download_url
in the response. Switching wait=false
or using the asynchronous domain returns immediately with a pending submission. See Sync vs. Async Processing for flow diagrams, polling tips, and webhook guidance.
Batch Generation
Section titled “Batch Generation”Need to create many PDFs at once? Use the batch endpoint to submit up to 50 requests together. Each entry can target a different template, switch between test/live, and specify its own metadata.
Batch Generate PDFs Send up to 50 submissions in one request and mix templates, test mode, and metadata
Helpful Extras
Section titled “Helpful Extras” Customize Title & Filename Control the PDF metadata and download URL for each submission
Handle Truncated Text Detect overflow and generate addendum pages when field text is clipped
Special Newline Characters Work around integrations that strip literal newline characters
Combine PDFs Merge submissions, templates, and external files into one package
Related Workflows
Section titled “Related Workflows” Create Data Requests Collect signatures or missing data before finalizing the PDF
Install API Client Set up official DocSpring SDKs with authentication helpers
API Authentication Generate API tokens and configure credentials for requests
Embedded Data Requests Guide Embed signing and data collection experiences in your app