Skip to Content
Templates

Draft a document from a template

An AppliFlo library item or official form (a lib_ id from items[]) is the app's Use: a ready item drafts with each role's person bound (an unreviewed contract needs risk_accepted: true unless the person already accepted that version); a form AppliFlo hasn't set up is imported as a new document and its fields are read, and recipients are added when you send. The e-sign rule applies at send (a fill-and-print-only form drafts, but every send refuses it). Any other id is the older contract-template model (values + recipients in party order). Saved templates: POST /saved-templates/{id}/create-document.

POST
/api/v1/templates/{id}/create-document

An AppliFlo library item or official form (a lib_ id from items[]) is the app's Use: a ready item drafts with each role's person bound (an unreviewed contract needs risk_accepted: true unless the person already accepted that version); a form AppliFlo hasn't set up is imported as a new document and its fields are read, and recipients are added when you send. The e-sign rule applies at send (a fill-and-print-only form drafts, but every send refuses it). Any other id is the older contract-template model (values + recipients in party order). Saved templates: POST /saved-templates/{id}/create-document.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Workspace API key, e.g. "Authorization: Bearer aflo_live_<64 hex chars>". Keys are hashed at rest and shown only once at creation. A key has scopes: read (GET routes), draft (create or change documents, fields and templates) and send (send, void, remind and bulk send); a call outside them gets 403 insufficient_scope. A key may expire (401 api_key_expired). Keys made before scopes existed have full access.

Path Parameters

id*string

Template id from GET /templates (items[].template_id for a lib_ item).

Header Parameters

Idempotency-Key?string

A client-generated key scoping this request as a retry of a prior identical request. A replay within 24h returns the first response instead of repeating the side effect (e.g. a second send). The key is bound to the request it was first used with: the same key with a different body or target is refused (422, code idempotency_key_reused).

Lengthlength <= 255

Request Body

application/json
  1. body

For an AppliFlo library item or official form (a lib_ id).

recipients?array<>

One person per role of a ready item (ignored for a form AppliFlo hasn't set up: add recipients when you send). A draft is not sent, so delivery isn't taken here (it is ignored): choose it per recipient on POST /documents/{id}/send.

Items1 <= items <= 10
document_name?string

Defaults to the template's name.

Length1 <= length <= 255
fixed_overrides?

The sender's values for the template's DEFAULT fixed boxes (fixed_fields[] with locked: false), keyed by fixed_fields[].index: text, true/false for a tick box, or option value(s) for a choice question. A Locked box is set by the template: an override is refused with 422 locked_field. A Locked box whose workspace or My details value is empty is refused with 422 missing_detail. An AppliFlo library form's Ask on copy box that nothing answers is refused with 422 unanswered_ask: give it a value here.

local_day?string

The sender's own day (YYYY-MM-DD) fixed dates count from.

Match^\d{4}-\d{2}-\d{2}$
risk_accepted?boolean

The person accepts AppliFlo's own-risk terms (Terms section 8A) for a library contract no lawyer has reviewed. Recorded with the request's IP and browser once the draft is made.

Response Body

Drafted document, with its fields already placed and bound to the recipients (an imported form: its fields as read).

application/json
  1. response
success*boolean
data*|
Example Request
curl -X POST 'https://appliflo.com/api/v1/templates/string/create-document' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "success": true,  "data": {    "document_id": "string",    "template_id": "string",    "kind": "library",    "status": "draft",    "name": "string",    "template_version": 1,    "review_required": true,    "values": {},    "recipients": [      {        "index": 0,        "role_key": "string",        "name": "string",        "email": "string",        "role": "string"      }    ],    "fields": [      {}    ],    "groups": [      {}    ],    "fields_read": true,    "detection_skipped": "ai_off",    "notice": "string",    "ai_pages": {},    "flagged_count": 0  }}