API keys and scopes
Call the simtrunk API with a key that has only the scopes it needs.
The API is at https://api.simtrunk.com, under /v1/<resource>: lines, calls, SMS, USSD, trunks, SIP users, SIM banks, webhooks and the audit log. See the HTTP API reference.
API keys come with the Team plan (up to 10 keys, 50,000 requests a day) and the Business plan (up to 100 keys, 1,000,000 requests a day).
Create a key
Under API keys in the dashboard, create a key and choose its scopes. Copy it when it is shown: it starts with simtrunk_live_. A key belongs to one organization, so paths name none.
export SIMTRUNK_API_KEY=simtrunk_live_…curl https://api.simtrunk.com/v1/lines -H "Authorization: Bearer $SIMTRUNK_API_KEY"Scopes
Each operation needs one scope, listed in the reference. A key without it gets 403.
| Resource | Read | Write |
|---|---|---|
| Lines | lines:read | lines:write |
| Calls | calls:read | calls:write |
| SMS | sms:read | sms:write |
| USSD | — | ussd:write |
| SIP trunks | trunks:read | trunks:write |
| SIP users | sip_users:read | sip_users:write |
| SIM banks | banks:read | banks:write |
| Webhooks | webhooks:read | webhooks:write |
| Settings | settings:read | settings:write |
| SIP traces | traces:read | — |
| Audit log | audit:read | — |
| Live events | events:read | — |
| Carriers | carriers:read | — |
| Tunnel proxies | — | proxies:write |
Give each key only what it needs: a key that sends SMS needs sms:write, nothing more.
Good to know
- A suspended organization's keys can read but not change anything (
403). - Writes to a line, a trunk or the settings may send
If-Matchwith the revision read (itsETag); a stale one is refused with412. GET /v1/eventsis a live stream of events (Server-Sent Events).- Every change made with a key is in the audit log.
How is this guide?
Last updated on