Send a transactional email
using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://dashboard.azimea.com/api/v1/sending/emails"), Headers = { { "Idempotency-Key", "null" }, { "Authorization", "Bearer <token>" }, }, Content = new StringContent("{ \"to\": \"ana@example.com\", \"subject\": \"Your order 1042 is confirmed\", \"html\": \"<p>Hi Ana,</p><p>Thank you for your order 1042. We will let you know when it ships.</p>\", \"idempotencyKey\": null }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}const url = 'https://dashboard.azimea.com/api/v1/sending/emails';const options = { method: 'POST', headers: { 'Idempotency-Key': 'null', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"to":"ana@example.com","subject":"Your order 1042 is confirmed","html":"<p>Hi Ana,</p><p>Thank you for your order 1042. We will let you know when it ships.</p>","idempotencyKey":null}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dashboard.azimea.com/api/v1/sending/emails \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: null' \ --data '{ "to": "ana@example.com", "subject": "Your order 1042 is confirmed", "html": "<p>Hi Ana,</p><p>Thank you for your order 1042. We will let you know when it ships.</p>", "idempotencyKey": null }'Queues one email your own code asks for, about the person’s own account or order: an order confirmation, an access code, a password link. It is transactional, so it needs no marketing consent; it is only stopped for an address that bounced or complained, and then comes back with the status Suppressed and the reason (sending.gate_bounced, sending.gate_complained). Do not use it for newsletters or offers: those are campaigns and flows, which check consent. It goes out from your company’s default sender, on a verified domain; until one exists the email waits in the queue (sending.no_verified_sender). to is one address, subject at most 300 characters, html at most 500,000 characters. The answer’s id is the message id the delivery webhooks (email.delivered, email.bounced, email.complained) carry. Send an Idempotency-Key header (your own id for this send, up to 150 visible ASCII characters) to make retries safe: a second call with the same key, from any key of your account, returns the first message and sends nothing more, even if its body differs. Without the header, a retry queues a second email. Needs the emails:send permission.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Example
nullRequest Bodyrequired
Section titled “Request Bodyrequired”object
Example
ana@example.comExample
Your order 1042 is confirmedExample
<p>Hi Ana,</p><p>Thank you for your order 1042. We will let you know when it ships.</p>Example
{ "to": "ana@example.com", "subject": "Your order 1042 is confirmed", "html": "<p>Hi Ana,</p><p>Thank you for your order 1042. We will let you know when it ships.</p>", "idempotencyKey": null}Responses
Section titled “Responses”The message id and its status: Queued, or Suppressed with the reason
object
object
object
object
object
object
object
Example
{ "isSuccess": true, "value": { "id": "01a10900-0000-7000-8000-000000000301", "status": "Queued", "reason": null }, "status": 0, "errors": [], "fieldErrors": null}Validation failed: see errors[].code and fieldErrors
object
object
Example
{ "statusCode": 400, "message": "One or more errors occurred!"}Missing or invalid API key
The key lacks the emails:send permission