Skip to main content

Templates API

Secret key. campaigns:read to list and read, campaigns:write to create, replace and delete. See Features › Templates.

GET /v1/templates

{ "templates": [ { "id": "66f1…", "name": "order-shipped", "description": null, "content": {}, "data": null, "presentation": { "channelId": "orders" }, "ttl": 86400, "collapseId": null, "priority": null, "silent": false, "useCount": 12, "createdAt": "…", "updatedAt": "…" } ] }

POST /v1/templates

FieldRequiredNotes
nameyes≤ 120, unique per app
contentyesStrict content schema — every locale complete, _default present
description≤ 500
data, presentation, ttl, collapseId, priority, silentSame meaning as on a send; become the defaults when the template is used

201 with the template; 409 duplicate_name if the name exists; 422 invalid_body with field paths.

GET /v1/templates/:id

PUT /v1/templates/:id

Full replacement of the fields above (an optional field left out is removed). 404 when unknown.

DELETE /v1/templates/:id

204. Campaigns that referenced it are unaffected — they hold their own copy.

Using one

curl -X POST https://push.example.com/v1/notifications \
-H "Authorization: Bearer sk_live_…" -H "content-type: application/json" \
-d '{ "target": { "segmentId": "66f2…" }, "templateId": "66f1…" }'

Both POST /v1/notifications and POST /v1/campaigns accept templateId instead of (or alongside) content; request fields override the template's. Unknown template → 404 not_found, and the Idempotency-Key, if any, is not consumed.