Templates
Publish a template
Compile and publish one exact saved draft revision.
POST
/api/v1/templates/{templateId}/publishOn this page
Authentication
Send a RouteKite API key as a Bearer token. This endpoint requires the template:write scope.
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Required | Bearer API key with the required workspace scope.Example: Bearer rk_your_key |
Content-Type | string | Required | Must be application/json.Example: application/json |
Path parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
templateId | uuid | Required | The RouteKite template identifier.Example: 27fdc190-3a56-46f0-89e8-88ac64a5087d |
Request body
| Name | Type | Requirement | Description |
|---|---|---|---|
revision | positive integer | Required | The exact saved draft revision to publish. |
Response
| Name | Type | Requirement | Description |
|---|---|---|---|
object | string | Always | Always template_version. |
template_id | uuid | Always | The template identifier. |
id | uuid | Always | The immutable version identifier. |
version_number | integer | Always | The next version number. |
state | string | Always | Always published. |
Publish saved content
Publish never accepts editable content. It compiles the exact saved revision and creates an immutable version.
A legacy mutable marketing draft returns DRAFT_SAVE_REQUIRED until the upgraded document returned by Retrieve is explicitly saved as a new revision.
Errors
| Status | Code | What it means | What to do |
|---|---|---|---|
| 400 | INVALID_REQUEST / INVALID_JSON / INVALID_CURSOR | The JSON, identifier, field, document, or cursor is invalid. | Correct the reported input. |
| 401 | UNAUTHORIZED | The API key is missing, invalid, revoked, or expired. | Check the Bearer header and active key. |
| 403 | FORBIDDEN | The key lacks the required template scope. | Use template:read or template:write as documented for the operation. |
| 429 | RATE_LIMITED | Too many template requests were sent. | Honor Retry-After before retrying. |
| 500 | TEMPLATE_OPERATION_FAILED / INTERNAL_ERROR | The template operation could not complete. | Retry after a short delay. |
| 403 | API_KEY_ACTOR_UNAVAILABLE | The key creator is no longer a workspace member. | Replace the API key with one created by a current member. |
| 404 | NOT_FOUND | The template or version is unavailable in this workspace. | Check the identifier and workspace. |
| 409 | TEMPLATE_CONFLICT / DRAFT_REQUIRED / DRAFT_SAVE_REQUIRED | The saved revision changed, no saved draft exists, or an exact legacy compliance footer was upgraded for editing. | Retrieve the template, explicitly save the returned draft, and retry with its new revision. |
| 413 | PAYLOAD_TOO_LARGE | The request body exceeds 1,100,000 bytes. | Reduce the document or request metadata. |
| 422 | COMPLIANCE_REQUIRED / TEMPLATE_COMPILATION_FAILED / SOURCE_UNAVAILABLE | A marketing compliance block is missing or hidden, the draft cannot compile, or a source has no saved content to duplicate. | Restore the canonical visible compliance block, or correct and save the source content. |