Collections
A Template Set groups multiple templates (e.g. invoice + cover letter + delivery slip) and maps one canonical set of fields onto each template's internal field names. The Collections API renders all of them in one call.
If you only need to render one template, use POST /api/v1/renders instead.
Create a collection
POST /api/v1/collections
Authorization: Bearer dg_your_api_key
Content-Type: application/jsonRequest body
| Field | Type | Required | Description |
|---|---|---|---|
template_set_id | string | yes | ID of the Template Set to render. Set up in the dashboard. |
data | object | no | Canonical field values. The Set's field map translates these into each template's internal field names. Keys not in the field map are passed through unchanged. |
visibility | string | no | "public" (default) or "secure". Applied to all renders in the collection. |
Response — 202
{
"id": "cm4job5tn0001jr04p3a9s7cd",
"status": "pending",
"template_set_id": "cm4set9wk0001jt04h6b2n8fe",
"renders": [
{ "id": "cm4rnd7qh0001jx04w8e2t5va", "template_id": "cm4tpl8e20001js04xq2v9k3m", "status": "pending", "url": null },
{ "id": "cm4rnd7qh0001jx04w8e2t5va", "template_id": "cm4tpl2ah0002js04r7d3w9pn", "status": "pending", "url": null },
{ "id": "cm4rnd7qh0001jx04w8e2t5va", "template_id": "cm4tpl6mv0003js04g1k5z2qx", "status": "pending", "url": null }
],
"created_at": "2026-04-22T12:00:00.000Z"
}The collection always renders asynchronously — there is no sync mode. Each template renders in parallel as a separate background job.
Errors
| Code | When |
|---|---|
400 | Missing template_set_id, invalid JSON, or the Set has no templates |
401 | Missing or invalid API key |
402 | Insufficient credits — each render in the Set counts (a 3-template Set needs 3 credits) |
404 | Set not found, or one of its templates is missing |
422 | visibility is not "public" or "secure" |
Poll a collection
GET /api/v1/collections/{id}
Authorization: Bearer dg_your_api_keyResponse — 200
{
"id": "cm4job5tn0001jr04p3a9s7cd",
"status": "completed",
"template_set_id": "cm4set9wk0001jt04h6b2n8fe",
"template_set_name": "Closing packet",
"renders": [
{
"id": "cm4rnd7qh0001jx04w8e2t5va",
"template_id": "cm4tpl8e20001js04xq2v9k3m",
"status": "completed",
"format": "pdf",
"url": "https://cdn.automette.com/renders/cm4rnd7qh0001jx04w8e2t5va.pdf",
"error": null
}
],
"total_count": 3,
"completed_count": 3,
"failed_count": 0,
"created_at": "2026-04-22T12:00:00.000Z"
}status transitions:
pending→ at least one render still queuedrunning→ at least one render in flightcompleted→ all renders finished successfully (failed_countis 0)failed→ at least one render failed; check each render'serror
Poll every 1–2 seconds, or — better — subscribe to render.completed and render.failed and react when all the collection's renders have settled.
Field mapping
Each entry in the Set has a fieldMap that translates canonical keys into the template's internal keys. Given data: { "price": "$1,200" } and a field map { "price": "amount" }, the template receives { "amount": "$1,200" }. Keys not listed in the field map are passed through as-is.
This lets one canonical payload (e.g. address, price, closing_date) drive templates that were authored with different field names.
Example
# Trigger the collection
job=$(curl -s -X POST https://automette.com/api/v1/collections \
-H "Authorization: Bearer dg_your_key" \
-H "Content-Type: application/json" \
-d '{
"template_set_id": "cm4set9wk0001jt04h6b2n8fe",
"data": { "address": "123 Main St", "price": "$1,200,000", "closing_date": "2026-05-01" }
}' | jq -r '.id')
# Poll until done
while : ; do
status=$(curl -s "https://automette.com/api/v1/collections/$job" \
-H "Authorization: Bearer dg_your_key" | jq -r '.status')
[ "$status" = "completed" ] || [ "$status" = "failed" ] && break
sleep 2
done