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_xxxxxxxxxxxxxxxx

2. 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:

  1. Add an action step: Webhooks by Zapier → Custom Request.
  2. Method POST, URL https://decodemagic.com/api/v1/templates/TEMPLATE_ID/generate.
  3. Data: a JSON object mapping your field labels to values from earlier steps, e.g. {"Candidate Name": "{{name}}"}.
  4. Headers: Authorization = Bearer YOUR_API_KEY and Content-Type = application/json.
  5. Use the response's file_url in 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

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 →