Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Store a template

Stores a template that overrides the template file of the same name.

The name, content and language fields are required. Leaving sites out binds the record to the current site of the request, and leaving is_active out stores it as active.

The name must not already be stored for the same language on any of the sites the record is bound to — deactivated records included. If it is, the request is rejected and the response names the site and the language that conflict. Send the request as JSON: a form-encoded request skips this check altogether, for the reason given under Uniqueness.

The template source is not checked for syntax errors, and the name is not checked against the templates that exist on disk: a name that matches no template file is accepted and simply overrides nothing. See How a Stored Template Is Used for everything that has to hold before the stored source is rendered, and Dynamic Settings & Environment Variables for the TEMPLATE_LOADER configuration that decides whether stored templates are consulted at all.

The identifier and the timestamps in a request body are ignored — they are assigned by the server.

post
/templates/
Authorizations
AuthorizationstringRequired

Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.

Body

Request body for storing or fully updating a template. name, content and language are required on both operations.

is_active defaults to true when it is omitted, on a full update as well — leaving it out therefore reactivates a deactivated record. An omitted or empty sites binds a new record to the current site of the request, and leaves the stored sites untouched on a full update.

namestring · max: 100Required

The path of the template to override, extension included. Surrounding whitespace and leading slashes are removed before the value is stored. The name is not checked against the templates that exist on disk, and must not already be stored for the same language on any of the sites the record is bound to.

Example: emails/orders/completed.html
contentstringRequired

The template source. May not be empty, and is stored without being checked for syntax errors.

Example: {% extends "emails/base.html" %} {% block content %}<h1>Your order is complete.</h1>{% endblock %}
languagestringRequired

The language the record applies to. Must be one of the language codes configured for the deployment.

Example: tr-tr
is_activebooleanOptional

Whether the record is used when the template is rendered. Omitting it stores the record as active.

Default: trueExample: true
sitesinteger[]Optional

Identifiers of the sites the record applies to. Every identifier must belong to an existing site. A non-empty array replaces the stored sites completely; an omitted or empty array binds a new record to the current site and leaves an existing record's sites untouched.

Example: [1]
Responses
201

The stored template.

application/json

A stored template returned by the API. The full template source is part of the response, and deactivated records are returned in the same shape as active ones.

pkintegerRead-onlyRequired

Unique identifier of the stored template.

namestring · max: 100Required

The path of the template being overridden, as it was stored — without surrounding whitespace and without a leading slash.

Example: emails/orders/completed.html
contentstringRequired

The template source, returned exactly as it was stored.

Example: {% extends "emails/base.html" %} {% block content %}<h1>Your order is complete.</h1>{% endblock %}
languagestringRequired

The language the record applies to, as one of the language codes configured for the deployment.

Example: tr-tr
is_activebooleanRequired

Whether the record is used when the template is rendered. false on a record that was deleted through this API.

Example: true
sitesinteger[]Required

Identifiers of the sites the record is bound to. Empty on a record that is bound to no site, which is never rendered.

Example: [1]
created_datestring · date-timeRead-onlyRequired

When the record was created.

modified_datestring · date-timeRead-onlyRequired

When the record was last modified.

post/templates/
POST /api/v1/remote/1/templates/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 201

{
  "name": "emails/orders/completed.html",
  "content": "{% extends \"emails/base.html\" %}\n{% block content %}<h1>Your order is complete.</h1>{% endblock %}",
  "language": "tr-tr",
  "is_active": true,
  "sites": [
    1
  ]
}
{
  "pk": 1,
  "name": "emails/orders/completed.html",
  "content": "{% extends \"emails/base.html\" %}\n{% block content %}<h1>Your order is complete.</h1>{% endblock %}",
  "language": "tr-tr",
  "is_active": true,
  "sites": [
    1
  ],
  "created_date": "2026-01-01T00:00:00.000Z",
  "modified_date": "2026-01-01T00:00:00.000Z"
}

Last updated

Was this helpful?