Authentication
Two credentials reach these endpoints, and which one you use depends on where the code runs. Your server uses the API key, as above. The browser uses a JWT scoped to one Tenant, which is the same tokenTemplateProvider takes. Issue it with
and scope it as
lists.
Never send the API key from a browser. It carries the whole workspace, not one Tenant,
so a customer holding it can read and write every other customer’s Templates.
Endpoints
A
PUT replaces the draft rather than merging into it, so send the whole document. Reading
first and writing back a modified copy is the safe order.
Publishing is a separate call
A write leaves a draft. A draft does not send, so a customer who edits and closes the tab has changed nothing a recipient will see. Publishing is what promotes it.useTemplateActions when you hide it. See
.
Versions
Publishing keeps the previous published document, and reads one back by version. Use it to show a customer what changed, or to restore a document by writing an older version back with aPUT.
Common responses
401 and 403 separate cleanly, and the difference is worth reading. A 401 means fix the
token. A 403 means the token works but was scoped too narrowly, which for a JWT usually
means a brand scope is missing or the tenant in the scope is not the one in the path.
Tenant Templates are not workspace Templates
These two live in different places and neither endpoint reaches the other.
A Template your customer writes in Courier Create does not appear in the workspace Template
list, and a workspace Template is not editable through these endpoints. Sending to a Tenant
resolves that Tenant’s own Template.
Verify
List the Tenant’s Templates, write a draft with aPUT, then read it back. Publish it and
read it again. The published document is what a send to that Tenant now resolves.
Limits & behavior
- A
PUTreplaces, it does not merge. Send the whole document or read first. - A write is a draft. Nothing reaches a recipient until a publish call.
- A JWT is scoped to one Tenant. The
tenantin the scope has to match thetenant_idin the path. - Content needs a channel wrapper. An Elemental document stored without one fails validation with a
400.
FAQ
Why does my edit not reach recipients?
Why does my edit not reach recipients?
A write leaves a draft. Call the publish endpoint, or publish from the editor, before a
send resolves the new document.
What separates a 401 from a 403 here?
What separates a 401 from a 403 here?
A
401 means the credential is missing, malformed, or expired. A 403 means the
credential is valid but too narrowly scoped, usually a missing brand scope or a
tenant scope that does not match the path.Do these endpoints reach my workspace Templates?
Do these endpoints reach my workspace Templates?
Tenant Templates and workspace Templates are separate. Workspace Templates live under
/notifications and are documented in the .Can a browser call these endpoints directly?
Can a browser call these endpoints directly?
A browser can call them with a Tenant-scoped JWT. The API key stays on your server,
because it carries the whole workspace rather than one Tenant.