Add a scope statement to an API key
Adds one scope statement to an API key of any user of the organization, the owner’s own keys included. A scope narrows what the key may do and never adds to it. A request with the key needs an allow from the user’s roles and an allow from the scope, and a deny in the scope refuses its actions. For the organization owner, who holds no roles, the scope alone narrows the key.
A scope statement has an effect, allow unless it says deny, and a list of actions: exact action IDs, wildcards such as number_order.*, or *. Scopes apply only while the organization has enabled IAM. While IAM is disabled, a scoped key does whatever its user may do. A change applies to new requests within five seconds.
Only the organization owner can call this endpoint. Its action is organization_api_keys.update. Other users and service account tokens get 403.
curl --request POST \
--url https://api.telnyx.com/v2/iam/api_keys/{id}/scopes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actions": [
"phone_numbers.list",
"number_order.create",
"number.update"
]
}
'{
"data": {
"id": "5d2e8f14-6a37-4b9c-8e01-7f3a9c2d4b66",
"api_key_id": "KEY019A6C2E5B7D4F1A8C3E9B0D2F4A6C8E",
"effect": "allow",
"actions": [
"phone_numbers.list",
"number_order.create",
"number.update"
],
"record_type": "api_key_scope",
"created_at": "2026-11-24T10:22:08.654321Z",
"updated_at": "2026-11-24T10:22:08.654321Z"
}
}Authorizations
Body
Was this page helpful?
curl --request POST \
--url https://api.telnyx.com/v2/iam/api_keys/{id}/scopes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actions": [
"phone_numbers.list",
"number_order.create",
"number.update"
]
}
'{
"data": {
"id": "5d2e8f14-6a37-4b9c-8e01-7f3a9c2d4b66",
"api_key_id": "KEY019A6C2E5B7D4F1A8C3E9B0D2F4A6C8E",
"effect": "allow",
"actions": [
"phone_numbers.list",
"number_order.create",
"number.update"
],
"record_type": "api_key_scope",
"created_at": "2026-11-24T10:22:08.654321Z",
"updated_at": "2026-11-24T10:22:08.654321Z"
}
}