← Back to docs

API Keys & Authentication

Create, use, rotate, and secure EuroMail API keys, and understand the two authentication schemes.

Menu

How authentication works

Every request to the EuroMail API is authenticated with an API key. A key looks like em_live_ followed by 32 random characters. Send it in the standard Authorization header. The SDKs and every example in these docs do this:

curl https://api.euromail.dev/v1/emails \
  -H "Authorization: Bearer em_live_your_key_here"

The API also accepts the key in a custom header, for clients that reserve Authorization for something else:

curl https://api.euromail.dev/v1/emails \
  -H "X-EuroMail-Api-Key: em_live_your_key_here"

Keys are scoped to a single account (or sub-account). The dashboard session and the API key are independent credentials. The key never expires on its own; it is valid until you delete it.

Creating a key

Create keys from the API Keys page in the dashboard, or with the API. Give each key a name that records where it will be used, such as production-backend, ci-tests or zapier, so you can later revoke exactly one integration without disturbing the others.

curl -X POST https://api.euromail.dev/v1/api-keys \
  -H "Authorization: Bearer em_live_an_admin_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "production-backend",
    "scopes": ["emails:send", "emails:read"]
  }'

name is required, at most 255 characters. scopes is optional: leave it out or send an empty array for a full-access key, or list the scopes the key should have. An unknown scope is refused with 422. The call returns 201 Created:

{
  "data": {
    "id": "660e8400-e29b-41d4-a716-446655440000",
    "name": "production-backend",
    "key": "em_live_...",
    "key_prefix": "em_live_abc12345",
    "scopes": ["emails:send", "emails:read"],
    "is_active": true,
    "created_at": "2026-06-13T10:00:00Z"
  }
}

The full key is shown only once, at creation. EuroMail stores only a hash, so it can never display the secret again. Copy it into your secret manager immediately. If you lose it, delete the key and create a new one.

Listing keys

curl https://api.euromail.dev/v1/api-keys \
  -H "Authorization: Bearer em_live_an_admin_key"

Each entry in data has id, name, key_prefix, scopes, is_active, last_used_at and created_at. The secret itself is never returned; use key_prefix to tell keys apart. Creating, listing and deleting keys all need the account:admin scope.

Scopes

A key with no scopes can do everything the account can. A key with scopes can only call endpoints that need one of them; anything else returns 403 with the code INSUFFICIENT_SCOPE and the name of the missing scope.

ScopeAllows
emails:sendSending single and batch emails, cancelling scheduled sends, creating and editing newsletters.
emails:readReading emails, their status and links, and newsletters.
emails:validateThe email validation endpoint.
domains:manageAdding, verifying, changing and deleting domains.
templates:manageCreating, reading, changing and deleting templates.
webhooks:manageCreating, reading, changing, testing and deleting webhooks.
contacts:manageContact lists and their contacts, signup forms and suppressions. Sending a newsletter or broadcast needs it too, together with emails:send.
account:adminAPI keys, account settings, billing, analytics, audit logs, GDPR export and erase, dead letters, operations, and inbound routes and emails.
sub_accounts:manageCreating and managing sub-accounts. Only works on a key of a top-level account.
mailbox:readReading agent mailboxes, their messages, threads, attachments, contacts and analytics, including leasing the next message.
mailbox:writeCreating agent mailboxes, acknowledging, releasing, labelling and deleting messages, and replying or sending from a mailbox.
mailbox:adminDeleting agent mailboxes and setting their auto-responder.

Team members below admin can create keys too, but such a key must list its scopes and may not include account:admin, sub_accounts:manage or mailbox:admin.

A key never creates a key stronger than itself. A key with full access may create any key. A scoped key may create only a key that lists some or all of its own scopes, never one with no scopes, since that would be full access.

Storing keys safely

  • Never commit keys to source control or embed them in front-end code, mobile apps, or anything that ships to a browser. A key is a bearer credential: whoever holds it can send mail as your account.
  • Load keys from environment variables or a secret manager (Vault, AWS/GCP secret stores, Doppler), not from config files in the repo.
  • Use a separate key per environment and per integration. This limits blast radius and makes rotation surgical.
export EUROMAIL_API_KEY="em_live_your_key_here"
// Node: read from the environment, never inline
const apiKey = process.env.EUROMAIL_API_KEY;

Rotating a key

Rotate on a schedule, and immediately if a key may have leaked:

  1. Create a new key in the dashboard or with POST /v1/api-keys.
  2. Deploy it to the integration (update the environment variable / secret).
  3. Confirm traffic is flowing on the new key.
  4. Delete the old key.

Because each integration has its own key, you rotate one without downtime for the rest. Delete a key via the dashboard or the API:

curl -X DELETE https://api.euromail.dev/v1/api-keys/{id} \
  -H "Authorization: Bearer em_live_an_admin_key"

Deletion takes effect immediately across all API replicas. Cached key lookups are invalidated the moment a key is revoked.

If a key leaks

  1. Delete it first, then investigate. A revoked key cannot send.
  2. Review the audit log and analytics for sends you did not make.
  3. Issue a replacement key and redeploy.
  4. If you find unexpected sends, also check your suppression list and domain reputation.

Common errors

ResponseCause
401 UnauthorizedMissing, malformed, or revoked key.
403 ForbiddenValid key, but the account lacks access to that resource.
429 Too Many RequestsRate limit exceeded. Back off and retry.

For the per-account rate limits and how to handle 429, see the Emails API reference.

Send your first email in about 90 seconds

The free tier includes 3,000 emails a month. Email storage and AI processing in Finland, with a DPA on every plan.

Create free account See live delivery data