Enabling IAM before the roles and grants exist locks out every user and service account without a grant.
1. Create a Service Account
The pipeline gets a service account of its own instead of a person’s key.POST /v2/iam/service_accounts
Output
2. Issue Its Token
POST /v2/iam/service_accounts/{id}/tokens
Output
token and sends it as Authorization: Bearer <token>. Telnyx shows the value in this response only.
3. Write the Role
The pipeline searches for numbers, orders one, and assigns it to a SIP connection. Those are three actions, and the role holds exactly those.POST /v2/iam/roles
Output
POST /v2/iam/roles/{role_id}/statements
Output
4. Grant the Role
A grant gives the role to the service account.POST /v2/iam/grants
Output
5. Check the Grants
Before turning IAM on, every user and service account that must keep working needs a grant, because a principal without one is refused everything afterwards.GET /v2/iam/grants
6. Enable IAM
PATCH /v2/iam/settings
Output
7. Verify
With the service account’s token, the pipeline searches for numbers.phone_numbers.list, the role allows it, and the numbers come back. The same token then tries to edit the SIP connection itself.
Output