Tokoman

Developers

Generating documents

One request. The template, the data, your reference, and whatever you want back on the webhook.

bash
POST https://api.tokoman.com/v1/documents
FieldTypeNotes
templateIdstring, requiredThe template's id or slug
dataobjectChecked against the template's schema
correlationIdstringYour own reference. Echoed everywhere, and findable later
metadataobjectReturned untouched on the webhook and the record
enginephantom or chromiumOverride the template's engine for this document
filenamestringWhat the file is called when downloaded
templateVersionnumberPin a version. Defaults to the active one
waitboolean, default trueWait for the PDF. false answers at once with the queued record

Responses

201 with status completed and the download link. If rendering takes longer than the request is willing to wait, 202 with status rendering and the id; fetch it, or wait for the webhook. A failed render answers 201 with status failed, an errorCode and a message you can show.

Fetching and downloading

bash
GET /v1/documents/:id
GET /v1/documents/:id/download?ttlSeconds=900
GET /v1/documents?status=completed&templateId=invoice&limit=50

Download links expire. A fetched record always carries a fresh one. The download endpoint mints a short-lived link on demand and records the download.

Regenerating

bash
POST /v1/documents/:id/regenerate

A new document from the same data and the same template version. The original is untouched.

Pages and billing

Pages are counted from the finished PDF, not estimated. Pages inside your plan's allowance are included; beyond it, each page is charged from your wallet at the plan's rate. A request that cannot be paid for is refused before anything is rendered, with the code PAYMENT_REQUIRED.