Docs · API reference

Send an email

Send one email from an address on your own domain. It goes out from our mail servers, signed for your domain, and the answer says it's queued.

Preview: may change before launch · Updated

Preview

This is how the API is planned to work. Names and fields may change before launch. The APIs are in early access: join early access to get a key when they're ready.

POST https://api.magpie-cloud.com/v1/emails. What it's for, and how it works: Email sending API.

Request

A JSON body, with your API key in the Authorization header (see Authentication).

FieldTypeRequiredWhat it is
fromstringYesThe sender, as Name <address>, on a domain you've added and set up.
tostringYesThe recipient's address.
subjectstringYesThe subject line.
textstringNoThe body, as plain text. Give this, html, or both.
htmlstringNoThe body, as HTML.
reply_tostringNoWhere replies go.
unsubscribe_urlstringNoAn https address, for the unsubscribe link inboxes show.

Example

Request · POST /emails
curl https://api.magpie-cloud.com/v1/emails \
  -H "Authorization: Bearer $MAGPIE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Jordan <jordan@yourcompany.example>",
    "to": "alex.sample@examplefreight.example",
    "subject": "Quick question about your depots",
    "text": "Hi Alex, ..."
  }'
Response · 200
{
  "id": "msg_4b9e...",
  "status": "queued"
}

Response

FieldTypeWhat it is
idstringThe message's id, to keep with your record of it.
statusstringqueued: accepted, and waiting to go out.

Errors

Errors come back as JSON with a code and a message. See Errors for the shape, and when to try again.

StatusCodeWhen
400invalid_requestA field is missing or isn't valid.
401unauthorizedThe API key is missing, wrong or revoked.
402out_of_creditsYour sending allowance is used up.
403feature_unavailableSending isn't switched on for your account yet, or it's paused.
422domain_not_verifiedfrom isn't on a domain of yours that's ready.
422recipient_suppressedThis address has bounced, complained or opted out.
429daily_send_limitYou've reached today's limit. Retry-After says when it resets.
429rate_limitedToo many requests. Wait the number of seconds in the Retry-After header, then try again.
5xxVariesSomething went wrong on our side. Safe to try again after a short wait.

Billing

The planned price is £0.15$0.25 for every 1,000 emails sent, as on MagpieCRM's hosted plan. It may change before launch.

Notes

  • Before you send, ask for sending to be switched on in the console, add your domain, and put the records we give you in its DNS: the DKIM record and, ideally, DMARC.
  • An address that hard-bounces or marks your email as spam isn't sent to again.
  • Sending has a daily limit that starts low and rises as your email is received well. See Rate limits and pacing.
  • Send an Idempotency-Key header with a value of your own, and sending the same key again won't send the email twice.
  • GET /emails/{id} says how an email went: queued, deferred, delivered, bounced or complained. We don't keep the recipient or subject.
  • Delivery and open events by webhook are planned but not built.

Questions about the APIs? Email pele@magpiecrm.com.