Quick start: send your first transactional email with cURL

This guide takes you from a new account to a delivered email using nothing but a terminal. It is the fastest way to see how the JMSURF Mail API behaves before you write code.

1. Create an account

Start free. The Free plan includes 100 emails a month (10 a day) and 1 sending domain, enough to finish this guide and test your integration.

2. Add and verify your domain

In Domains, add the domain you will send from, for example yourshop.co.ke. Copy the records shown (one ownership TXT, two DKIM CNAMEs and DMARC if you have none) into your DNS. We check every 10 minutes and text you when it turns verified. Help for each DNS host is in the SPF, DKIM and DMARC guide.

3. Create an API key

In API keys, create a key. Choose Full access for this test (a Send-only key is better for production services that only send). The key starts with jm_live_ and is shown once. Keep it in an environment variable:

Shell
export JMSURF_MAIL_KEY="jm_live_paste_your_key_here"

4. Send an email

cURL
curl https://api.jmsurfmail.co.ke/api/v1/emails \
  -H "Authorization: Bearer $JMSURF_MAIL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Your Shop <[email protected]>",
    "to": "[email protected]",
    "subject": "Hello from JMSURF Mail",
    "text": "It works.",
    "html": "<p><b>It works.</b></p>"
  }'

Response:

200 OK
{ "id": "4f1c2a3e-0d5b-4c7e-9a7f-2b1c9d0e8f11", "status": "sent" }

5. Check what happened

cURL
curl https://api.jmsurfmail.co.ke/api/v1/emails/4f1c2a3e-0d5b-4c7e-9a7f-2b1c9d0e8f11 \
  -H "Authorization: Bearer $JMSURF_MAIL_KEY"
Response
{
  "id": "4f1c2a3e-…", "from": "Your Shop <[email protected]>", "to": ["[email protected]"],
  "subject": "Hello from JMSURF Mail", "status": "delivered", "tags": [],
  "opened_at": null, "clicked_at": null, "error": null,
  "events": [
    { "type": "sent", "created_at": "…" },
    { "type": "delivered", "recipient": "[email protected]", "created_at": "…" }
  ]
}

6. Check your usage

cURL
curl https://api.jmsurfmail.co.ke/api/v1/usage -H "Authorization: Bearer $JMSURF_MAIL_KEY"
Response
{ "plan": "free", "plan_name": "Free", "status": "active", "renews_at": null,
  "month": { "sent": 1, "allowance": 100 }, "today": { "sent": 1, "cap": 10 }, "domains_allowed": 1 }

If something goes wrong

Errors come back as { "error": "…", "code": "…" } with an HTTP status:

Status and codeMeaning
400 invalid_jsonThe body is not JSON.
401 invalid_api_keyMissing, wrong or revoked key.
403 domain_not_verifiedThe From domain is not verified on your account.
403 insufficient_scopeA send-only key tried to read logs or manage domains.
413 too_largeThe email is over 10 MB.
422 validation_errorA field is missing or wrong; the message says which.
429 quota_exceededDaily or monthly allowance used.
429 rate_limitedMore than 20 requests a second on this key.
502 send_failedEvery delivery route refused it; the message says why.

Next steps

JMSURF Mail is an HTTPS API. There is no SMTP login for customers yet, so apps that can only send through SMTP need a few lines of code that call the API instead. Your own SMTP server can be added as a backup route in Settings.

Send your first email today

Free plan with 100 emails a month, no card needed. Questions? WhatsApp or call +254 712 504 593, or email [email protected].