Skip to main content
This quick start gives a release pipeline its own service account, a role with exactly the three actions it needs, and nothing else. The organization owner sends every IAM request with an API key of the owner.
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
The pipeline stores 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
From here on, the roles decide every request from the organization’s users and service accounts. The owner is unaffected. See Enable IAM.

7. Verify

With the service account’s token, the pipeline searches for numbers.
The request needs phone_numbers.list, the role allows it, and the numbers come back. The same token then tries to edit the SIP connection itself.
Output
The pipeline searches, orders, and assigns test numbers. It cannot change connections, outbound voice profiles, billing, or anything else, and the response says which action it lacked. See Evaluation Sequence.