1. Create an API key
Create a key from your account, restrict it to required templates and keep it server-side.
Authorization: Bearer dc_live_••••••••2. Publish a version
Production generation targets a published version. Drafts are for authoring and preview.
3. Generate
Send JSON to the generation endpoint.
curl -X POST "$DOCCRAFT_URL/api/v1/shared/document/generate" \
+ -H "Authorization: Bearer $DOCCRAFT_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"templateVersionId":"tv_01JDC12","data":{"customer":{"name":"Acme"}}}'4. Track the job
Poll the returned job or configure a webhook. Always handle pending, processing, completed and failed.
5. Handle errors
Log the job identifier, retain the business payload client-side and retry only transient failures.