Authentication & API keys
Workspace API keys authenticate requests to the Bird API as bearer tokens. They belong to a workspace, carry permissions you can change, and are shown in full exactly once.
For the distinction between service credentials and delegated access, see API keys and OAuth tokens.
How requests authenticate
Pass your key in the Authorization header on every request. The SDKs and the CLI take the key once and set the header for you:
import { BirdClient } from "@messagebird/sdk";
const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });
await bird.email.send({
from: "hello@yourdomain.com",
to: ["delivered@messagebird.dev"],
subject: "Hi",
text: "Hello.",
});import os
from bird import Bird
client = Bird(api_key=os.environ["BIRD_API_KEY"])
client.email.send(
from_="hello@yourdomain.com",
to=["delivered@messagebird.dev"],
subject="Hi",
text="Hello.",
)client, err := bird.NewClient(option.WithAPIKey(os.Getenv("BIRD_API_KEY")))
if err != nil {
log.Fatal(err)
}
_, err = client.Email.Send(context.Background(), bird.EmailSendParams{
From: "hello@yourdomain.com",
To: []string{"delivered@messagebird.dev"},
Subject: "Hi",
Text: "Hello.",
})use MessageBird\Bird;
$bird = new Bird(getenv('BIRD_API_KEY') ?: '');
$bird->email->send(
from: 'hello@yourdomain.com',
to: ['delivered@messagebird.dev'],
subject: 'Hi',
text: 'Hello.',
);export BIRD_API_KEY="bk_us1_..."
bird email send \
--from hello@yourdomain.com \
--to delivered@messagebird.dev \
--subject Hi \
--text Hello.curl -X POST https://us1.platform.bird.com/v1/email/messages \
-H "Authorization: Bearer $BIRD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "from": "hello@yourdomain.com", "to": ["delivered@messagebird.dev"], "subject": "Hi", "text": "Hello." }'The region in the key prefix tells you which host to call: bk_us1_... keys go to https://us1.platform.bird.com, bk_eu1_... keys to https://eu1.platform.bird.com. Official Bird SDKs and the CLI read the region from the key and select the host for you. A key sent to the wrong regional host returns 421 (type misdirected_error); see Regions.
A missing or invalid key returns 401. A valid key that lacks the permission an endpoint requires returns 403. Header semantics and error responses live in the authentication reference.
Identifying a key
The full key is returned once, in the response that creates it. You cannot retrieve the plaintext later. Subsequent responses include the first 15 characters as key_prefix, for example bk_us1_Ab3xKq9m. They also include a stable 12-character fingerprint for matching a key in logs and support conversations without exposing its value.
If you lose a key, rotate it for a new secret, or revoke it and create a new one.
Creating a key
Create keys in the dashboard under Platform tools > API keys. A key is created with a name, one or more scopes, and an optional expiry. The response that creates it is the only one that ever carries the token field (the full key): store it in your secret manager immediately.
You can also create one without a browser, with bird api-keys create. Key issuance needs the api_keys:write scope, which the read-only login baseline does not include. A login can put on a key only the scopes it holds itself, so request api_keys:write together with the key's scopes when you sign in. Run these commands in a shell where BIRD_API_KEY is not set, because the CLI uses that key in preference to the login and a key cannot issue keys:
bird auth login --scope api_keys:write --scope emails:write
bird api-keys create --body-file - <<'JSON'
{
"name": "Email operations production key",
"scopes": [{ "scope": "emails", "level": "write" }]
}
JSONRun bird api-keys create --example to print a complete body to edit.
Scopes are the one thing a key cannot grant itself: api_keys:write is not available to API keys, so a key can never issue another key. Issuance runs as you, on a dashboard session or a CLI or MCP grant.

