Waitlist open: get early access

Authentication and keys

Every request carries an API key. A key has exactly one scope, can be restricted to IP addresses, domains and streams, and is either a test or a live key.

Sending the key

The key goes in the Authorization header:

Authorization: Bearer sk_live_…

The same applies to the SMTP gateway (the key is the password). The MCP server takes keys as an alternative to the OAuth sign-in. Sendtide stores only a hash of the key. The key itself is shown once, when you create it. After that you only see its prefix. Treat it like a password: never commit it, never put it in frontend code, never log it.

Without a key the API answers 401 missing_api_key, with an invalid or revoked key 401 invalid_api_key.

Test and live

Test key sk_test_… Live key sk_live_…
Sender any address verified domains only
Delivery never, the email is rendered and logged yes
Quota not counted counted
Account in review works 403 account_in_review
Change settings (templates, webhooks, domains, streams, routes, suppressions, team, billing, account) 403 test_key_forbidden, read and send only yes, depending on the scope

Test and live data are separate: an email sent with the test key does not show up with the live key. Idempotency keys are also per environment.

Scopes

Every key has one scope, from most to least powerful:

Scope May
admin everything, including the account itself: team, billing, settings, sub-accounts (create, delete, their keys), audit log
full everything except the admin endpoints: emails, templates, domains, webhooks, inbound routes, suppressions, keys of its own or a lower scope
send send email (POST /v1/emails*) and template test sends
read read only (GET) and render templates

Give your application the weakest scope that works. A server that only sends confirmation emails needs send. A reporting job needs read.

  • Admin endpoints answer a full, send or read key with 403 insufficient_scope.
  • A key can create keys of its own scope or lower, never admin. Owners and admins create admin keys in the dashboard.
  • A key creates, rotates and revokes keys of its own environment only (403 env_not_allowed). The new key is never less restricted than the one that creates it: its IP, domain and stream lists may not be wider (403 restriction_not_allowed).
  • Developers in the dashboard get full keys at most.
  • The MCP server shows read keys the read-only tools only.

Create a key through the API

You need a key with scope full or admin:

curl https://api.sendtide.ch/v1/keys \
  -H "Authorization: Bearer $SENDTIDE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Web server",
    "env": "live",
    "scope": "send",
    "allowed_ips": ["203.0.113.0/24"],
    "allowed_domains": ["example.com"]
  }'

The answer has the plain key in the field key, this one time only. Without scope the default is full. With expires_at (RFC 3339, at most a year ahead) the key expires at that time. Revoke a key with DELETE /v1/keys/{id}; revoking an admin key needs an admin.

Restrictions

When you create a key you can restrict it in three ways. All of them apply to the API, SMTP and MCP.

Field Effect Error
allowed_ips CIDR blocks, IPv4 and IPv6. Empty: from anywhere. Up to 50 entries. 403 ip_not_allowed
allowed_domains The sender’s domain must be one of them or a subdomain. Empty: any verified domain. 403 domain_not_allowed
allowed_streams Streams the key may send through. Empty: all. 403 stream_not_allowed

Sendtide determines the client address with its trusted-proxy logic. If you send from behind your own load balancer, enter the outbound address, not the internal one.

Tip: Create one key per application and environment. Then you can revoke a key without touching the others, and the log shows who sent what.

Rotate and expire keys

POST /v1/keys/{id}/rotate creates a new key with the name, environment, scope, restrictions and API version of the old one. The new key is in the answer only, once. The old key keeps working for as long as you choose, so you can swap it in your application without downtime:

curl https://api.sendtide.ch/v1/keys/key_8kq2m4bt/rotate \
  -H "Authorization: Bearer $SENDTIDE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "expires_in": "24h" }'
Field Meaning
expires_in now (the old key is revoked at once), 1h, 24h, 7d or 30d
expires_at instead of expires_in: a time (RFC 3339), at most 90 days ahead
  • The answer names the old key under previous_key (id, prefix, expires_at, revoked_at). The new one carries rotated_from.
  • If the old key already expires, rotating only ever moves its expiry earlier, never later.
  • The same rules as for creating and revoking apply: own environment, not less restricted, and only owners and admins rotate an admin key, in the dashboard.
  • Sendtide refuses a key with expires_at after that time. Owners and admins get an email reminder 7 days and 1 day before.

API version of a key

A key remembers the API version that was current when it was created (api_version). With the Sendtide-Version header you can pick another supported version per request.

If a key leaks

  1. Rotate the key with POST /v1/keys/{id}/rotate and expires_in: now: the old key is revoked at once, the new one has the same restrictions.
  2. Swap the new key into your application. Without rotating: create a key with the same restrictions and revoke the old one (DELETE /v1/keys/{id} or in the dashboard).
  3. Check the dashboard under “Logs” for use of the key from unexpected addresses.

Restrictions by IP and domain limit the damage if a key does leak.

Account status

New accounts are in review until the owner has verified the email address. A paused account (unpaid invoice, bounce or complaint rate too high, deletion) cannot send and answers 403 account_paused. GET /v1/account gives the reason in paused_reason: payment, bounce_rate, complaint_rate or deleting. More in Errors and limits.