Template API

These are the Template endpoints of the Keila API. For Keila Cloud, the base URL is https://app.keila.io.

All endpoints, unless stated differently, require Bearer authentication.

A template is a reusable email design that campaigns and messages can build on. Each template has a type — text, html, mjml, or hybrid. Templates can define named content slots that a campaign or transactional message fills in with its own content.

get /api/v1/templates

Index templates

Retrieve all templates from your project.

Responses

200 Template index response

  • dataobject[]
    • assignsobject
    • html_bodystring

      Example: "<html>\n <body>\n <keila-content name=\"main\">\n <p>Hey {{ contact.first_name }}.</p>\n </keila-content>\n <p><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></p>\n </body>\n</html>\n"

    • html_content_slotsobject[]

      Slots defined with tags in html_body. Read-only; present only for html templates.

    • idstring

      Template ID

      Example: "tpl_12345"

    • inserted_atstring

      Example: "2026-06-24T16:59:42.148158Z"

    • mjml_bodystring

      Example: "<mjml>\n <mj-body>\n <keila-content name=\"main\">\n <mj-text>Hey {{ contact.first_name }}.</mj-text>\n </keila-content>\n <mj-text><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></mj-text>\n </mj-body>\n</mjml>\n"

    • mjml_content_slotsobject[]

      Slots defined with tags in mjml_body. Read-only; present only for mjml templates.

    • namestring

      Example: "Welcome Email"

    • stylesstring
    • text_bodystring

      Example: "<keila-content name=\"main\">\nHey {{ contact.first_name }}.\n</keila-content>\n\n--\nUnsubscribe: {{ unsubscribe_link }}\n"

    • text_content_slotsobject[]

      Slots defined with tags in text_body. Read-only; present only for text templates.

    • type"text" | "html" | "mjml" | "hybrid"

      Example: "mjml"

    • updated_atstring

      Example: "2026-06-24T16:59:42.148174Z"

  • metaobject
post /api/v1/templates

Create Template

Creates a new template in your project.

The body field you provide must match the template type: mjml_body for mjml templates, html_body for html templates, and text_body for text templates. You cannot supply a body field for hybrid templates but you may specify "assigns": {"signature": "your email signature"}.

Slots

mjml, html, and text templates support content slots. You may add a content slot by adding a <keila-content name="..."></keila-content> in the template body. For mjml templates, this element must be a direct child of mj-body.

Request body

  • dataobject
    • assignsobject
    • html_bodystring

      Example: "<html>\n <body>\n <keila-content name=\"main\">\n <p>Hey {{ contact.first_name }}.</p>\n </keila-content>\n <p><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></p>\n </body>\n</html>\n"

    • mjml_bodystring

      Example: "<mjml>\n <mj-body>\n <keila-content name=\"main\">\n <mj-text>Hey {{ contact.first_name }}.</mj-text>\n </keila-content>\n <mj-text><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></mj-text>\n </mj-body>\n</mjml>\n"

    • namestring required

      Example: "Welcome Email"

    • stylesstring
    • text_bodystring

      Example: "<keila-content name=\"main\">\nHey {{ contact.first_name }}.\n</keila-content>\n\n--\nUnsubscribe: {{ unsubscribe_link }}\n"

    • type"text" | "html" | "mjml" | "hybrid" required

      Example: "mjml"

Responses

200 Template response

  • dataobject
    • assignsobject
    • html_bodystring

      Example: "<html>\n <body>\n <keila-content name=\"main\">\n <p>Hey {{ contact.first_name }}.</p>\n </keila-content>\n <p><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></p>\n </body>\n</html>\n"

    • html_content_slotsobject[]

      Slots defined with tags in html_body. Read-only; present only for html templates.

    • idstring

      Template ID

      Example: "tpl_12345"

    • inserted_atstring

      Example: "2026-06-24T16:59:42.148158Z"

    • mjml_bodystring

      Example: "<mjml>\n <mj-body>\n <keila-content name=\"main\">\n <mj-text>Hey {{ contact.first_name }}.</mj-text>\n </keila-content>\n <mj-text><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></mj-text>\n </mj-body>\n</mjml>\n"

    • mjml_content_slotsobject[]

      Slots defined with tags in mjml_body. Read-only; present only for mjml templates.

    • namestring

      Example: "Welcome Email"

    • stylesstring
    • text_bodystring

      Example: "<keila-content name=\"main\">\nHey {{ contact.first_name }}.\n</keila-content>\n\n--\nUnsubscribe: {{ unsubscribe_link }}\n"

    • text_content_slotsobject[]

      Slots defined with tags in text_body. Read-only; present only for text templates.

    • type"text" | "html" | "mjml" | "hybrid"

      Example: "mjml"

    • updated_atstring

      Example: "2026-06-24T16:59:42.148174Z"

get /api/v1/templates/{id}

Show Template

Parameters

Name In Type Required Description
id path string yes Template ID

Responses

200 Template response

  • dataobject
    • assignsobject
    • html_bodystring

      Example: "<html>\n <body>\n <keila-content name=\"main\">\n <p>Hey {{ contact.first_name }}.</p>\n </keila-content>\n <p><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></p>\n </body>\n</html>\n"

    • html_content_slotsobject[]

      Slots defined with tags in html_body. Read-only; present only for html templates.

    • idstring

      Template ID

      Example: "tpl_12345"

    • inserted_atstring

      Example: "2026-06-24T16:59:42.148158Z"

    • mjml_bodystring

      Example: "<mjml>\n <mj-body>\n <keila-content name=\"main\">\n <mj-text>Hey {{ contact.first_name }}.</mj-text>\n </keila-content>\n <mj-text><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></mj-text>\n </mj-body>\n</mjml>\n"

    • mjml_content_slotsobject[]

      Slots defined with tags in mjml_body. Read-only; present only for mjml templates.

    • namestring

      Example: "Welcome Email"

    • stylesstring
    • text_bodystring

      Example: "<keila-content name=\"main\">\nHey {{ contact.first_name }}.\n</keila-content>\n\n--\nUnsubscribe: {{ unsubscribe_link }}\n"

    • text_content_slotsobject[]

      Slots defined with tags in text_body. Read-only; present only for text templates.

    • type"text" | "html" | "mjml" | "hybrid"

      Example: "mjml"

    • updated_atstring

      Example: "2026-06-24T16:59:42.148174Z"

