← All API sections

Templates

Manage email templates with MiniJinja syntax

5 endpoints

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 "X-EuroMail-Api-Key: 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_body`stringnull`No
namestringYes
subjectstringYes
text_body`stringnull`No

Responses

StatusDescription
201Template created
401Unauthorized
409Template alias already exists

Example

curl -X POST https://api.euromail.dev/v1/templates \
  -H "X-EuroMail-Api-Key: em_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "alias": "...", "name": "example.com", "subject": "Hello World" }'
import { EuroMail } from "@euromail/sdk";

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

const result = await euromail.createTemplate({
    alias: "...",
    name: "example.com",
    subject: "Hello World",
  });
from euromail import EuroMail

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

result = client.create_template(
    alias="...",
    name="example.com",
    subject="Hello World",
)
use euromail::EuroMail;

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

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

result, err := client.CreateTemplate(ctx, euromail.CreateTemplateParams{
    Alias: "...",
    Name: "example.com",
    Subject: "Hello World",
})

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 "X-EuroMail-Api-Key: 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_body`stringnull`No
namestringYes
subjectstringYes
text_body`stringnull`No

Responses

StatusDescription
200Template updated
401Unauthorized
404Template not found

Example

curl -X PUT https://api.euromail.dev/v1/templates/{id} \
  -H "X-EuroMail-Api-Key: em_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "name": "example.com", "subject": "Hello World" }'
import { EuroMail } from "@euromail/sdk";

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

const result = await euromail.updateTemplate({
    name: "example.com",
    subject: "Hello World",
  });
from euromail import EuroMail

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

result = client.update_template(
    name="example.com",
    subject="Hello World",
)
use euromail::EuroMail;

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

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

result, err := client.UpdateTemplate(ctx, euromail.UpdateTemplateParams{
    Name: "example.com",
    Subject: "Hello World",
})

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 "X-EuroMail-Api-Key: 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_...")