API keys, scopes and the sandbox key
Make a key that can do only what your code needs: what each scope opens, what a sandbox key proves, the IP allowlist, replacing a key, and the order a request is checked in.
Before you start
- API access is on Growth and above. Without it every request answers 402, and the key works again once the plan includes it.
- An admin with the Developers permission makes keys, on the Developers page in the dashboard.
Make a key with only the scopes it needs
In your dashboard, open Developers, API keys, and make a key. Tick only the scopes your code uses: a key that only reads calls cannot place one. You can give a key only what you may do yourself in the dashboard, and because a key reads the whole workspace, you also need See everyone's data.
The key is shown in full once. Store it like a password, in an environment variable or a secret store, never in your code or in a web page.
Send it as a Bearer token
Every request carries the key in the Authorization header, as Bearer and the key. A live key starts with mtc_ and a sandbox key with mtc_sandbox_. To check a new key, list your agents: it needs the agents:read scope.
GET
/api/v1/agentsList agents in the API referenceGET /api/v1/agents with curl curl "https://aicallstudio.com/api/v1/agents" \ -H "Authorization: Bearer mtc_YOUR_TOKEN"Limit it to your servers' addresses
A key can carry an IP allowlist: up to 20 addresses or CIDR blocks, such as 203.0.113.0/24. From any other network the key answers 403 before anything else about it is looked at, so a leaked key does nothing from elsewhere. An empty list means anywhere. A change applies from the key's next request.
Replace a key before it gets old
A key past its reminder age, 90 days unless you change it, is flagged Replace on the Developers page, and you are reminded once. It is never revoked for you. To replace it, make a new key, move your code to it, then revoke the old one.
Revoking a key stops everything that uses it at once. So does removing the person who made it.
Which scope opens which endpoint?
A key reaches only the endpoints in the API reference, and each one only with its scope. Any other address answers 403, whatever the key holds. calls:write, campaigns:write and messages:send can ring a real person or spend from your wallet: give them only to code that must.
| Scope | Opens |
|---|---|
agents:read | List agents GET /api/v1/agents |
analytics:read | Calls by classification GET /api/analytics/classification-breakdownCalls by outcome GET /api/analytics/disposition-breakdownCall summary GET /api/analytics/summary |
calls:read | List calls GET /api/analytics/callsList calls GET /api/v1/callsGet a call GET /api/v1/calls/{call_id} |
calls:write | Place a call POST /api/calls/dialSchedule a call-back POST /api/v1/callbacksCancel a call-back DELETE /api/v1/callbacks/{callback_id} |
campaigns:read | List campaigns GET /api/v1/campaignsCampaign progress GET /api/v1/campaigns/{campaign_id}/stats |
campaigns:write | Add contacts to a campaign POST /api/v1/campaigns/{campaign_id}/contactsPause a campaign POST /api/v1/campaigns/{campaign_id}/pauseResume a campaign POST /api/v1/campaigns/{campaign_id}/resume |
contacts:erase | Erase a person's data POST /api/v1/contacts/{contact_id}/erasure |
contacts:read | List contacts GET /api/contactsExport contacts GET /api/contacts/export |
contacts:write | Create a contact POST /api/contactsImport contacts from a file POST /api/sources/import/csvAdd or update a contact POST /api/v1/contactsAdd or update many contacts POST /api/v1/contacts/bulkUpdate a contact PATCH /api/v1/contacts/{contact_id} |
dnc:write | Add a number to Do-Not-Call POST /api/v1/dncTake a number off Do-Not-Call DELETE /api/v1/dnc/{phone} |
messages:send | Send an email POST /api/v1/messages/emailSend an SMS POST /api/v1/messages/smsSend a WhatsApp template POST /api/v1/messages/whatsapp |
recordings:read | No endpoint of its own. It adds the recording's link to a call you fetch by id; without it the link is null. |
reports:read | List saved reports GET /api/v1/reportsRun a saved report GET /api/v1/reports/{report_id}/run |
wallet:read | Wallet and this month's usage GET /api/v1/wallet |
What does a sandbox key do?
It proves that a key and its scopes are right, and nothing more. A sandbox key never writes and never reads your workspace's real data, and there is no sample data behind it yet.
A request inside its scopes answers 403 with a sentence saying it is a sandbox token: the key and the scope are right. A request outside its scopes answers 403 naming the missing scope, exactly as a live key would. Use it to check your code's sign-in and its error handling before a live key goes anywhere near it.
In what order is a request checked?
The key first: an unknown or revoked key answers 401. Then its IP allowlist (403), the requests a minute your plan gives each key (429, with the seconds to wait in Retry-After), the scope the endpoint needs (403), and whether it is a sandbox key (403).
Then the workspace: a plan without API access answers 402, and the same key works again once the plan includes it. Only after all of that does the endpoint run its own checks. Errors, rate limits and retries lists every status and code.
Costs and what to watch
- A key with calls:write or campaigns:write rings real customers, billed like any call. One with messages:send sends real WhatsApp, SMS and email messages, each billed from the wallet. One with contacts:erase deletes a person and their calls for good.
- A key is shown once. If it is lost, revoke it and make another: there is no way to see it again.
- A key reads the whole workspace, not one person's share of it. Treat every live key as access to all your contacts and calls.
Was this page clear?
View this page as Markdown