Templates
Manage email templates with MiniJinja syntax
5 endpoints
Endpoints
| Method | Path | Description |
| GET | /v1/templates | GET /v1/templates |
| POST | /v1/templates | POST /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
| Name | In | Type | Required | Description |
page | query | integer | No | Page number (default: 1) |
per_page | query | integer | No | Items per page (default: 25) |
Responses
| Status | Description |
| 200 | Paginated list of templates |
| 401 | Unauthorized |
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
| Field | Type | Required | Description |
alias | string | Yes | |
html_body | `string | null` | No |
name | string | Yes | |
subject | string | Yes | |
text_body | `string | null` | No |
Responses
| Status | Description |
| 201 | Template created |
| 401 | Unauthorized |
| 409 | Template 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
| Name | In | Type | Required | Description |
id | path | string | Yes | Template ID |
Responses
| Status | Description |
| 200 | Template details |
| 401 | Unauthorized |
| 404 | Template 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
| Name | In | Type | Required | Description |
id | path | string | Yes | Template ID |
Request Body
| Field | Type | Required | Description |
html_body | `string | null` | No |
name | string | Yes | |
subject | string | Yes | |
text_body | `string | null` | No |
Responses
| Status | Description |
| 200 | Template updated |
| 401 | Unauthorized |
| 404 | Template 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
| Name | In | Type | Required | Description |
id | path | string | Yes | Template ID |
Responses
| Status | Description |
| 204 | Template deleted |
| 401 | Unauthorized |
| 404 | Template 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_...")