Code examples for sending and querying transactional emails with the Loops API and SDKs.
await fetch("https://app.loops.so/api/v1/transactional/send", { method: "POST", headers: { "Authorization": "Bearer <your-api-key>", "Content-Type": "application/json" }, body: JSON.stringify({ email: "[email protected]", transactionalId: "<transactional-id>", dataVariables: { loginUrl: "https://example.com/login", }, }), });
await fetch("https://app.loops.so/api/v1/transactional/send", { method: "POST", headers: { "Authorization": "Bearer <your-api-key>", "Content-Type": "application/json" }, body: JSON.stringify({ email: "[email protected]", transactionalId: "<transactional-id>", dataVariables: { loginUrl: "https://example.com/login", }, attachments: [ { filename: "example.pdf", contentType: "application/pdf", data: "<base64-encoded-file-content>", }, ], }), });
Idempotency-Key
await fetch("https://app.loops.so/api/v1/transactional/send", { method: "POST", headers: { "Authorization": "Bearer <your-api-key>", "Content-Type": "application/json" "Idempotency-Key": "550e8400-e29b-41d4-a716-446655440000", }, body: JSON.stringify({ email: "[email protected]", transactionalId: "<transactional-id>", dataVariables: { loginUrl: "https://example.com/login", }, }), });
await fetch("https://app.loops.so/api/v1/transactional", { method: "GET", headers: { "Authorization": "Bearer <your-api-key>", }, });
Was this page helpful?