Get started
Authentication
Every call sends an API token in the Authorization header. A token acts as the person who made it, only in the workspaces chosen for it.
Send the token
Put the token in the Authorization header with the word Bearer in front of it:
Authorization: Bearer sm_live_EXAMPLE_TOKEN
Tokens start with sm_. Keep them secret: anyone with a token can use it. Only call the API from your server, never from a web page.
Create a token
Workspace owners and admins create tokens in the portal at https://portal.. The full token is shown once, right after you create it. Copy it then; it can't be shown again.
- Name: so you know later what uses it.
- API version: pick v1. New tokens default to v2, which is a different API (
https://api.).scaledmail. com/v2 - Access: Read only, or Read and write (see below).
- Workspaces: only this workspace, all your workspaces, or this workspace plus the ones you pick. You can also allow it to create new workspaces.
- Expires: after 30 days, 90 days (the default), 1 year, or never.
A workspace can have up to 10 active tokens.
Read only or read and write
| Access | What it can call |
|---|---|
| Read only | All GET routes, plus POST /calculate-package, POST /search-domains and POST /suggest-domains (they only look, they change nothing). |
| Read and write | Everything, including the routes that change data or charge your card. |
A read-only token that calls a write route gets 403 missing_.
Which workspaces a token reaches
A token only works in the workspaces chosen for it. It also never does more than the person who made it: it works in a workspace only while that person is an owner or admin there. If they become a member of (or leave) another workspace, calls for that workspace get 401 organization_. If that happens in the workspace the token was made in, the token stops working everywhere and every call gets 403 no_.
GET /organizations lists the workspaces your token can use right now. A call with any other organization_ gets 401 organization_.
A refused token keeps the same answer for up to a minute, so a change of role can take up to a minute to show.
v1 tokens and sub-workspaces
- v1 tokens never reach sub-workspaces. A sub-workspace is not listed by
GET /organizations, and a call with a sub-workspace'sorganization_getsid 401organization_. Inside a sub-workspace you can't create a v1 token.not_ allowed - To work with sub-workspaces, use API v2 with a v2 key.
- v1 tokens and v2 keys are separate: a v2 key sent to
/api/v1gets401wrong_, and a v1 token sent to v2 gets the same code there.api_ version - v1 is deprecated and keeps working until March 31, 2027.
Expiry and revoking
An expired token gets 401 token_. An owner or admin can revoke a token at any time in Settings › API tokens. It stops working right away and gets 401 token_. This can't be undone: create a new token instead.
Errors
These answers have isAuthError: true, except missing_.
| Status | error | Meaning |
|---|---|---|
| 401 | missing_ | No Authorization: Bearer <token> header, or the token is empty. |
| 401 | invalid_ | Not a token we know. Check that you copied the whole token. |
| 401 | token_ | The token has expired. |
| 401 | token_ | The token was revoked. |
| 401 | wrong_ | This is an API v2 key. Use it with API v2, or create a v1 token. |
| 401 | organization_ | The token can't use the workspace in organization_ (also every sub-workspace: v1 never reaches them). |
| 403 | missing_ | The token is read only and the route needs Read and write. |
| 403 | no_ | The person who made the token is no longer an owner or admin of the workspace the token was made in (or that workspace was deleted). The token then works nowhere. |
| 403 | account_ | The account of the person who made the token is blocked. Contact support. |
| 403 | test_ | Test tokens (sm_) can't be used yet. Use a live token. |
| 429 | too_ | More than 60 calls in a minute with a missing or unknown token from your address. Then every call from that address is refused, also one with a good token, until the minute is over (Retry-After: 60). |
