Authentication

Bearer keys, scopes, and what to do if one leaks.

Every request to the API carries your API key as a bearer token. There is no other authentication method — no signed query strings, no cookies, no username and password.

Authorization: Bearer hme_yourkeyid_yoursecret

Send it over HTTPS only. The API does not accept plain HTTP.

The shape of a key

hme_yourkeyid_yoursecret
 │      │          └─ the secret half — shown once, never stored in readable form
 │      └─ the key id — safe to log, use it to identify or revoke the key
 └─ a fixed prefix so a leaked key is recognisable on sight

The key id is the part you can safely put in your own logs and support tickets. Never log or paste the whole key.

Scopes

A key carries only the permissions you give it. Grant the least it needs.

ScopeLets the keyNeeded for
sendsend emailPOST /v1/send, POST /v1/send/batch, scheduled sends, the email log
domainsadd and verify sending domainsPOST /v1/domains, GET /v1/domains/:domain, recheck
templatesmanage saved templatesall /v1/templates routes

Scopes are deliberately separate. A key that can send cannot quietly add a new sending domain, and a key that manages domains cannot send. If a key leaks, the damage is bounded by its scope.

Rotating a key

A key cannot be un-issued by its value. To rotate:

  1. Create the new key and deploy it.
  2. Confirm your traffic is running on the new key.
  3. Revoke the old key by its key id.

Revocation takes effect on the next request. Anything already queued still goes out — revoking a key stops new requests, it does not recall sent mail.

If a key leaks

Revoke it immediately, then create a replacement. Because scopes are separate, check what that particular key could do: a send key could have sent mail from your verified domains, and that mail is in your email log.

Errors

StatuserrorMeaning
401missing_api_keyno bearer token on the request
401invalid_api_keykey not recognised, or wrong secret
401api_key_revokedthe key has been revoked
403insufficient_scopethe key lacks the scope this route needs

A 401 never tells you which half of the key was wrong. That is deliberate — it stops an attacker using the error message to confirm a valid key id.