You can manage a key after creating it:
- Scopes are editable. Editing replaces the permission set and keeps the same secret. You can grant scopes your own account holds. If the key was created before it could support a permission such as
voice, rotate it to add that permission. Revoked keys and keys already replaced by rotation cannot be edited. - Expiry is fixed. Set
expires_atwhen a key should stop working at a known time (a contractor's engagement, a migration window). Past that moment the key returns401; a key without an expiry lives until revoked. - Key management stays with people. Creating, editing, and revoking keys requires the
api_keys:writepermission, held by the workspace admin and developer roles (see Users, teams & roles) and never grantable to an API key itself. A leaked key cannot mint more keys.
The API keys page lists every key with its key_prefix, scopes, and last_used_on date (day precision), so you can spot stale keys at a glance. Revoked keys stay out of the listing unless you choose to show them.
Scopes & levels
Each scope on a key is a {scope, level} pair, where level is read or write (write includes read). API keys hold these scopes:
| Scope | read | write |
|---|---|---|
access_restrictions | Read workspace IP allowlists and mTLS settings | Manage workspace IP allowlists and mTLS settings |
emails | Read sent messages and delivery status | Send email |
email_management | Read suppressions, email configuration, templates, and reusable blocks | Manage suppressions, email configuration, templates, and reusable blocks |
email_marketing | Read contacts, audiences, and broadcasts | Manage contacts, audiences, and broadcasts |
inbox_insights | Read Inbox Insights placement and reputation data | Configure Inbox Insights |
competitive | Read Competitive Insights watchlists and sender intelligence | Manage Competitive Insights watchlists |
domains | Read sending domains and their DNS records | Add, verify, and manage sending domains |
sms | Read sent SMS and delivery status | Send SMS |
sms_management | Read senders, registrations, suppressions, keyword replies, destinations, and templates | Manage senders, registrations, suppressions, keyword replies, destinations, and templates |
whatsapp | Read sent WhatsApp messages and status | Send WhatsApp messages |
whatsapp_management | Read WhatsApp templates and settings | Manage WhatsApp templates and settings |
amb | Read Apple Messages conversations, messages, and statistics | Send Apple Messages for Business |
amb_management | Read Apple Messages business records, routing rules, and suppressions | Manage Apple Messages business records, routing rules, and suppressions |
verify | Read verification status | Send and check verification codes |
realtime | Read Realtime apps, channels, and channel members | Create apps and publish events |
voice | Read call logs, leg logs, and call statistics | Place outbound calls, authenticate SIP calls, and create session credentials |
voice_management | Read trunks, gateways, numbers, caller IDs, and destinations | Manage trunks, gateways, numbers, caller IDs, and destinations |
mailbox | Read mailboxes, threads, and messages | Send and reply to mailbox messages |
mailbox_management | Read receive rules and mailbox configuration | Create, update, and delete mailboxes and receive rules |
assets | Read assets and folders | Upload, update, and delete assets and folders |
esim | Read eSIMs, orders, and plans | Create eSIM orders and manage eSIMs |
esim_credentials | Read eSIM installation credentials | Manage eSIM installation credentials |
numbers | Search available numbers and read workspace phone numbers | Buy, configure, and release phone numbers |
rates | Read the rates your organization pays, per product | Not available |
preferences | Read cross-channel consent grants and opt-out records | Record and delete cross-channel messaging preferences |
compliance | Read compliance requirements, submissions, attachments, and business identities | File and correct registration paperwork, and upload and delete attachments |
workspace | Read the workspace's name, organization ID, and settings | Not available |
webhooks | Read webhook subscriptions and their delivery attempts | Create, update, delete, test, replay, and rotate the secret of a webhook |
lookup | Not available | Look up phone numbers, email addresses, and identity matches |
Changing workspace settings, managing members, issuing keys, and managing IP pools are deliberately not grantable to API keys, so they run as a person rather than as a key: through the dashboard, or through the CLI or MCP server on a grant that holds the scope. Grant the narrowest set that works: a key that only sends email should hold emails:write and nothing else.
lookup has no read-level operations: every lookup endpoint, including fetching an existing result, requires write.
Limiting a key to specific resources
A scope covers every resource of its kind in the workspace unless you limit it. The sms scope can be limited to the messaging profiles you name, so a key issued to one team or program reaches that team's profiles and leaves the rest of the workspace's SMS traffic out of reach. The mailbox scope can be limited to the mailboxes you name in mailbox_ids in the same way. A key can name up to 100 IDs across all its limits, and each must exist in the workspace when you set the limit.
In the dashboard, select Limit to specific messaging profiles under the sms permission, or Limit to specific mailboxes under mailbox, when you create or edit a key, and tick the ones the key may use in the panel that opens. On the API and CLI, add resources to the scope when you create the key:
bird api-keys create --body-file - <<'JSON'
{
"name": "Alerts program production key",
"scopes": [
{
"scope": "sms",
"level": "write",
"resources": { "messaging_profile_ids": ["mpr_01jqx4m8n2k5v7p9r3t6w8y0za"] }
}
]
}
JSONA limited key sends through its profiles and reads the messages sent or received under them. Each send has to name one of the key's profiles in messaging_profile_id and use one of that profile's senders. A built-in template send names one of the key's profiles and leaves out from: it goes out from Bird's own sender, whatever senders the profile lists. A request outside the limit is refused with 403.
A key limited to mailboxes reads, sends from and changes only the conversations of its mailboxes, and a list returns only those. A mailbox outside the limit is refused with 403. The key can apply labels the workspace already has, and creating or editing a label needs a key without a mailbox limit.
Change a limit by editing the key in the dashboard. A permission that has a limit shows it as a Limited to line: select that line, change the ticks, select Done, then Save on the key's page to store the change. Unticking every resource removes the limit.
The API and the CLI set a limit when the key is created and have no way to change it afterwards. The responses that create and rotate a key include its limit, and rotating carries the limit over to the replacement. To check or change a limit later, open the key in the dashboard. You do not need a new key for that.
Removing a limited permission from a key removes its limit too. Granting that permission to the same key again gives it without a limit, across the whole workspace. To bring limited access back, set the limit again in the dashboard or create a new key with the limit.
An Idempotency-Key is remembered together with the limit of the key that sent the request. A retry sent with a key whose limit differs is processed as a new request and can send a second time, so finish or reconcile the requests you are still retrying before you change a key's limit or move traffic to a key with another limit.
Before you rely on a limit, check what it leaves open:
- A limit applies to the scope that carries it.
sms_managementandwebhooksreach every messaging profile in the workspace. Leave them off a key that holds a limitedsmsscope.mailbox_managementreaches every mailbox in the same way,emailsreads the mail received by every mailbox, andwebhookscan subscribe to the events of every mailbox, so leave all three off a key that holds a limitedmailboxscope. The key's other scopes, such asemailsover SMTP orvoiceover SIP, work as they do without a limit. - Deleting a messaging profile does not end a key's access to its messages. The messages already stored under the profile stay readable with the key. To end that access, limit the key to other profiles or revoke the key. Unticking a key's only profile removes the limit, which opens every profile in the workspace to the key.
- Some operations cannot apply a limit. SMS statistics answer a limited key with
403. Use a separate key without a limit for those.
Revoking a key
Revoke a key from its row under Platform tools > API keys. Revocation is permanent: a revoked key cannot be reactivated, and its record is preserved for audit with revoked_at set.
Revocation usually takes effect almost immediately, though a short delay is possible. Once it takes effect, requests using the key return 401.
Rotating a key
Rotating issues a replacement for a key you already have and returns its token once, in that response. The replacement carries the source key's name and source IP restrictions, and keeps its scopes when you omit --scope (or scopes in the API body). Passing any --scope flag or scopes list replaces the whole permission set rather than adding to it. It starts with no expiry. Rotate a key from its row under Platform tools > API keys, or without a browser with bird api-keys rotate and the api_keys_rotate MCP tool:
# keep the source key's existing scopes
bird auth login --scope api_keys:write --scope emails:write
bird api-keys rotate key_01hqz8kp3v9x2m --yesTo replace the key's permission set during rotation, log in with every permission the replacement needs and pass each one with --scope:
# replace the scope set — include every permission the replacement needs
bird auth login --scope api_keys:write --scope emails:write --scope brands:read
bird api-keys rotate key_01hqz8kp3v9x2m --scope emails:write --scope brands:read --yesRotation cannot grant permissions the caller does not hold, so request each scope the rotated key needs when logging in.
The previous key keeps working for a grace period, 24 hours by default, so you can deploy the new token before the old one stops. If the key is exposed, pass grace_period: 0 (--grace-period 0 on the CLI) to revoke it without a grace period. A key already set to expire sooner than the grace period keeps its own expiry, because rotating never extends a key's life.
Before you automate key rotation, note two constraints. A rotation never carries an expiry over, so the replacement for a key that expired at a known time lives until revoked; re-issue with create when the expiry matters. And a key can be rotated only once: a second rotation of the same key returns 409, so send an Idempotency-Key and a retry replays the original response. Without one, a rotation whose reply you never received has minted a live key whose token you cannot read back.
Overlapping two keys by hand is still the safer path when you cannot predict how long the switchover takes, because the grace period is fixed when you rotate and cannot be extended afterwards:
- Create a new key with the same scopes.
--scopecannot carry a resource limit, so for a limited key pass the scopes with theirresourcesin a body file, as in Limiting a key to specific resources. A key created from--scopeflags alone has no limit. - Deploy the new key to your services.
- Watch the old key's
last_used_onuntil traffic has moved. - Revoke the old key.
Keys belong to the workspace
An API key is bound to your workspace and authenticates with that workspace's authority. The creator's personal permissions do not affect it. That has two practical consequences:
- Keys survive departures. When an employee leaves and their user account is removed, the keys they created keep working. You never have a production outage because the person who clicked "create" left the company. (Their departure is still a good prompt to rotate keys they had access to.)
- The key's reach stops at the workspace. It can never perform organization-level operations: billing, org members, org settings.
Because the key pins the workspace, requests with a key need no extra context; see Workspace for how the workspace and the organization above it divide up what you can reach. Agent controls shows how a scoped key combines with the default-deny SMS country list, daily SMS spend limits and the prepaid wallet to bound an agent, and which of them the key cannot change.
The delegated path: OAuth tokens for the CLI and MCP server
API keys are for services. The Bird CLI and Bird MCP server use OAuth when a person signs in. You log in through the browser, choose a workspace, and grant a subset of your permissions. The tool then receives a short-lived bt_{region}_... user token.
Each token is limited to permissions you hold. You can revoke access for each tool under Profile > Connected apps. The tools manage these tokens for you, so do not copy them or store them in a secret manager. Use API keys for server workloads.
Next steps
- Authentication reference: request header semantics and error responses
- Regions: regional hosts and routing
- Users, teams & roles: who can manage keys
- Workspace: the workspace a key binds to
For integrations that manage several workspaces in one organization, see Organization master keys. This feature is available on request. Contact your Bird representative to enable it for your organization.