REFERENCE

Templates reference

List published templates, read their roles and fields, and send a document from one.

All documentation

Templates are built in the web app - there is no endpoint that creates one, because placing fields is a visual job. The API reads them and sends from them. For the worked example, see send from a template.

GET/v1/templates
Requires templates:read
Query parameters
FieldTypeNotes
limitinteger1 to 100. Defaults to 20.
cursorstringPass next_cursor from the previous page.
200 OK
{
  "data": [
    { "id": "tpl_4c8a...", "name": "Mutual NDA", "description": null,
      "status": "PUBLISHED",
      "roles": [ { "role": "Client", "type": "SIGNER" } ],
      "created_at": "2026-08-02T09:14:00.000Z" }
  ],
  "has_more": false,
  "next_cursor": null
}
Published templates only
Drafts are never returned. If a template you expect is missing, publish it in the web app.
GET/v1/templates/{id}
Requires templates:read

This is the call that tells you how to send. roles is who you must supply; fields[].field_key is what you are allowed to prefill.

200 OK
{
  "id": "tpl_4c8a...",
  "name": "Mutual NDA",
  "description": null,
  "status": "PUBLISHED",
  "roles": [
    { "role": "Client",  "type": "SIGNER", "order": 0 },
    { "role": "Counsel", "type": "CC",     "order": 1 }
  ],
  "fields": [
    { "field_key": "contract_value", "type": "TEXT",
      "role": "Client", "required": true, "page": 2 }
  ],
  "created_at": "2026-08-02T09:14:00.000Z"
}

A field with a field_key of null cannot be prefilled - it has no handle to address it by.

POST/v1/templates/{id}/send
Requires templates:write
Body
FieldTypeNotes
recipientsobject[]required1 to 20. Each carries role, name, email and optional phone.
recipients[].rolestringrequiredMatched case-insensitively against the template roles.
titlestringUp to 160 chars. Defaults to the template name.
field_valuesobjectKeyed by field_key, values up to 2000 chars. Unknown keys are ignored silently.
sendbooleanDefaults to true. Pass false to leave a draft.
embedobjectOpt in to embed_links in the response. Takes expires_in (60-3600, default 900) and an https redirect_url. Requires send: true.
bash
curl https://api.documentesign.com/v1/templates/tpl_4c8a.../send \
  -H "Authorization: Bearer $ESIGN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recipients": [
      { "role": "Client", "name": "Sam Rivera", "email": "sam@example.com" }
    ],
    "field_values": { "contract_value": "48,000 USD" }
  }'

Returns the document object, with each recipient's role populated.

Errors
FieldTypeNotes
template_not_found404Unknown id, or the template belongs to the other mode.
template_not_published409It exists but is still a draft.
unknown_role400A role you supplied is not on the template. Carries known_roles.
missing_roles400A template role was left unassigned. Carries missing_roles.
duplicate_role400The same role was supplied twice.
unprefillable_field_type400A field_values key targets a signature, identity or server-stamped field. Lists every offending key.
invalid_prefill_value400A value does not fit its field type - text in a number, an option not on the dropdown.
embedding_not_configured409embed was requested but the workspace has no allowed origins.