put /api/v1/templates/{id}

Update Template

Parameters

Name In Type Required Description
id path string yes Template ID

Request body

  • dataobject
    • assignsobject
    • html_bodystring

      Example: "<html>\n <body>\n <keila-content name=\"main\">\n <p>Hey {{ contact.first_name }}.</p>\n </keila-content>\n <p><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></p>\n </body>\n</html>\n"

    • mjml_bodystring

      Example: "<mjml>\n <mj-body>\n <keila-content name=\"main\">\n <mj-text>Hey {{ contact.first_name }}.</mj-text>\n </keila-content>\n <mj-text><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></mj-text>\n </mj-body>\n</mjml>\n"

    • namestring

      Example: "Welcome Email"

    • stylesstring
    • text_bodystring

      Example: "<keila-content name=\"main\">\nHey {{ contact.first_name }}.\n</keila-content>\n\n--\nUnsubscribe: {{ unsubscribe_link }}\n"

Responses

200 Template response

  • dataobject
    • assignsobject
    • html_bodystring

      Example: "<html>\n <body>\n <keila-content name=\"main\">\n <p>Hey {{ contact.first_name }}.</p>\n </keila-content>\n <p><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></p>\n </body>\n</html>\n"

    • html_content_slotsobject[]

      Slots defined with tags in html_body. Read-only; present only for html templates.

    • idstring

      Template ID

      Example: "tpl_12345"

    • inserted_atstring

      Example: "2026-06-24T16:59:42.148158Z"

    • mjml_bodystring

      Example: "<mjml>\n <mj-body>\n <keila-content name=\"main\">\n <mj-text>Hey {{ contact.first_name }}.</mj-text>\n </keila-content>\n <mj-text><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></mj-text>\n </mj-body>\n</mjml>\n"

    • mjml_content_slotsobject[]

      Slots defined with tags in mjml_body. Read-only; present only for mjml templates.

    • namestring

      Example: "Welcome Email"

    • stylesstring
    • text_bodystring

      Example: "<keila-content name=\"main\">\nHey {{ contact.first_name }}.\n</keila-content>\n\n--\nUnsubscribe: {{ unsubscribe_link }}\n"

    • text_content_slotsobject[]

      Slots defined with tags in text_body. Read-only; present only for text templates.

    • type"text" | "html" | "mjml" | "hybrid"

      Example: "mjml"

    • updated_atstring

      Example: "2026-06-24T16:59:42.148174Z"

patch /api/v1/templates/{id}

Update Template

Parameters

Name In Type Required Description
id path string yes Template ID

Request body

  • dataobject
    • assignsobject
    • html_bodystring

      Example: "<html>\n <body>\n <keila-content name=\"main\">\n <p>Hey {{ contact.first_name }}.</p>\n </keila-content>\n <p><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></p>\n </body>\n</html>\n"

    • mjml_bodystring

      Example: "<mjml>\n <mj-body>\n <keila-content name=\"main\">\n <mj-text>Hey {{ contact.first_name }}.</mj-text>\n </keila-content>\n <mj-text><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></mj-text>\n </mj-body>\n</mjml>\n"

    • namestring

      Example: "Welcome Email"

    • stylesstring
    • text_bodystring

      Example: "<keila-content name=\"main\">\nHey {{ contact.first_name }}.\n</keila-content>\n\n--\nUnsubscribe: {{ unsubscribe_link }}\n"

Responses

200 Template response

  • dataobject
    • assignsobject
    • html_bodystring

      Example: "<html>\n <body>\n <keila-content name=\"main\">\n <p>Hey {{ contact.first_name }}.</p>\n </keila-content>\n <p><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></p>\n </body>\n</html>\n"

    • html_content_slotsobject[]

      Slots defined with tags in html_body. Read-only; present only for html templates.

    • idstring

      Template ID

      Example: "tpl_12345"

    • inserted_atstring

      Example: "2026-06-24T16:59:42.148158Z"

    • mjml_bodystring

      Example: "<mjml>\n <mj-body>\n <keila-content name=\"main\">\n <mj-text>Hey {{ contact.first_name }}.</mj-text>\n </keila-content>\n <mj-text><a href=\"{{ unsubscribe_link }}\">Unsubscribe</a></mj-text>\n </mj-body>\n</mjml>\n"

    • mjml_content_slotsobject[]

      Slots defined with tags in mjml_body. Read-only; present only for mjml templates.

    • namestring

      Example: "Welcome Email"

    • stylesstring
    • text_bodystring

      Example: "<keila-content name=\"main\">\nHey {{ contact.first_name }}.\n</keila-content>\n\n--\nUnsubscribe: {{ unsubscribe_link }}\n"

    • text_content_slotsobject[]

      Slots defined with tags in text_body. Read-only; present only for text templates.

    • type"text" | "html" | "mjml" | "hybrid"

      Example: "mjml"

    • updated_atstring

      Example: "2026-06-24T16:59:42.148174Z"

delete /api/v1/templates/{id}

Delete Template

Parameters

Name In Type Required Description
id path string yes Template ID

Responses

204 Template was deleted successfully or didn’t exist.