Pro feature
API & Zapier
Turn any saved template into an endpoint. Send field values as JSON and get back a filled document — Word stays Word, PDF stays PDF, with the original layout intact.
1. Get an API key
Save a template, then open your dashboard and click Create API key under “API & Zapier”. Send it on every request:
Authorization: Bearer md_live_xxxxxxxxxxxxxxxx2. Find your template
curl https://decodemagic.com/api/v1/templates \
-H "Authorization: Bearer $MAGIC_DECODER_KEY"Then list a template's fields:
curl https://decodemagic.com/api/v1/templates/TEMPLATE_ID \
-H "Authorization: Bearer $MAGIC_DECODER_KEY"
{
"id": "TEMPLATE_ID",
"name": "Offer Letter",
"fields": [
{ "key": "candidateName", "label": "Candidate Name", "type": "text", "required": true },
{ "key": "startDate", "label": "Start Date", "type": "date", "required": true }
]
}3. Generate a document
Keys can be the field key or its label — whichever is easier to send. Dates in YYYY-MM-DD are written out as “November 2, 2026”.
curl -X POST https://decodemagic.com/api/v1/templates/TEMPLATE_ID/generate \
-H "Authorization: Bearer $MAGIC_DECODER_KEY" \
-H "Content-Type: application/json" \
-d '{"Candidate Name": "Jordan Rivera", "Start Date": "2026-11-02"}'
{
"id": "…",
"file_name": "offer-letter-filled.pdf",
"content_type": "application/pdf",
"file_url": "https://…", // download link, valid 7 days
"expires_at": "2026-11-09T12:00:00.000Z",
"fields_filled": 2,
"missing_required": []
}Add ?format=file to get the file itself in the response instead of a link.
By default a document is still generated when required fields are blank, and missing_required lists them. Add ?strict=true to refuse instead — you'll get a 422 with the list and no document.
Zapier, Make & webhooks
A Magic Decoder app in Zapier's directory is on the way. Until then, Zapier's built-in Webhooks by Zapier step does the same job:
- Add an action step: Webhooks by Zapier → Custom Request.
- Method
POST, URLhttps://decodemagic.com/api/v1/templates/TEMPLATE_ID/generate. - Data: a JSON object mapping your field labels to values from earlier steps, e.g.
{"Candidate Name": "{{name}}"}. - Headers:
Authorization=Bearer YOUR_API_KEYandContent-Type=application/json. - Use the response's
file_urlin the next step — attach it to an email, or save it to Google Drive or Dropbox.
Make, n8n, or your own code: the same request works from any HTTP step.
Errors
401— missing or revoked API key403— the account isn't on Pro404— template not found (or not yours)400— body isn't valid JSON422— required fields missing (only with?strict=true)
Need many documents at once?
You don't need the API for that: open a template, choose Bulk from spreadsheet, and upload a CSV to get one document per row in a zip.
See Pro pricing →