← All API sections

Templates

Manage email templates with MiniJinja syntax

5 endpoints
Menu

Endpoints

MethodPathDescription
GET/v1/templatesGET /v1/templates
POST/v1/templatesPOST /v1/templates
GET/v1/templates/{id}GET /v1/templates/:id
PUT/v1/templates/{id}PUT /v1/templates/:id
DELETE/v1/templates/{id}DELETE /v1/templates/:id

GET /v1/templates

GET /v1/templates

Parameters

NameInTypeRequiredDescription
pagequeryintegerNoPage number (default: 1)
per_pagequeryintegerNoItems per page (default: 25)

Responses

StatusDescription
200Paginated list of templates
401Unauthorized

Example

curl -X GET https://api.euromail.dev/v1/templates \
  -H "Authorization: Bearer em_live_..."
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.listTemplates();
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.list_templates()
use euromail::EuroMail;

let client = EuroMail::new("em_live_...");

let result = client.list_templates().await?;
client := euromail.NewClient("em_live_...")

result, err := client.ListTemplates(ctx)

POST /v1/templates

POST /v1/templates

Request Body

FieldTypeRequiredDescription
aliasstringYes
html_bodystring | nullNo
namestringYes
preheaderstring | nullNoInbox preview text shown after the subject. Rendered with template_data and added as a hidden block at the top of the HTML part. Omit or leave blank for none.
subjectstringYes
text_bodystring | nullNo

Responses

StatusDescription
201Template created
401Unauthorized
409Template alias already exists

Example

curl -X POST https://api.euromail.dev/v1/templates \
  -H "Authorization: Bearer em_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "subject": "Welcome aboard",
  "alias": "...",
  "name": "..."
}'
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.createTemplate({
  subject: "Welcome aboard",
  alias: "...",
  name: "..."
});
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.create_template(
    subject="Welcome aboard",
    alias="...",
    name="...",
)
use euromail::{EuroMail, CreateTemplateParams};

let client = EuroMail::new("em_live_...");

let result = client.create_template(&CreateTemplateParams {
    subject: "Welcome aboard".into(),
    alias: "...".into(),
    name: "...".into(),
    ..Default::default()
}).await?;
client := euromail.NewClient("em_live_...")

result, err := client.CreateTemplate(ctx, euromail.CreateTemplateParams{
    Subject: "Welcome aboard",
    Alias: "...",
    Name: "...",
})

GET /v1/templates/{id}

GET /v1/templates/:id

Parameters

NameInTypeRequiredDescription
idpathstringYesTemplate ID

Responses

StatusDescription
200Template details
401Unauthorized
404Template not found

Example

curl -X GET https://api.euromail.dev/v1/templates/{id} \
  -H "Authorization: Bearer em_live_..."
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.getTemplate("id_...");
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.get_template("id_...")
use euromail::EuroMail;

let client = EuroMail::new("em_live_...");

let result = client.get_template("id_...").await?;
client := euromail.NewClient("em_live_...")

result, err := client.GetTemplate(ctx, "id_...")

PUT /v1/templates/{id}

PUT /v1/templates/:id

Parameters

NameInTypeRequiredDescription
idpathstringYesTemplate ID

Request Body

FieldTypeRequiredDescription
html_bodystring | nullNo
namestringYes
preheaderstring | nullNoInbox preview text shown after the subject. Rendered with template_data and added as a hidden block at the top of the HTML part. Omit or leave blank for none.
subjectstringYes
text_bodystring | nullNo

Responses

StatusDescription
200Template updated
401Unauthorized
404Template not found

Example

curl -X PUT https://api.euromail.dev/v1/templates/{id} \
  -H "Authorization: Bearer em_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "subject": "Welcome aboard",
  "name": "..."
}'
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.updateTemplate({
  subject: "Welcome aboard",
  name: "..."
});
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.update_template(
    subject="Welcome aboard",
    name="...",
)
use euromail::{EuroMail, UpdateTemplateParams};

let client = EuroMail::new("em_live_...");

let result = client.update_template(&UpdateTemplateParams {
    subject: "Welcome aboard".into(),
    name: "...".into(),
    ..Default::default()
}).await?;
client := euromail.NewClient("em_live_...")

result, err := client.UpdateTemplate(ctx, euromail.UpdateTemplateParams{
    Subject: "Welcome aboard",
    Name: "...",
})

DELETE /v1/templates/{id}

DELETE /v1/templates/:id

Parameters

NameInTypeRequiredDescription
idpathstringYesTemplate ID

Responses

StatusDescription
204Template deleted
401Unauthorized
404Template not found

Example

curl -X DELETE https://api.euromail.dev/v1/templates/{id} \
  -H "Authorization: Bearer em_live_..."
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.deleteTemplate("id_...");
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.delete_template("id_...")
use euromail::EuroMail;

let client = EuroMail::new("em_live_...");

let result = client.delete_template("id_...").await?;
client := euromail.NewClient("em_live_...")

result, err := client.DeleteTemplate(ctx, "id_...")