Send a transactional email
API reference
await fetch("https://app.loops.so/api/v1/transactional", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "test@example.com",
transactionalId: "<transactional-id>",
dataVariables: {
loginUrl: "https://example.com/login",
},
}),
});
Send a transactional email with attachments
You must request attachments to be enabled in your account before you can send emails with them.
API reference
await fetch("https://app.loops.so/api/v1/transactional", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "test@example.com",
transactionalId: "<transactional-id>",
dataVariables: {
loginUrl: "https://example.com/login",
},
attachments: [
{
filename: "example.pdf",
contentType: "application/pdf",
data: "<base64-encoded-file-content>",
},
],
}),
});
Send a transactional email with an idempotency key
Add an Idempotency-Key
header to the request to prevent duplicate requests.
API reference
await fetch("https://app.loops.so/api/v1/transactional", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
"Idempotency-Key": "550e8400-e29b-41d4-a716-446655440000",
},
body: JSON.stringify({
email: "test@example.com",
transactionalId: "<transactional-id>",
dataVariables: {
loginUrl: "https://example.com/login",
},
}),
});
List published transactional emails
API reference
await fetch("https://app.loops.so/api/v1/transactional", {
method: "GET",
headers: {
"Authorization": "Bearer <your-api-key>",
},
});