# Telnyx Fundamentals: IAM — Full Documentation > Complete page content for IAM (Fundamentals section) of the Telnyx developer docs (https://developers.telnyx.com). > This file: https://developers.telnyx.com/docs/development/llms/fundamentals-iam-llms-full-txt · Root index: https://developers.telnyx.com/llms.txt ## Introduction ### Overview > Source: https://developers.telnyx.com/docs/iam.md Telnyx IAM decides what each person and each workload in an organization may do with the Telnyx API. The organization writes roles from the exact actions a job needs, grants them to its users and service accounts, and every request to every product is checked against those roles. **Items marked Preview** are not available yet. Their pages show the intended behavior and API, which may change before they are made available. ## Without IAM and With IAM Without IAM, an API key carries every permission of the user who created it, and the owner's keys can do everything in the organization. Limiting that means working across several separate systems. Each covers part of the API, and none can take a single action away. | | Without IAM | With IAM | | --- | --- | --- | | API key | Everything its user may do, and everything for the owner | What the roles of its user allow | | Permissions | Spread across portal groups, user policies, and service account action lists | [Roles](/docs/iam/access/roles), [granted](/docs/iam/access/grants) to users and service accounts alike | | Permission unit | A resource category with read, create, update, or delete | One [action](/docs/iam/access/actions), such as `number.update` | | Unrestricted user | Refused some products and unrestricted in others | Refused everything until a role allows it, once IAM is [enabled](/docs/iam/organization/enable-iam) | | Exceptions | Not possible, because every system only allows | A [deny statement](/docs/iam/troubleshooting/evaluation-sequence) wins over any allow | | Managed organizations | Full owner access | The person's own [roles in the manager org](/docs/iam/access/delegations), and a [delegation](/docs/iam/access/delegations#a-delegation)Preview per managed org | | Refused requests | Not permitted, with no reason | The action needed and the [roles that denied it](/docs/iam/troubleshooting/denied-requests) | | Narrowing an API key | Allowed networks | A [scope](/docs/iam/credentials/scoped-keys)Preview of actions and networks | | CI pipelines | A stored long-lived token | A [one-hour token](/docs/iam/principals/trusted-workloads)Preview, nothing stored | | Prod and staging | Separate organizations | [Projects](/docs/iam/access/projects)Preview in one organization | | Org-wide rules | None that bind the owner | [Guardrails](/docs/iam/access/guardrails)Preview that bind everyone | | Identity provider | Groups mapped to portal permission groups | [Groups](/docs/iam/principals/groups)Preview as principals, and SCIM | | Testing a change | Not possible | [Explain and simulate](/docs/iam/troubleshooting/explain-and-simulate) | ## Managing IAM The organization owner manages IAM through the API at `/v2/iam`. Roles and grants can be written while IAM is off and change nothing until the owner [enables IAM](/docs/iam/organization/enable-iam), so an organization moves at its own pace, one user or service account at a time. An organization that already uses Telnyx keeps everything as it is until then. The [Quick Start](/docs/iam/quickstart) gives a release pipeline its own service account and a role with three actions. [How IAM Works](/docs/iam/how-it-works) explains how a request is decided, and [IAM and Permission Groups](/docs/iam/permission-groups) sets IAM beside the permission groups in Mission Control Portal. The scenarios walk through [setting up a new organization](/docs/iam/scenarios/new-organization), [migrating an existing account](/docs/iam/scenarios/existing-organization), and [managing customer organizations](/docs/iam/scenarios/customer-organizations) step by step. --- ### Quick Start > Source: https://developers.telnyx.com/docs/iam/quickstart.md 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](/docs/iam/principals/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](/docs/iam/principals/service-accounts) of its own instead of a person's key. ```json POST /v2/iam/service_accounts { "name": "test-number-ci", "description": "Orders test numbers from the release pipeline" } ``` ```json Output { "data": { "id": "e6cd1ff6-6e3a-4ff3-88d5-2234142c1df2", "name": "test-number-ci", ... } } ``` ## 2. Issue Its Token ```json POST /v2/iam/service_accounts/{id}/tokens { "name": "release-pipeline" } ``` ```json Output { "data": { "token": "", ... } } ``` The pipeline stores `token` and sends it as `Authorization: Bearer `. 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](/docs/iam/access/actions), and the [role](/docs/iam/access/roles) holds exactly those. ```json POST /v2/iam/roles { "name": "test-number-provisioner", "description": "Searches, orders and assigns test numbers" } ``` ```json Output { "data": { "id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", "name": "test-number-provisioner", ... } } ``` ```json POST /v2/iam/roles/{role_id}/statements { "actions": [ "phone_numbers.list", "number_order.create", "number.update" ] } ``` ```json Output { "data": { "effect": "allow", "actions": [ "phone_numbers.list", "number_order.create", "number.update" ], ... } } ``` ## 4. Grant the Role A [grant](/docs/iam/access/grants) gives the role to the service account. ```json POST /v2/iam/grants { "role_id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", "principal_type": "service_account", "principal_id": "e6cd1ff6-6e3a-4ff3-88d5-2234142c1df2" } ``` ```json Output { "data": { "id": "b4c4bb86-5a8f-4414-b011-93592888edf7", "record_type": "iam_grant", ... } } ``` ## 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. ```json GET /v2/iam/grants { "data": [ { "principal_type": "service_account", "principal_id": "e6cd1ff6-6e3a-4ff3-88d5-2234142c1df2", "role_id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", ... } ], "meta": { "total_results": 1, ... } } ``` ## 6. Enable IAM ```json PATCH /v2/iam/settings { "enabled": true } ``` ```json Output { "data": { "enabled": true, ... } } ``` From here on, the roles decide every request from the organization's users and service accounts. The owner is unaffected. See [Enable IAM](/docs/iam/organization/enable-iam). ## 7. Verify With the service account's token, the pipeline searches for numbers. ```http GET /v2/available_phone_numbers?filter[country_code]=US Authorization: Bearer ``` 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. ```http PATCH /v2/credential_connections/1850335226672022881 Authorization: Bearer Content-Type: application/json {"connection_name": "changed"} ``` ```json Output { "errors": [ { "code": "10010", "detail": "no grant allows connection.update", ... } ] } ``` 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](/docs/iam/troubleshooting/evaluation-sequence). --- ### How IAM Works > Source: https://developers.telnyx.com/docs/iam/how-it-works.md Every request to the Telnyx API is decided on the same questions, whatever product it reaches. - Who is acting. A principal, proven by a credential. - What it wants to do. An action, one per API operation. - Which resource, and its project. Preview - In what context, such as the source IP or how the principal signed in. Preview ## Core Concepts | Object | What It Is | | --- | --- | | [Principal](/docs/iam/principals/users) | Who acts. A user or a service account of one organization. | | [Credential](/docs/iam/credentials) | How a principal proves who it is. A user holds an API key, a session, or an OAuth token. A service account holds a service account token. | | [Action](/docs/iam/access/actions) | What can be done. One per API operation, named for the resource and the verb, such as `number.update`. | | [Role](/docs/iam/access/roles) | A named set of [statements](/docs/iam/access/statements), each allowing or denying a list of actions. | | [Grant](/docs/iam/access/grants) | A role given to a principal. The only way a role reaches a principal. | | Entitlement | What Telnyx lets the organization use at all, through its [account level and capabilities](/docs/account-setup/levels-and-capabilities). Checked before any role. | | [Resource](/docs/iam/access/statements)Preview | Anything the organization owns, named `type/id`, such as `phone_number/+13125550100`. | | [Project](/docs/iam/access/projects)Preview | An optional boundary inside the organization that groups resources, such as `prod`. | | [Guardrail](/docs/iam/access/guardrails)Preview | Statements on the whole organization that every request must pass. | ## One Request The owner configures IAM before any request. At request time, Telnyx runs its checks in a fixed order at the edge of the Telnyx API, and the first refusal answers the request, so a refused request never reaches the product. The example follows the release pipeline from the [Quick Start](/docs/iam/quickstart) through two requests. Assigning a number is allowed, because its role allows `number.update`. Editing a SIP connection is refused at IAM, because no role allows `connection.update`. Before a request, the organization owner configures IAM: 1. `POST /v2/iam/roles` creates a role, `test-number-provisioner`. 2. `POST /v2/iam/roles/{id}/statements` adds a statement allowing `phone_numbers.list`, `number_order.create`, and `number.update`. 3. `POST /v2/iam/grants` grants the role to the service account. 4. `PATCH /v2/iam/settings` with `{"enabled": true}` enables IAM. Changes apply within five seconds. At request time, Telnyx runs its checks in order, and the first refusal answers the request. | Check | Refusal | | --- | --- | | Credential: the token is valid and resolves to its principal. | `401` | | Entitlement: the organization's account level includes the product. | `403` | | IAM: a granted role allows the route's action and none denies it. IAM does not decide for the owner, or in an organization that has not enabled IAM. | `403` | | Scope: an OAuth token's approved scope and the request's other requirements. | `403` | Request 1, `PATCH /v2/phone_numbers/{id}` from the service account, needs `number.update`. Every check passes, and the product answers `200`. Request 2, `PATCH /v2/credential_connections/{id}` from the same service account, needs `connection.update`. The credential and entitlement checks pass. IAM finds no granted role that allows the action and answers `403` with the detail `no grant allows connection.update`. The scope check never runs. For users, the [permission groups](/docs/iam/permission-groups) set in Mission Control Portal still apply as well, inside the product and on the categories it checks, until they retire. Service accounts, like this pipeline, are decided by their roles alone. ## Outside IAM IAM leaves some things to other systems on purpose. - Product credentials. SIP credentials, WebRTC tokens, Cloud Storage access keys, and Edge Compute bindings stay with their products. - Webhooks. IAM governs requests to Telnyx. Webhooks Telnyx sends are [signed separately](/docs/development/api-fundamentals/webhooks/receiving-webhooks). - Entitlement and billing. What an organization can buy or use is set by its [account level](/docs/account-setup/levels-and-capabilities), and billing ownership does not change. - Configuration rules. A role allows or denies actions. It does not inspect what a request sets, such as a number's country. - Assuming identities. Nobody signs in as a role, and nobody works as another person. A manager works in a [managed organization](/docs/iam/access/delegations) as themselves. --- ### IAM and Permission Groups > Source: https://developers.telnyx.com/docs/iam/permission-groups.md This page applies only to organizations that currently have permission groups. An organization sees its groups and their members in Mission Control Portal under Organizations, described in [Get Started with Organizations](https://support.telnyx.com/en/articles/1189141-get-started-with-organizations), or lists every user with their groups through [`GET /v2/organizations/users/users_groups_report`](/api-reference/organization-users/get-organization-users-groups-report). An organization without groups can skip this page. Enabling IAM before the roles and grants exist locks out every user and service account without a grant. Permission groups are the legacy access control in Mission Control Portal. Telnyx will not deprecate this legacy system at this time. IAM is the recommended system for all organizations, and mixing these two systems is strongly discouraged. ## Going Forward An organization that has permission groups keeps them, and nothing changes on the day IAM is made available. Before it enables IAM, its groups need to exist as [roles](/docs/iam/access/roles) and [grants](/docs/iam/access/grants), and there are two ways there. - The organization writes the roles and grants itself, from its groups. - The organization waits for Telnyx to carry its groups over as roles and grants.Preview In both cases, the organization [enables IAM](/docs/iam/organization/enable-iam) when it is ready, and until then roles and grants decide nothing. After the switch, a change to who may do what is made in roles, and the groups keep applying to users until they retire. Preview Permission groups retire with notice once every organization has its roles. Roles are then the only permissions. See [Migrate an Existing Organization](/docs/iam/scenarios/existing-organization#retiring-permission-groups). --- ### Coming From AWS IAM > Source: https://developers.telnyx.com/docs/iam/coming-from-aws.md Telnyx IAM uses the same ideas as AWS IAM, so most of its vocabulary maps one to one. The deliberate difference is the role. A Telnyx role is a set of permissions a principal holds, never an identity anyone assumes. ## Vocabulary | AWS IAM | Telnyx IAM | | --- | --- | | Account | Organization | | Root user | [Organization owner](/docs/iam/principals/organization-owner) | | IAM user | [User](/docs/iam/principals/users) | | Application with access keys | [Service account](/docs/iam/principals/service-accounts) with a token | | Identity-based policy | [Role](/docs/iam/access/roles), attached by a [grant](/docs/iam/access/grants) | | Policy statement | [Statement](/docs/iam/access/statements) in a role | | Action, such as `ec2:StartInstances` | [Action](/docs/iam/access/actions), such as `number.update` | | Resource ARN | `type/id`Preview in a statement | | Condition | `conditions`Preview in a statement | | Session policy, permissions boundary | [Scope](/docs/iam/credentials/scoped-keys)Preview on a user's API key | | Service control policy | [Guardrail](/docs/iam/access/guardrails)Preview | | Assume a role, cross-account role | No equivalent. A [delegation](/docs/iam/access/delegations#a-delegation)Preview names principals from the manager organization | | OIDC identity provider for CI | [Trusted workload](/docs/iam/principals/trusted-workloads)Preview on a service account | | Policy simulator | [Explain and simulate](/docs/iam/troubleshooting/explain-and-simulate) | ## No Assuming Roles An AWS principal assumes a role to work with that role's permissions for a while. A Telnyx principal holds its roles all the time, through [grants](/docs/iam/access/grants), and every request is decided on them. The jobs that assuming a role does in AWS have their own tools. - Preview A workload outside Telnyx, such as a CI job, trades its own token for a one-hour token of a [service account](/docs/iam/principals/trusted-workloads). - Preview A person who works in a customer's organization does it as themselves, through a [delegation](/docs/iam/access/delegations#a-delegation) that names them with a role. - Preview An API key that needs less than its user holds carries a [scope](/docs/iam/credentials/scoped-keys). A job that needs less gets a service account of its own. ## Evaluation Requests are decided the way AWS decides them. Nothing is allowed by default, an allow in any granted role is enough, and an explicit deny wins over any allow. Preview An API key's scope and the organization's guardrails narrow the result the way session policies, permission boundaries, and service control policies do. See [Evaluation Sequence](/docs/iam/troubleshooting/evaluation-sequence). --- ## Principals ### Users > Source: https://developers.telnyx.com/docs/iam/principals/users.md A user is a person in the organization. Every request a user sends, with a session, an API key, or an OAuth token, is decided by the roles granted to that user. ## Identity A user is identified by the `id` the [Organization Users API](/api-reference/organization-users/list-organization-users) returns, and that ID is the `principal_id` of a grant. ```json GET /v2/organizations/users { "data": [ { "id": "3b52b5e6-f289-45a9-8543-3a86d0e1ae1b", "email": "user@example.com", ... } ], ... } ``` The [organization owner](/docs/iam/principals/organization-owner) is not in this list and cannot hold a grant. ## Grants Each [grant](/docs/iam/access/grants) gives a user one [role](/docs/iam/access/roles). A user can hold up to ten roles, and their statements add up. ```json POST /v2/iam/grants { "role_id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", "principal_type": "user", "principal_id": "3b52b5e6-f289-45a9-8543-3a86d0e1ae1b" } ``` Once the organization has [enabled IAM](/docs/iam/organization/enable-iam), a user without a grant is refused every action. Until then, a user keeps the permissions managed in Mission Control Portal, and grants have no effect. The [permission groups](/docs/iam/permission-groups) in Mission Control Portal keep applying to a user on top of the user's roles, until they retire. ## Credentials Whatever credential a user presents, IAM decides the request for the user. - A session, after signing in to Mission Control Portal. - An [API key](/docs/development/api-fundamentals/create-api-keys) the user created. - An OAuth token an application holds for the user, such as the [Telnyx CLI](/docs/development/cli). The scope approved for that application still narrows the request after IAM allows it. A credential proves who the user is. It never augments what the user's roles allow. See [Credentials](/docs/iam/credentials). ## Groups Preview A grant also names a [group](/docs/iam/principals/groups) of the organization's identity provider, so access follows group membership. --- ### Service Accounts > Source: https://developers.telnyx.com/docs/iam/principals/service-accounts.md A service account is a principal for a workload. Servers, pipelines, and integrations run as one, and each service account authenticates with its own tokens instead of a person's API key. A service account never holds an API key. ## Creation A service account belongs to one organization and has a name and a description. ```json POST /v2/iam/service_accounts { "name": "test-number-ci", "description": "Orders test numbers from the release pipeline" } ``` ```json Output { "data": { "id": "e6cd1ff6-6e3a-4ff3-88d5-2234142c1df2", "name": "test-number-ci", "status": "active", ... } } ``` `GET /v2/iam/service_accounts` lists the organization's service accounts, `PATCH /v2/iam/service_accounts/{id}` renames one, and `POST /v2/iam/service_accounts/{id}/actions/disable` stops every token it holds until `.../actions/enable`. ## Tokens A service account token authenticates a request as the service account. Telnyx returns its value in the creation response only. ```json POST /v2/iam/service_accounts/{id}/tokens { "name": "release-pipeline" } ``` ```json Output { "data": { "id": "SAT01A1D0299A618C233DCFFB31B8490913", "token": "", ... } } ``` The workload sends the token as `Authorization: Bearer `. `DELETE /v2/iam/service_accounts/{id}/tokens/{token_id}` revokes it, and `.../tokens/{token_id}/actions/deactivate` pauses it. ## Grants Each [grant](/docs/iam/access/grants) gives the service account one [role](/docs/iam/access/roles), and it can hold up to ten. Their statements decide every request its tokens send. ```json POST /v2/iam/grants { "role_id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", "principal_type": "service_account", "principal_id": "e6cd1ff6-6e3a-4ff3-88d5-2234142c1df2" } ``` Once the organization has [enabled IAM](/docs/iam/organization/enable-iam), the grants decide, and the `action_ids` and `role_ids` a service account carries from before IAM no longer apply. A service account without a grant is refused every action. A service account token cannot manage IAM. Roles, grants, and settings are changed by the [organization owner](/docs/iam/principals/organization-owner). ## Workloads Outside Telnyx Preview A service account [trusts workloads](/docs/iam/principals/trusted-workloads) such as a GitHub Actions job, which then trades its own token for a short-lived Telnyx token instead of storing one. ## One Service Account per Job A service account token carries no scope. Every token of a service account does exactly what its roles allow, so a job that needs fewer actions gets a service account of its own with a narrower role. Scopes exist only on a user's [API key](/docs/iam/credentials/scoped-keys). Preview A token can name the networks it accepts requests from. --- ### Organization Owner > Source: https://developers.telnyx.com/docs/iam/principals/organization-owner.md The organization owner is the user who created the organization. The owner's requests are never decided by IAM, and only the owner changes it. ## What the Owner Does - Writes [roles](/docs/iam/access/roles) and gives them to users and service accounts with [grants](/docs/iam/access/grants). - [Enables IAM](/docs/iam/organization/enable-iam) for the organization, and disables it. - Reads every role and grant of the organization. The IAM endpoints answer `403` to anyone else, service account tokens included. ## What IAM Never Does to the Owner The owner holds every action in the organization, before and after IAM is enabled. A grant cannot name the owner. ```json POST /v2/iam/grants { "role_id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", "principal_type": "user", "principal_id": "0f5b2c7e-91d4-4a6b-8e23-5c7a19d4f0b8" } ``` ```json Output { "errors": [ { "code": "10027", "detail": "principal_id cannot be the organization owner", ... } ] } ``` ## Owner as a Role Preview Owner is a [ready-made role](/docs/iam/access/roles#ready-made-roles) that the owner grants to a second person, so the organization has two owners and the sign-in of the user who created it is not the only way in. When the organization makes single sign-on mandatory in Mission Control Portal, the user who created the organization stays exempt and keeps a password with multi-factor authentication as the way in if the identity provider is down. See [Identity Provider](/docs/iam/organization/identity-provider). --- ### Groups > Source: https://developers.telnyx.com/docs/iam/principals/groups.md A group is everyone in one group of the organization's identity provider, such as the Okta group `voice-team`. A grant that names a group reaches each of its members, and membership changes in the identity provider change access with them. **Preview.** Not available yet. ## Identity Groups come from the identity provider the organization [connects](/docs/iam/organization/identity-provider) in Mission Control Portal. A group is named `/`, and the organization does not create or edit it in Telnyx. ## Grants A grant names a group the way it names a user or a service account. ```json POST /v2/iam/grants { "role_id": "6d1a2c40-93d5-4b5e-9b8e-5e0f7b2a1c33", "principal_type": "group", "principal_id": "okta/voice-team" } ``` A person in two groups holds the roles granted to both, and they add up like any other [grants](/docs/iam/access/grants). ## Membership Someone added to the group in the identity provider holds its roles, and someone removed from it loses them. With [SCIM provisioning](/docs/iam/organization/identity-provider#scim), the change reaches Telnyx at once, open sessions included. --- ### Trusted Workloads > Source: https://developers.telnyx.com/docs/iam/principals/trusted-workloads.md A trusted workload is a job outside Telnyx, such as a GitHub Actions run, that acts as a service account without a stored Telnyx credential. The service account lists the workloads it trusts, and each run trades the token its own platform gives it for a short-lived Telnyx token. **Preview.** Not available yet. ## Trust A service account names each workload by the issuer of its tokens and the subject those tokens carry. ```json POST /v2/iam/service_accounts { "name": "ivr-deploy", "trusted_workloads": [ { "issuer": "https://token.actions.githubusercontent.com", "subject": "repo:example/deploy:ref:refs/heads/main" } ] } ``` Only runs from the `main` branch of that repository match. Any other subject from the same issuer is refused. ## Exchange Each run sends the token its platform issued and receives a Telnyx token for the service account, valid for one hour. ```json POST /v2/iam/tokens { "service_account": "ivr-deploy", "token": "eyJhbGciOiJSUzI1NiIs..." } ``` The run then sends requests with that token as `Authorization: Bearer `. The service account's [grants](/docs/iam/access/grants) decide them. No Telnyx credential lives in the CI system. --- ## Credentials ### Credentials > Source: https://developers.telnyx.com/docs/iam/credentials.md A credential proves which principal is sending a request. IAM then decides the request for that principal, and the credential never augments what the principal's roles allow. ## Types Each credential type belongs to a user or to a service account, never to both. ### A User's Credentials | Credential | What It Is | | --- | --- | | [API key](/docs/development/api-fundamentals/create-api-keys) | Proves the [user](/docs/iam/principals/users) who created it. Long-lived, with an optional expiry. | | Session | Proves the user signed in to Mission Control Portal. Short-lived. | | OAuth token | Proves the user who authorized an application, such as the [Telnyx CLI](/docs/development/cli) or an AI agent acting for that person. Narrowed to the scope the user approved for that application. | ### A Service Account's Credentials | Credential | What It Is | | --- | --- | | [Service account token](/docs/iam/principals/service-accounts#tokens) | Proves the [service account](/docs/iam/principals/service-accounts) it was issued to. Long-lived. | | [Short-lived token](/docs/iam/principals/trusted-workloads)Preview | Proves a service account for one hour, in exchange for a token a trusted workload already holds. | An API key never belongs to a service account, and a service account token never belongs to a user. An AI agent is never a principal. The principal is the person or the service account, and the agent holds a credential on its behalf. ## What a Credential Carries Every credential belongs to exactly one principal and has a status and an optional expiry. Revoking it, or disabling its principal, refuses every request it sends. Preview A user's API key also carries a [scope](/docs/iam/credentials/scoped-keys), statements that narrow what it may do. A service account's credentials carry no scope and do exactly what the service account's roles allow, so each job gets a service account of its own. Preview An API key or a service account token also names the networks it accepts requests from. ## Order of Checks Telnyx authenticates the credential before anything else. An invalid, expired, or revoked credential answers `401` whatever the roles say. After IAM allows the request, an OAuth token's approved scope still applies, so a token approved for fewer actions than the user holds stays narrower. --- ### Scoped Keys > Source: https://developers.telnyx.com/docs/iam/credentials/scoped-keys.md A scoped key is a [user's](/docs/iam/principals/users) API key that carries statements narrowing what it may do. The user still needs a role that allows the action, and the scope narrows that, never augments it. Only a user's API key takes a scope. A [service account token](/docs/iam/principals/service-accounts#tokens) does exactly what the service account's roles allow, so a job that needs less gets a service account of its own with a narrower role. **Preview.** Not available yet. ## Scope A scope is a list of [statements](/docs/iam/access/statements), set when the key is issued. A key with no scope may do everything its user may do. ```json POST /v2/iam/api_keys { "expires_in_days": 90, "scope": [ { "effect": "allow", "actions": [ "phone_numbers.list", "number_order.create", "number.update" ] } ] } ``` A request with this key needs an allow from the user's [grants](/docs/iam/access/grants) and an allow from the scope. The scope never augments the grants. Had it listed `connection.*`, the key still could not touch connections unless a granted role allowed them. A read-only user who scopes a key to every action gets a read-only key. ## Networks A key also names the networks it accepts requests from. A request from any other address answers `401`. ```json POST /v2/iam/api_keys { "allowed_ips": ["198.51.100.0/24"], ... } ``` A service account token names its networks the same way, when it is issued at `/v2/iam/service_accounts/{id}/tokens`. ## Key Rules The organization's [guardrail](/docs/iam/access/guardrails) can require a scope on every API key and cap how long an API key or a service account token lives, through `require_scope` and `max_lifetime_days` in `/v2/iam/settings`. ## Keys Without a Scope `/v2/api_keys` keeps working. A key issued there has no scope and does whatever its [user](/docs/iam/principals/users) may do. --- ## Access Management ### Actions > Source: https://developers.telnyx.com/docs/iam/access/actions.md An action is one operation of the Telnyx API, named for the resource it touches and what it does to it, such as `number.update`. Every role is written in actions, and every request is decided on the action its route declares. ## Naming An action ID is `.`. The resource is the API resource, in its singular or plural form as the owning product declares it, and the verb is what the operation does. | Action | Method | Route | | --- | --- | --- | | `phone_numbers.list` | `GET` | `/v2/available_phone_numbers` | | `number_order.create` | `POST` | `/v2/number_orders` | | `number.update` | `PATCH` | `/v2/phone_numbers/{id}` | | `number.delete` | `DELETE` | `/v2/phone_numbers/{id}` | | `connection.update` | `PATCH` | `/v2/credential_connections/{id}` | | `message.send` | `POST` | `/v2/messages` | | `managed_account.impersonate` | Any | Any route, with the `X-Managed-Account-Id` header. See [Delegations](/docs/iam/access/delegations). | One action can cover several operations, such as `api_keys.read` for both the list and the single key. ## The Catalog `GET /v2/iam/actions` lists every action, with the operations it covers. | Parameter | What It Does | | --- | --- | | `filter[search]` | Matches the action ID, its description, or the path of an operation it covers. | | `filter[product_id]` | Keeps the actions of one product, such as `messaging`. | | `filter[path]` | Keeps the actions with an operation at exactly this path. | | `filter[path][contains]` | Keeps the actions with an operation whose path contains this text. | | `page[size]`, `page[number]` | Pagination. | `GET /v2/iam/actions/{id}` returns one action. ```json GET /v2/iam/actions/api_keys.read { "data": { "id": "api_keys.read", "endpoints": [ { "method": "GET", "path": "/v2/api_keys" }, { "method": "GET", "path": "/v2/api_keys/{id}" } ], ... } } ``` To find the actions behind a route, search by its path. ```json GET /v2/iam/actions?filter[path][contains]=number_orders { "data": [ { "id": "number_order.create", "endpoints": [ { "method": "POST", "path": "/v2/number_orders" } ], ... }, { "id": "number_order.list", "endpoints": [ { "method": "GET", "path": "/v2/number_orders" } ], ... }, ... ] } ``` ## Wildcards A [statement](/docs/iam/access/roles#statements) in a role names actions exactly, or with a wildcard. - `number_order.*` covers every action whose ID starts with `number_order.`. - `*` covers every action. A wildcard whose prefix matches no action is rejected like an unknown action. ## IAM's Own Actions Managing IAM is actions too. They are declared like any other, and only the [organization owner](/docs/iam/principals/organization-owner) may send the requests behind them, the catalog and the service account routes included. A service account token is refused on every `/v2/iam` route. | Actions | Operations | | --- | --- | | `actions.read` | [The catalog](#the-catalog) | | `iam_roles.read``iam_roles.create``iam_roles.update``iam_roles.delete` | [Roles](/docs/iam/access/roles) | | `iam_role_statements.read``iam_role_statements.create``iam_role_statements.update``iam_role_statements.delete` | A role's [statements](/docs/iam/access/roles#statements) | | `iam_grants.read``iam_grants.create``iam_grants.delete` | [Grants](/docs/iam/access/grants) | | `iam_settings.read``iam_settings.update` | [Enable IAM](/docs/iam/organization/enable-iam) | | `service_accounts.read``service_accounts.create``service_accounts.update``service_accounts.delete``service_accounts.enable``service_accounts.disable` | [Service accounts](/docs/iam/principals/service-accounts) | | `service_account_tokens.read``service_account_tokens.create``service_account_tokens.update``service_account_tokens.delete``service_account_tokens.activate``service_account_tokens.deactivate` | A service account's [tokens](/docs/iam/principals/service-accounts#tokens) | | `iam.explain``iam.simulate` | [Explain and simulate](/docs/iam/troubleshooting/explain-and-simulate) | ## Routes Without an Action Every route IAM manages declares one action. A route that declares none cannot be allowed by any role, so a principal IAM manages is refused on it, apart from a few portal, OAuth consent, and agent sign-in routes that every signed-in user may reach. Telnyx is adding an action to every customer-facing route that lacks one, and a route opens to roles once it has one. --- ### Statements > Source: https://developers.telnyx.com/docs/iam/access/statements.md A statement allows or denies a list of actions, and every role is a set of statements. ## A Statement A statement has an effect and a list of [actions](/docs/iam/access/actions), and lives in a [role](/docs/iam/access/roles#statements). ```json { "effect": "deny", "actions": ["number.delete"] } ``` Preview A statement also names resources, projects, and conditions. ```json { "effect": "allow", "actions": ["network.*"], "resources": ["network/*"], "projects": ["prod"], "conditions": { "ip": ["10.0.0.0/8"] } } ``` | Field | What It Means | | --- | --- | | `effect` | `allow` or `deny`. Left out, `allow`. | | `actions` | Action IDs, wildcards such as `number_order.*`, or `*`. | | `resources`Preview | `type/id` patterns, such as `network/*` for every network, or specific resources such as `phone_number/+13125550100`. Left out, every resource the actions apply to. | | `projects`Preview | [Project](/docs/iam/access/projects) names. Left out, every project. | | `conditions`Preview | Facts about the request, such as the source `ip`, the `auth_method` (session, OAuth, API key, service account token, short-lived token), and the `principal_type`. All of them must hold. | Preview A statement matches as a whole, never field by field. A role allowed in `staging` and a read-only role in `prod` never add up to a change in `prod`. ## Three Places a Statement Takes Effect A statement does nothing until it is attached, and it can be attached in three places. | Place | What It Does | Where | | --- | --- | --- | | [Role](/docs/iam/access/roles) | Statements bundled into a role, which a [grant](/docs/iam/access/grants) gives to a principal. What the principal may do. | `/v2/iam/roles`, `/v2/iam/grants` | | [Scope](/docs/iam/credentials/scoped-keys)Preview | Statements on a user's API key, set when it is issued. Can only narrow what that user may do. | The `scope` field of an API key | | [Guardrail](/docs/iam/access/guardrails)Preview | Statements on the whole organization, which every request must pass, the owner's included. | `/v2/iam/guardrail` | A request needs an allow from a role's statements and no deny. Preview It also needs an allow from the scope, if the credential has one, and from every guardrail that applies, with no deny in any of them. ## Specific Resources, Plainly Preview A statement can name specific resources, such as two sending numbers. ```json { "effect": "allow", "actions": ["message.send"], "resources": [ "phone_number/+13125550100", "phone_number/+13125550101" ] } ``` - The IDs live in the statement and nowhere else. - Telnyx does not check that they exist. Saving a statement checks each ID's format and warns if one is not found, but saves it anyway. - A wrong ID never matches. In an allow it grants nothing, and in a deny it protects nothing. - The product that owns the resource does the checking. IAM allows the action and passes the list along, and the product compares it with the resource the request names, in the URL or in the body. - Lists of specific resources are capped. For larger sets, use a project or a managed organization. --- ### Roles > Source: https://developers.telnyx.com/docs/iam/access/roles.md A role is a named set of statements, each allowing or denying a list of actions. An organization writes its own roles and gives them to users and service accounts with [grants](/docs/iam/access/grants). ## A Role A role has a name, unique in the organization without regard to case, and an optional description. ```json POST /v2/iam/roles { "name": "test-number-provisioner", "description": "Searches, orders and assigns test numbers" } ``` ```json Output { "data": { "id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", "name": "test-number-provisioner", ... } } ``` `GET /v2/iam/roles` lists the organization's roles, newest first, and `GET /v2/iam/roles/{id}` returns one. `PATCH /v2/iam/roles/{id}` changes the name or the description. A role of another organization answers `404`. A new role allows nothing until it has a statement. ## Statements A [statement](/docs/iam/access/statements) is an effect and a list of [actions](/docs/iam/access/actions). The effect defaults to `allow`. A role's statements live under `/v2/iam/roles/{role_id}/statements`. Preview A statement also names [resources, projects, and conditions](/docs/iam/access/statements). ```json POST /v2/iam/roles/{role_id}/statements { "actions": [ "phone_numbers.list", "number_order.create", "number.update" ] } ``` ```json Output { "data": { "id": "f319340f-b0f0-4c3e-a0e5-d5f65bc1bc4a", "effect": "allow", "actions": [ "phone_numbers.list", "number_order.create", "number.update" ], ... } } ``` Each entry is an exact action ID, a wildcard such as `number_order.*`, or `*`. Telnyx checks every statement it saves. - Every entry must exist in the [catalog](/docs/iam/access/actions#the-catalog). An unknown one answers `422` and names the statement's `actions` field. - A statement holds at least one action. Duplicates are dropped. - An action may appear in several statements of a role, which is how an allow for `number.*` and a deny for `number.delete` sit side by side. `GET /v2/iam/roles/{role_id}/statements` lists a role's statements, oldest first. `PUT /v2/iam/roles/{role_id}/statements/{statement_id}` replaces a statement, and takes both `effect` and `actions`. `DELETE /v2/iam/roles/{role_id}/statements/{statement_id}` removes one. ```json PUT /v2/iam/roles/{role_id}/statements/{statement_id} { "effect": "allow", "actions": [ "number_order.*", "phone_numbers.list", "number.update" ] } ``` ## Deny Statements A statement with `"effect": "deny"` refuses its actions to everyone who holds the role, whatever other statements or other roles allow. A deny is how a broad role keeps one thing off limits. ```json POST /v2/iam/roles/{role_id}/statements { "effect": "deny", "actions": ["number.delete"] } ``` With an allow statement for `number.*` and this deny statement in the same role, the role updates numbers and never releases one. See [Evaluation Sequence](/docs/iam/troubleshooting/evaluation-sequence). ## Ready-Made Roles Preview Telnyx provides ready-made roles and keeps their statements up to date as products add actions. An organization grants them like its own roles. A role the organization wrote never changes. | Role | What It Holds | | --- | --- | | Owner | Every action in every project. The role of the user who created the organization, grantable to a second owner. | | Org Admin | Runs IAM for the organization, roles, grants, and settings included. | | Project Admin | Runs access inside one [project](/docs/iam/access/projects). | | Developer | Builds with every product, without changing IAM or billing. | | Read-only | Reads everything and changes nothing. | | Billing Viewer | Balance and invoices. | | Messaging Sender | Sends messages. | ## Deletion `DELETE /v2/iam/roles/{id}` deletes the role and its statements. It fails while any grant names the role. ```json Output wrap { "errors": [ { "code": "10021", "detail": "The role is granted to one or more principals. Revoke its grants first.", ... } ] } ``` ## Propagation A change to a role or its statements applies to new requests from every principal that holds it within five seconds. --- ### Grants > Source: https://developers.telnyx.com/docs/iam/access/grants.md A grant gives one role to one principal. It is the only way a role reaches a user or a service account, and nothing attaches to a principal directly. A principal can hold up to ten roles, one grant each, and their statements add up. ## A Grant A grant names a [role](/docs/iam/access/roles) of the organization and a principal of the same organization. ```json POST /v2/iam/grants { "role_id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", "principal_type": "service_account", "principal_id": "e6cd1ff6-6e3a-4ff3-88d5-2234142c1df2" } ``` ```json Output { "data": { "id": "b4c4bb86-5a8f-4414-b011-93592888edf7", "record_type": "iam_grant", ... } } ``` | Field | Value | | --- | --- | | `role_id` | A role of the organization. | | `principal_type` | `user`, `service_account`, or `group`Preview for a [group](/docs/iam/principals/groups) of the identity provider. | | `principal_id` | The [user's](/docs/iam/principals/users) ID or the [service account's](/docs/iam/principals/service-accounts) ID. | | `projects`Preview | The [projects](/docs/iam/access/projects) the role applies in. Left out, every project. | Preview In a [managed organization](/docs/iam/access/delegations#a-delegation), a delegation's grants name principals of the manager organization. Telnyx refuses these grants with `422` and names the field at fault. - A principal that does not exist in the organization. A user or service account of another organization is reported the same way. - The [organization owner](/docs/iam/principals/organization-owner), who holds every action already. - A role the principal already holds. - An eleventh grant for the same principal. ## Listing `GET /v2/iam/grants` lists the organization's grants, newest first, and filters by role or by principal. ```json GET /v2/iam/grants?filter[principal_id]={service_account_id} { "data": [ { "id": "b4c4bb86-5a8f-4414-b011-93592888edf7", "role_id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0", ... } ], "meta": { "total_results": 1, ... } } ``` `filter[role_id]` lists everyone who holds a role, which is what to check before deleting it. ## Revocation `DELETE /v2/iam/grants/{id}` revokes the grant and returns it. The principal loses the role's statements for new requests within five seconds. Once the organization has [enabled IAM](/docs/iam/organization/enable-iam), a principal whose last grant is revoked is refused every action until it holds a role again. --- ### Guardrails > Source: https://developers.telnyx.com/docs/iam/access/guardrails.md A guardrail is a list of statements on the whole organization. Every request in the organization must pass it, the owner's included, so it is where an organization writes the rules nobody may break. **Preview.** Not available yet. ## The Organization's Guardrail Each organization has exactly one guardrail. It starts from `allow *` and takes away, so an organization with no guardrail adds no limit. ```json PUT /v2/iam/guardrail [ { "effect": "allow", "actions": ["*"] }, { "effect": "deny", "actions": ["api_keys.create"] }, { "effect": "deny", "actions": ["number.delete"], "projects": ["prod"] } ] ``` This guardrail stops anyone, the owner included, from creating an API key or releasing a production number. API keys belong to users, so automation keeps running on service account tokens. Changing the guardrail is an action, `iam.guardrail.update`, granted like any other. ## Retiring API Keys One line retires every API key still in use without touching anything else. ```json { "effect": "deny", "actions": ["*"], "conditions": { "auth_method": ["api_key"] } } ``` A person signed in with a session or through OAuth is unaffected, and so is a service account using its token. ## Up to Three Guardrails A request must pass every guardrail that applies to it. - The organization's own. - The one its manager organization sets, if it is a [managed organization](/docs/iam/access/delegations). It binds everyone working there, manager org users included, and only the manager org can change it. - The requester's home organization's, when someone works in another organization through a delegation. A manager sets a guardrail on one managed organization at `/v2/iam/delegations/{id}/guardrail`, or on all of them at `/v2/iam/delegation_defaults/guardrail`. ## Key and Token Rules A guardrail allows or denies actions and never inspects what a request sets. The one exception is IAM's own key and token rules in `/v2/iam/settings`. ```json { "keys": { "require_scope": true, "max_lifetime_days": 90 }, "service_account_tokens": { "max_lifetime_days": 90 } } ``` Every new API key then needs a [scope](/docs/iam/credentials/scoped-keys), and every new API key or service account token lives at most ninety days. --- ### Projects > Source: https://developers.telnyx.com/docs/iam/access/projects.md A project is a boundary inside an organization that groups resources, such as `prod` and `staging`. Grants, scopes, and guardrails can then say where a role or a statement applies. **Preview.** Not available yet. Projects are optional. An organization that never creates one keeps everything in `default` and can ignore projects entirely. Leaving `projects` out of a grant or a statement means every project, and every rule works the same either way. ## What Sits in a Project - Only resources sit in projects. Users, service accounts, and roles belong to the organization, and a grant says which projects each one reaches. - Each resource sits in exactly one project. That makes a project a boundary, not a tag. Access given in `staging` never reaches a resource in `prod`. - Projects sit directly under the organization and do not nest. They are never a billing unit. [Managed organizations](/docs/iam/access/delegations) are for separate bills. ## Setting Projects Up 1. Create the project. Someone holding `iam.projects.create`, such as an Org Admin, names it. 2. Build new resources into it. The product's own create request names the project, and the requester needs permission in that project. A resource created without one lands in `default`. 3. Move existing resources in. Moving a resource needs permission in both its old and its new project, so nobody can pull a resource out of `prod` without access to `prod`. ```json POST /v2/iam/projects { "name": "prod" } POST /v2/messaging_profiles { "name": "Appointment reminders", "project": "prod" } POST /v2/iam/projects/prod/resources { "resources": ["network/net_8f3a"] } ``` ## Where Projects Are Used - In a [grant](/docs/iam/access/grants), a role applies only to resources in the named projects. - In a [scope](/docs/iam/credentials/scoped-keys), an API key is held to the named projects, even when its user reaches further. - In a [guardrail](/docs/iam/access/guardrails), a deny protects a project from everyone, the owner included. - In lists, such as `GET /v2/phone_numbers`, a request returns only resources in projects the requester may read. ```json POST /v2/iam/grants { "role_id": "", "principal_type": "group", "principal_id": "okta/messaging-team", "projects": ["staging"] } POST /v2/iam/grants { "role_id": "", "principal_type": "group", "principal_id": "okta/messaging-team", "projects": ["prod"] } ``` The messaging team builds in `staging` and only reads `prod`. --- ### Delegations > Source: https://developers.telnyx.com/docs/iam/access/delegations.md A managed organization is an organization that another organization, its manager, runs for one of its customers, with its own bill and its own resources. Users of the manager org work inside it as themselves, and IAM decides whether each may enter and what each may do there. A delegation names who may enter, with a role each. ## Entering a Managed Organization A request names the managed organization with the `X-Managed-Account-Id` header, as the [Managed Accounts API](/api-reference/managed-accounts/lists-accounts-managed-by-the-current-user) describes. ```http POST /v2/messaging_profiles Authorization: Bearer X-Managed-Account-Id: f65ceda4-6522-4ad6-aede-98de83385123 Content-Type: application/json {"name": "Appointment reminders"} ``` Once the manager org has [enabled IAM](/docs/iam/organization/enable-iam), a user or service account of the manager org needs a granted role that allows `managed_account.impersonate` to send such a request. The request is then decided on the action of its route, `messaging_profile.create` here, for the same principal and the same roles in the manager org. The managed organization's own roles never apply to it. A refusal answers `403` like any other [denied request](/docs/iam/troubleshooting/denied-requests). ```json POST /v2/iam/roles/{role_id}/statements { "actions": [ "managed_account.impersonate", "messaging_profile.*", "number_order.create" ] } ``` The manager org's [owner](/docs/iam/principals/organization-owner) enters every managed organization with that organization owner's full access. ## A Delegation Preview A delegation is created with each managed organization. It names the principals of the manager organization that may work there, with a role each, so a partner's people get least privilege and every change in the managed organization's audit log names the person who made it. ```json GET /v2/iam/delegations/{id} { "managed_org": "f65ceda4-6522-4ad6-aede-98de83385123", "grants": [ { "principal": "org:manager/role:Owner", "role": "Owner" } ] } ``` A delegation's grants name principals of the manager org as `org:/group:`, `org:/role:`, or `org:` for everyone there. A new managed organization starts by granting its Owner role to whoever holds Owner in the manager org, and no other manager org user gets in until granted. ## Defaults and Narrowing Preview `PUT /v2/iam/delegation_defaults` sets the grants every delegation starts with, and `PUT /v2/iam/delegations/{id}/grants` narrows one managed organization, down to read-only for the manager org owner if that customer asks for it. ## Manager Guardrails Preview The manager org sets a [guardrail](/docs/iam/access/guardrails#up-to-three-guardrails) on every managed organization, which the managed organization's own admins cannot loosen. A delegated request must pass the managed organization's guardrail and the manager org's. --- ## Organization ### Enable IAM > Source: https://developers.telnyx.com/docs/iam/organization/enable-iam.md IAM is turned on per organization. Until the owner enables it, roles and grants can be written and read but decide nothing, and every request is decided by the organization's existing permissions, the ones set in Mission Control Portal and on service accounts. Enabling IAM before the roles and grants exist locks out every user and service account without a grant. Every principal that must keep working needs a [grant](/docs/iam/access/grants) before the switch is turned. ## The Switch `GET /v2/iam/settings` returns the organization's IAM settings. An organization starts disabled. ```json GET /v2/iam/settings { "data": { "enabled": false, ... } } ``` `PATCH /v2/iam/settings` enables IAM. ```json PATCH /v2/iam/settings { "enabled": true } ``` Only the [organization owner](/docs/iam/principals/organization-owner) reads or changes the setting. A change applies to new requests within five seconds. ## What Changes Enabling IAM is what makes roles decide. While it is off, grants exist but change nothing. | Principal | IAM Off | IAM On | | --- | --- | --- | | The owner | Everything | Everything | | User or service account with a role | Existing permissions | Its [roles](/docs/iam/access/roles) | | User or service account without a role | Existing permissions | Nothing | Working in a [managed organization](/docs/iam/access/delegations) follows the same table. For users, the [permission groups](/docs/iam/permission-groups) set in Mission Control Portal still apply as well, until they retire. A user then needs both a role that allows the action and, where the product checks a category, a group that allows it. Service accounts are decided by their roles alone. ## Before Enabling The order that leaves no gap is short. 1. Write the [roles](/docs/iam/access/roles). 2. Grant one to each user and service account, and check the list with `GET /v2/iam/grants`. 3. Enable IAM. ## Disabling `{"enabled": false}` returns every principal to its existing permissions within five seconds. Roles and grants stay as they are, so IAM can be enabled again without rewriting anything. --- ### Enterprise Template > Source: https://developers.telnyx.com/docs/iam/organization/enterprise-template.md The enterprise template is one request that sets the posture most enterprises want. Nobody uses an API key, automation runs on service account tokens, and every token lives at most ninety days. Single sign-on is optional and is set up in Mission Control Portal. **Preview.** Not available yet. ## Applying It ```json POST /v2/iam/settings/actions/apply_template { "template": "enterprise" } ``` The template writes two things, which the organization can read and change afterwards. | Setting | What the Template Writes | | --- | --- | | [Guardrail](/docs/iam/access/guardrails) | Nobody can create an API key, and a request with an API key is denied, the owner's included. | | Token rules | Every new [service account token](/docs/iam/principals/service-accounts#tokens) lives at most ninety days. | ```json GET /v2/iam/settings { "data": { "service_account_tokens": { "max_lifetime_days": 90 }, ... } } ``` ## Single Sign-On Single sign-on is optional, and the template does not change it. An organization that wants it connects its identity provider and makes sign-in through it mandatory in Mission Control Portal, where the user who created the organization stays exempt as the way in if the identity provider is down. See [Identity Provider](/docs/iam/organization/identity-provider). ## For an Existing Organization The guardrail line stops API keys working at all, so an organization applies the template last, after every integration has moved to a [service account](/docs/iam/principals/service-accounts) with its own token. --- ### Identity Provider > Source: https://developers.telnyx.com/docs/iam/organization/identity-provider.md Single sign-on through an identity provider is optional, and IAM decides requests the same way with or without it. An organization that wants it sets it up in Mission Control Portal. With an identity provider connected, its groups become principals that grants can name, and, with SCIM, joiners and leavers are provisioned automatically. **Preview.** Groups as principals and SCIM are not available yet. Single sign-on itself is configured in Mission Control Portal, outside the IAM API. ## Sign-In The organization connects its identity provider in Mission Control Portal and chooses there whether sign-in through it is mandatory. The support site shows the setup for [Okta](https://support.telnyx.com/en/articles/5335562-okta-setting-up-okta-saml-identity-provider-with-telnyx) and other SAML providers. IAM decides a request the same way whether the user signed in with a password or through the identity provider. ## Groups The identity provider's groups become [group principals](/docs/iam/principals/groups), named `okta/voice-team` for the Okta group `voice-team`. A grant that names a group reaches each of its members, and moving someone between groups changes their access with it. ## SCIM With SCIM, the identity provider creates and removes Telnyx users and keeps group membership in step, so nobody touches Telnyx when people join, move, or leave. ```json PATCH /v2/iam/settings { "scim": { "enabled": true } } ``` ```json Output { "scim": { "enabled": true, "base_url": "https://api.telnyx.com/v2/iam/scim", "token": "scim_tok_..." } } ``` The response holds what to paste into the identity provider. Someone removed there loses Telnyx access at once, open sessions included, and a person who leaves a manager organization loses access to every [managed organization](/docs/iam/access/delegations) at the same moment. --- ## Troubleshooting ### Evaluation Sequence > Source: https://developers.telnyx.com/docs/iam/troubleshooting/evaluation-sequence.md One rule decides every request a user or a service account sends, once the organization has enabled IAM. Nothing is allowed until a granted role allows it, grants add up, and a deny wins. ```text allowed = a statement in a granted role allows the action AND no statement in any granted role denies it ``` A statement matches an action when it names the action exactly, names a wildcard that covers it, such as `number_order.*` for `number_order.create`, or names `*`. ## The Rules ### Nothing Is Allowed Until a Role Allows It A service account `reporting` holds a token but no grant. Its request `GET /v2/phone_numbers` needs `number.read`. ```json Output { "errors": [ { "code": "10010", "detail": "no grant allows number.read", ... } ] } ``` Access exists only where a grant gives it. A principal with no grant at all is refused the same way. ### Grants Add Up A user holds `number-buyer`, which allows `number_order.create`, and `Read-only`, which allows `number.read`. The user orders a number through the first grant and reads it through the second. The other grant does not need to agree, and one matching allow is enough. ### A Statement Matches as a Whole Preview A [statement](/docs/iam/access/statements) matches as a whole, never field by field. A role allowed in `staging` and a read-only role in `prod` never add up to a change in `prod`. ### A Deny Beats Any Allow The role `voice-ops` has an allow statement for `number.*` and a deny statement for `number.delete`. A user who holds it sends `DELETE /v2/phone_numbers/+13125550100`. ```json Output { "errors": [ { "code": "10010", "detail": "a granted role denies number.delete", "meta": { "denied_role_ids": [ "3741a8a1-9ae2-4731-8c92-645883be671e" ], ... } } ] } ``` `number.*` covers the delete, but the deny matches too, and a deny always wins, inside one role or across the roles a principal holds. The response names the denying roles so the owner can find the statement. ### A Scope Only Narrows Preview The [scope](/docs/iam/credentials/scoped-keys) on a user's API key can only narrow. A request needs an allow from the grants and from the scope. A service account's credentials carry no scope. ### The Guardrail Binds Everyone Preview A request also needs an allow from every [guardrail](/docs/iam/access/guardrails) that applies, the owner's included. ### Every Condition Must Hold Preview Every condition in a statement must hold, and a failed condition on an allow is not a deny. ### Nobody Grants More Than They Hold Preview Granting is itself an action, and its ceiling is the granter's own access. ### A Statement Can Name Specific Resources Preview The product that owns the resource enforces the IDs a statement names. See [Statements](/docs/iam/access/statements#specific-resources-plainly). ### The Owner Skips IAM The [organization owner's](/docs/iam/principals/organization-owner) requests are never decided by IAM. The owner holds every action, before and after IAM is enabled. ### A Route Needs an Action A route that declares no [action](/docs/iam/access/actions#routes-without-an-action) cannot be allowed by any role, so a principal IAM manages is refused on it, apart from a few portal, OAuth consent, and agent sign-in routes that every signed-in user may reach. ### Working in a Managed Organization Needs an Action Too A request with an `X-Managed-Account-Id` header is first decided on `managed_account.impersonate` for the principal sending it, then on the action of its route. See [Delegations](/docs/iam/access/delegations). ### Changes Apply Within Five Seconds Telnyx remembers a decision for a principal and an action for five seconds. A new grant, a revoked grant, or a changed statement reaches new requests within that time. ## Before and After the Rule IAM is one step of deciding a request. Telnyx authenticates the credential first and checks the organization's [entitlement](/docs/account-setup/levels-and-capabilities), and after an allow an OAuth token's approved scope still narrows the request. See [How IAM Works](/docs/iam/how-it-works#one-request). --- ### Denied Requests > Source: https://developers.telnyx.com/docs/iam/troubleshooting/denied-requests.md A request IAM refuses answers `403` with the code `10010`. The detail names the action the request needed and says whether no role allowed it or a role denied it, and a deny names the roles behind it. A route with no action is the one refusal whose detail names no action. ## No Role Allows the Action ```json Output { "errors": [ { "code": "10010", "title": "Authorization failed", "detail": "no grant allows connection.update", ... } ] } ``` The principal holds no role with an allow statement for the action, or holds no grant at all. Add the action to a role the principal holds, or grant one, and the request passes within five seconds. ## A Role Denies the Action ```json Output { "errors": [ { "code": "10010", "title": "Authorization failed", "detail": "a granted role denies number.delete", "meta": { "denied_role_ids": [ "3741a8a1-9ae2-4731-8c92-645883be671e" ], ... } } ] } ``` `denied_role_ids` lists every granted role with a deny statement matching the action. A deny wins over any allow, so the request passes only once no granted role denies it. ## The Route Has No Action A route that declares no [action](/docs/iam/access/actions#routes-without-an-action) is refused for a principal IAM manages. The detail names the request and the principal instead of an action, and for a service account token it names the service account. ```json Output { "errors": [ { "code": "10010", "title": "Authorization failed", "detail": "The request GET /v2/... is not permitted to user '3b52b5e6-f289-45a9-8543-3a86d0e1ae1b' by the organization.", ... } ] } ``` No role can cover the route until it has an action. ## Other Refusals | Response | Meaning | | --- | --- | | `401` | The credential is invalid, expired, revoked, or sent from an address the key does not accept. IAM never decided the request. | | `403`, feature blocked | The organization's [account level](/docs/account-setup/levels-and-capabilities) does not include the product. Roles cannot change that. | | `403` on `/v2/iam/...` with no detail | The request did not come from the [organization owner](/docs/iam/principals/organization-owner). Service account tokens cannot manage IAM. | ## What to Check 1. `GET /v2/iam/settings` shows whether IAM is enabled. With it disabled, grants decide nothing. 2. `GET /v2/iam/grants?filter[principal_type]=...&filter[principal_id]=...` lists the principal's roles. 3. `GET /v2/iam/roles/{role_id}/statements` shows each role's statements. The action must appear in an allow statement, exactly or under a wildcard, and in no deny statement. 4. `GET /v2/iam/actions?filter[path][contains]=...` confirms which action the route declares. 5. A change made in the last five seconds may not have reached the request yet. [Explain](/docs/iam/troubleshooting/explain-and-simulate) answers the first four questions in one request. ## Errors From the IAM Endpoints | Code | When | | --- | --- | | `10012` Duplicate resource | A role name already used in the organization, or a role already granted to the principal. | | `10027` Invalid role statements | A statement names an action that does not exist, or a wildcard that matches none. | | `10027` Unprocessable Entity | A grant names a principal that does not exist in the organization, the owner, or an eleventh role for the principal. | | `10021` Resource in use | A role deleted while a grant names it. | | `10005` Resource not found | A role, statement, or grant ID that does not exist, including one that belongs to another organization. | --- ### Explain and Simulate > Source: https://developers.telnyx.com/docs/iam/troubleshooting/explain-and-simulate.md Explain says what IAM decides for one principal and one action, and which roles are behind the decision. Simulate decides a list of requests as if the principal held other roles, without changing anything. Only the [organization owner](/docs/iam/principals/organization-owner) sends either. ## Explain ```json POST /v2/iam/explain { "principal_type": "user", "principal_id": "3b52b5e6-f289-45a9-8543-3a86d0e1ae1b", "action": "connection.update" } ``` ```json Output { "data": { "action": "connection.update", "decision": "deny", "reason": "action_not_granted", "detail": "no role allows connection.update", "allowed_role_ids": [], "denied_role_ids": [], "record_type": "iam_decision" } } ``` | Field | Values | | --- | --- | | `decision` | `allow`, `deny`, or `not_iam_managed`. | | `reason` | `action_allowed`, `action_denied`, or `action_not_granted` behind an allow or a deny. `iam_disabled` when the organization has not [enabled IAM](/docs/iam/organization/enable-iam), and `no_grants` when the principal is the owner, behind `not_iam_managed`. | | `detail` | The reason in words. | | `allowed_role_ids` | The granted roles with an allow statement for the action. | | `denied_role_ids` | The granted roles with a deny statement for the action. A deny wins, so both lists are filled when roles conflict. | Explain decides from the principal's current grants, the way a request is decided. In an organization that has not enabled IAM, every explain answers `not_iam_managed` with the reason `iam_disabled`. The action is an exact ID, and a wildcard or an unknown action answers `422`. Explain does not check that the principal exists, so an unknown ID is decided like a principal without grants. ## Simulate Simulate decides a list of requests against a set of roles instead of the principal's grants, whether or not the organization has enabled IAM. It is how an organization tests a role before granting it, or checks the requests a person sends against the roles meant to replace their current access. ```json POST /v2/iam/simulate { "principal_type": "user", "principal_id": "3b52b5e6-f289-45a9-8543-3a86d0e1ae1b", "with_role_ids": ["8c4a9715-0246-4c6f-9eca-390e13bd8af0"], "requests": [ { "action": "connection.update" }, { "action": "number.update" }, { "action": "messaging_profile.update" } ] } ``` ```json Output { "data": [ { "action": "connection.update", "decision": "allow", "reason": "action_allowed", "detail": "a role allows connection.update", "allowed_role_ids": ["8c4a9715-0246-4c6f-9eca-390e13bd8af0"], "denied_role_ids": [], "record_type": "iam_decision" }, { "action": "number.update", "decision": "allow", ... }, { "action": "messaging_profile.update", "decision": "deny", "reason": "action_not_granted", ... } ] } ``` One decision comes back per request, in the same order, with the same fields as an explain. The owner is `not_iam_managed` in a simulate too. A simulate names at most ten distinct roles and fifty requests, and an unknown action or a role of another organization answers `422`. --- ### Audit Events > Source: https://developers.telnyx.com/docs/iam/troubleshooting/audit-events.md Audit events are every decision IAM makes, with who sent the request, what it needed, and what was decided. They are what an organization reads to see what a key did last month, or who changed a managed organization. **Preview.** Not available yet. ## An Event ```json GET /v2/iam/audit_events { "data": [ { "principal": "user:user@example.com", "via": "dlg_bluebird", "action": "number_order.create", "decision": "allow", ... } ], ... } ``` | Field | What It Holds | | --- | --- | | `principal` | The user or service account that sent the request, never the organization it worked in. | | `via` | The [delegation](/docs/iam/access/delegations#a-delegation) the request came through, when a manager worked in a managed organization. | | `action` | The action the route declared. | | `decision` | `allow` or `deny`, with the reason a [denied request](/docs/iam/troubleshooting/denied-requests) shows. | Events are listed per organization, so a managed organization's log names the manager org user who acted in it. ## Credential Inventory Every credential shows when and from where it was last used, and the actions it sent in the last thirty days, so a key that is really one server reading invoices can be moved to a [service account](/docs/iam/principals/service-accounts) with exactly that role. ```json GET /v2/iam/api_keys/{id} { "owner": "user:user@example.com", "scope": null, "last_used_at": "2026-10-27T09:12:44Z", "last_ip": "34.201.7.18", "actions_last_30_days": ["balance.read", "invoice.read"] } ``` --- ## Scenarios ### Set Up a New Org > Source: https://developers.telnyx.com/docs/iam/scenarios/new-organization.md This workflow gets you: - Each user holds the actions their job needs, and nothing else. - A deny statement keeps a destructive action, such as deleting a SIP connection, out of reach of everyone on a team. - Each pipeline runs as a service account with its own token, never on a person's API key. - A refused request names the action it needed. - Grants name the identity provider's groups, and the identity provider adds and removes users.Preview - CI deploys with no stored Telnyx credential, and each service account token is limited to its network.Preview - Projects keep production apart from staging.Preview The steps build on each other in order. A step marked Preview can be skipped, and every other step still works. Enabling IAM before the roles and grants exist locks out every user and service account without a grant. ## 1. Sign Up The user who signs up and creates the organization is its [owner](/docs/iam/principals/organization-owner). The owner holds every action, manages IAM, and is never limited by it. Preview The owner grants the ready-made Owner role to a second user, so the organization has a second owner for recovery. ## 2. Connect an Identity Provider Single sign-on is optional, and IAM works the same without it. An organization that wants it connects its identity provider in Mission Control Portal. Preview Its groups then become principals that grants can name. See [Identity Provider](/docs/iam/organization/identity-provider). ## 3. Apply the Enterprise Template Preview One request turns API keys off and limits every service account token to 90 days. See [Enterprise Template](/docs/iam/organization/enterprise-template). ## 4. Hand IAM to the Admins Preview The owner grants the ready-made Org Admin role to the platform team, which runs IAM from there. ## 5. Create Projects Preview The organization creates `prod` and `staging`, builds new resources into them, and adds a guardrail that stops anyone, the owners included, from releasing a production number. Projects are optional, and every later step works the same without them. See [Projects](/docs/iam/access/projects). ## 6. Give a User the Actions for the Job A user who buys and ports numbers needs number orders and port requests, and nothing else. The owner writes a [role](/docs/iam/access/roles) from the [actions](/docs/iam/access/actions) behind those routes. ```json POST /v2/iam/roles { "name": "number-buyer" } ``` ```json POST /v2/iam/roles/{role_id}/statements { "actions": ["number_order.*", "port_request.*"] } ``` A [grant](/docs/iam/access/grants) gives the role to the user. ```json POST /v2/iam/grants { "role_id": "4d0c2b71-8e5a-4f39-9c1e-7a6b5d4e3f21", "principal_type": "user", "principal_id": "3b52b5e6-f289-45a9-8543-3a86d0e1ae1b" } ``` ## 7. Write Roles for the Teams A team that runs SIP connections and outbound voice profiles, and assigns numbers to trunks, gets one role. An allow statement covers the work, and a deny statement keeps anyone on the team from deleting a connection. ```json POST /v2/iam/roles/{role_id}/statements { "actions": [ "connection.*", "outbound_voice_profile.*", "number.read", "number.update" ] } ``` ```json POST /v2/iam/roles/{role_id}/statements { "effect": "deny", "actions": ["connection.delete"] } ``` The owner grants the role to each user on the team. Preview A grant names the team's identity-provider group instead of each user, so joining or leaving the group changes access with it. ## 8. Give Each Pipeline a Service Account A CI pipeline that searches for numbers, orders one, and assigns it to a SIP connection gets a [service account](/docs/iam/principals/service-accounts) of its own, with a role that holds exactly `phone_numbers.list`, `number_order.create`, and `number.update`. The [Quick Start](/docs/iam/quickstart) walks through these requests. ## 9. Enable IAM Every user and service account that must keep working holds a grant before the switch, because a principal without one is refused everything afterwards. ```json PATCH /v2/iam/settings { "enabled": true } ``` The user from step 6 then tries to point a number at a SIP connection, which needs `number.update`. ```json Output { "errors": [ { "code": "10010", "detail": "no grant allows number.update", ... } ] } ``` The user orders and ports numbers and nothing else. See [Enable IAM](/docs/iam/organization/enable-iam). ## 10. Deploy From CI Without a Stored Credential Preview A deploy job in a CI system such as GitHub Actions runs as a service account that trusts it. Each run trades the CI system's token for a one-hour Telnyx token, so no Telnyx credential is stored in the CI system. See [Trusted Workloads](/docs/iam/principals/trusted-workloads). ## 11. Accept the CI Token Only From the Build Network Preview The pipeline's service account token accepts requests only from the build network's addresses. A request from anywhere else gets `401`. See [Service Accounts](/docs/iam/principals/service-accounts#one-service-account-per-job). ## 12. Let the Identity Provider Add and Remove Users Preview With SCIM on, the identity provider creates and removes Telnyx users and keeps group membership in step. A user removed there loses Telnyx access at once. See [Identity Provider](/docs/iam/organization/identity-provider#scim). ## 13. Find Out Why a Request Was Refused A refused request names the action it needed and the roles that denied it. See [Denied Requests](/docs/iam/troubleshooting/denied-requests). Explain answers the same question before the request is sent, and simulate checks a role change against a list of requests first. See [Explain and Simulate](/docs/iam/troubleshooting/explain-and-simulate). --- ### Migrate an Existing Org > Source: https://developers.telnyx.com/docs/iam/scenarios/existing-organization.md This workflow gets you: - Every user, API key, and integration keeps working while the roles are written, until the owner [enables IAM](/docs/iam/organization/enable-iam). - Each user holds roles with the actions their job needs. - Each integration runs as a service account with its own token, so it no longer depends on a person. - After the switch, a request the roles do not cover names the action it needed, and adding that action to a role lets it through within five seconds. - Existing permissions carry over as roles, checked against real requests before the switch.Preview - Grants name the identity provider's groups, and production sits in a project of its own.Preview - Roles become the only permissions, and permission groups retire.Preview The org moves to IAM at its own pace. A step marked Preview can be skipped, and every other step still works. Enabling IAM before the roles and grants exist locks out every user and service account without a grant. ## Day One Nothing an existing integration relies on changes on the day IAM is made available. - The owner keeps every permission. - Every user keeps the permissions managed in Mission Control Portal, and every API key keeps doing whatever its user may do. - Every service account keeps the actions and roles set on it. - Managed organizations keep working as before. - Every product credential, such as SIP credentials and Cloud Storage keys, is untouched. IAM governs requests to the Telnyx API only. Roles and grants can be written while IAM is off, with no effect on live requests. ## 1. Connect an Identity Provider Single sign-on is optional, and IAM works the same without it. An organization that wants it connects its identity provider in Mission Control Portal. Preview Its groups then become principals that grants can name. See [Identity Provider](/docs/iam/organization/identity-provider). ## 2. Hand IAM to the Admins Preview The owner grants the ready-made Org Admin role to the platform team, and stops being the only one who can change access. ## 3. Give Every User a Role The owner writes a [role](/docs/iam/access/roles) for each job from the [actions](/docs/iam/access/actions) behind the requests that job sends. The catalog finds the action behind a route. ```json GET /v2/iam/actions?filter[path][contains]=messaging_profiles { "data": [ { "id": "messaging_profile.create", ... }, { "id": "messaging_profile.list", ... }, ... ] } ``` A user who runs both voice and messaging holds two roles, one [grant](/docs/iam/access/grants) each, and their statements add up. Every user and service account that sends requests needs a grant before IAM is enabled, including the integrations that run on a person's API key. [Permission groups](/docs/iam/permission-groups) in Mission Control Portal keep applying to users on top of their roles, so a user needs both until the groups [retire](#retiring-permission-groups). Preview Telnyx carries existing permissions over as roles. A user with no permissions set gets the visible role `Legacy full access`, and a user's existing permission set becomes a role with the same actions. The owner replays a user's requests from the last month against the new roles with [simulate](/docs/iam/troubleshooting/explain-and-simulate) before revoking `Legacy full access`. ## 4. Move an Integration Off a Person's API Key An integration that runs on a person's API key, such as a server that reads balances and invoices, moves to a [service account](/docs/iam/principals/service-accounts) of its own, so it no longer depends on that person. ```json POST /v2/iam/service_accounts { "name": "finance-sync" } ``` ```json POST /v2/iam/roles/{role_id}/statements { "actions": ["balance.read", "invoice.read"] } ``` The owner grants that role to the service account, issues it a token, and deploys the token to the server. Once the integration runs on the new token, the person's key is revoked. Preview The credential inventory shows which actions each key sent in the last 30 days, and from which addresses, so the right role is clear before the move. See [Audit Events](/docs/iam/troubleshooting/audit-events#credential-inventory). ## 5. Enable IAM ```json PATCH /v2/iam/settings { "enabled": true } ``` Every user and service account is then decided by its roles. A request the roles do not cover answers `403` with the action it needed, and adding that action to a role lets it through within five seconds. See [Denied Requests](/docs/iam/troubleshooting/denied-requests). ## 6. Create Projects and Move Production In Preview The organization creates `prod` and moves its production numbers, connections, and messaging profiles into it, so grants can say `prod` or `staging`. The step is optional, and nothing else in the migration depends on it. See [Projects](/docs/iam/access/projects). ## 7. Narrow the Managed-Organization Delegations Preview In each managed organization, the support team gets Read-only and the platform team keeps Org Admin, instead of everyone in the organization holding Org Admin. Every change in the managed organization then names the user who made it. See [Delegations](/docs/iam/access/delegations#defaults-and-narrowing). ## 8. Apply the Enterprise Template Preview The organization applies the [enterprise template](/docs/iam/organization/enterprise-template) last, because its guardrail stops API keys working at all. Every integration runs on a service account by then. ## Retiring Permission Groups Preview Permission groups in Mission Control Portal, policies, and the action lists on service accounts retire with notice, once every organization has its roles. Roles are then the only permissions. --- ### Manage Customer Orgs > Source: https://developers.telnyx.com/docs/iam/scenarios/customer-organizations.md Two organizations take part, and each has its own people. | Term | Who or What | | --- | --- | | Manager org | The organization that resells Telnyx and runs an organization for each customer. | | Manager org owner | The [owner](/docs/iam/principals/organization-owner) of the manager org. | | Manager org users | The users and service accounts of the manager org. | | Managed org | An organization the manager org creates for one customer, with its own resources. | | Customer users | The customer's own people, who are users of the managed org. | This workflow gets you: - The manager org owner is a superuser in every managed org, with the same full access as that org's owner. - Customer users manage their own resources in their managed org, limited to the actions their roles allow. They cannot change their own access, and they never see the manager org or other managed orgs. - Manager org users enter managed orgs with only the actions their roles in the manager org allow. - Each manager org team starts with a default role in every new managed org, and one managed org can be narrowed.Preview - Guardrails apply in every managed org, and customer users cannot loosen them.Preview - A manager org user who leaves loses access to every managed org at once.Preview A step marked Preview can be skipped, and every other step still works. ## 1. Create a Managed Org In the manager org, the manager org owner creates a managed org for a customer with the [Managed Accounts API](/api-reference/managed-accounts/create-a-new-managed-account). ```json POST /v2/managed_accounts { "business_name": "Example Customer" } ``` A managed org created without `password` cannot be signed into directly unless a password is set later. An org's owner is never limited by IAM, so a managed org with no owner sign-in keeps every customer user inside their roles. Preview A [delegation](/docs/iam/access/delegations#a-delegation) comes with the managed org, granting its Owner role to whoever holds Owner in the manager org. No other manager org user can see the managed org until granted. ## 2. Work in a Managed Org In a managed org, the manager org owner acts with the managed org owner's full access. A request names the managed org with the `X-Managed-Account-Id` header, and everything it creates or changes belongs to the managed org. ```http POST /v2/messaging_profiles Authorization: Bearer X-Managed-Account-Id: f65ceda4-6522-4ad6-aede-98de83385123 Content-Type: application/json {"name": "Appointment reminders"} ``` Preview The managed org's audit log names the manager org user behind every change. See [Audit Events](/docs/iam/troubleshooting/audit-events). ## 3. Give Customer Users Limited Roles In the managed org, the manager org owner writes the roles and grants for customer users. Every `/v2/iam` request carries the header, so the role, the grant, and the setting all belong to the managed org. ```http POST /v2/iam/roles/{role_id}/statements X-Managed-Account-Id: f65ceda4-6522-4ad6-aede-98de83385123 {"actions": ["message.send", "messaging_profile.read"]} ``` A grant with the same header gives the role to a customer user, named by the `id` that `GET /v2/organizations/users` returns for the managed org. `PATCH /v2/iam/settings` with the header [enables IAM](/docs/iam/organization/enable-iam) in the managed org. The customer user then sends messages and reads messaging profiles, and nothing else. Only an org's owner manages IAM, so customer users cannot change any role or grant, their own included. ## 4. Let Manager Org Users In In the manager org, the manager org owner gives manager org users a role that allows `managed_account.impersonate`. Once the manager org has enabled IAM, a manager org user needs that action to enter any managed org. ```json POST /v2/iam/roles/{role_id}/statements { "actions": [ "managed_account.impersonate", "messaging_profile.*", "number_order.create" ] } ``` Inside a managed org, each request from a manager org user is decided by that user's roles in the manager org. A manager org user with this role manages messaging profiles and orders numbers in every managed org, and nothing else. The managed org's own roles and settings never apply to manager org users. ## 5. Give Each Manager Org Team a Default Preview In the manager org, the manager org owner sets the grants every delegation starts with. Manager org owners get Owner, the team that builds managed orgs gets Developer, and the support team gets Read-only. See [Delegations](/docs/iam/access/delegations#defaults-and-narrowing). ## 6. Narrow One Managed Org Preview In the manager org, the manager org owner narrows the delegation of one managed org whose customer runs it and wants the manager org for support only. Every manager org user gets Read-only there, the manager org owner included. Every other managed org keeps the defaults. ## 7. Set Guardrails Customer Users Cannot Loosen Preview In the manager org, the manager org owner sets a guardrail on every managed org. It stops anyone in a managed org, customer users and manager org users alike, from releasing the managed org's phone numbers, and nobody in the managed org can loosen it. See [Delegations](/docs/iam/access/delegations#manager-guardrails). A request a manager org user sends into a managed org also passes the manager org's own guardrail. A rule the manager org sets for its users, such as no API keys, holds inside every managed org too. See [Guardrails](/docs/iam/access/guardrails#up-to-three-guardrails). ## 8. Offboard a Manager Org User Everywhere at Once Preview When a user leaves the manager org, the manager org's identity provider removes them and SCIM deletes their Telnyx user. Delegations name roles and groups, not people, so access to every managed org ends at the same moment, with nothing to edit in any managed org. --- ## Reference ### API Endpoints > Source: https://developers.telnyx.com/docs/iam/reference/api.md Every IAM endpoint lives under `/v2/iam/`, takes the organization owner's credential, and answers in the standard `data` and `meta` envelope. ## Conventions - Lists take `page[size]`, up to 250 and 25 by default, and `page[number]`. `meta` carries `total_results`, `total_pages`, `page_number`, and `page_size`. - Roles, grants, settings, and service accounts are scoped to the owner's organization. An ID of another organization answers `404`. - Only the [organization owner](/docs/iam/principals/organization-owner) manages IAM. Every `/v2/iam` route, the catalog and the service account routes included, answers `403` to anyone else, service account tokens included. - The action catalog is the same for every organization. - Role, statement, grant, user, and service account IDs are UUIDs. A user's ID is the one the [Organization Users API](/api-reference/organization-users/list-organization-users) returns. ## Endpoints Every endpoint in this section is available. The endpoints under [Preview](#preview) are not available yet. | Method | Route | Action | | --- | --- | --- | | `GET` | `/v2/iam/actions` | `actions.read` | | `GET` | `/v2/iam/actions/{id}` | `actions.read` | | `GET` | `/v2/iam/roles` | `iam_roles.read` | | `POST` | `/v2/iam/roles` | `iam_roles.create` | | `GET` | `/v2/iam/roles/{id}` | `iam_roles.read` | | `PATCH` | `/v2/iam/roles/{id}` | `iam_roles.update` | | `DELETE` | `/v2/iam/roles/{id}` | `iam_roles.delete` | | `GET` | `/v2/iam/roles/{role_id}/statements` | `iam_role_statements.read` | | `POST` | `/v2/iam/roles/{role_id}/statements` | `iam_role_statements.create` | | `PUT` | `/v2/iam/roles/{role_id}/statements/{statement_id}` | `iam_role_statements.update` | | `DELETE` | `/v2/iam/roles/{role_id}/statements/{statement_id}` | `iam_role_statements.delete` | | `GET` | `/v2/iam/grants` | `iam_grants.read` | | `POST` | `/v2/iam/grants` | `iam_grants.create` | | `DELETE` | `/v2/iam/grants/{id}` | `iam_grants.delete` | | `GET` | `/v2/iam/settings` | `iam_settings.read` | | `PATCH` | `/v2/iam/settings` | `iam_settings.update` | | `GET` | `/v2/iam/service_accounts` | `service_accounts.read` | | `POST` | `/v2/iam/service_accounts` | `service_accounts.create` | | `GET` | `/v2/iam/service_accounts/{id}` | `service_accounts.read` | | `PATCH` | `/v2/iam/service_accounts/{id}` | `service_accounts.update` | | `DELETE` | `/v2/iam/service_accounts/{id}` | `service_accounts.delete` | | `POST` | `/v2/iam/service_accounts/{id}/actions/enable` | `service_accounts.enable` | | `POST` | `/v2/iam/service_accounts/{id}/actions/disable` | `service_accounts.disable` | ### Service Account Tokens Every token route below starts with `/v2/iam/service_accounts/{id}`. | Method | Route | Action | | --- | --- | --- | | `GET` | `/tokens` | `service_account_tokens.read` | | `POST` | `/tokens` | `service_account_tokens.create` | | `GET` | `/tokens/{token_id}` | `service_account_tokens.read` | | `PATCH` | `/tokens/{token_id}` | `service_account_tokens.update` | | `DELETE` | `/tokens/{token_id}` | `service_account_tokens.delete` | | `POST` | `/tokens/{token_id}/actions/activate` | `service_account_tokens.activate` | | `POST` | `/tokens/{token_id}/actions/deactivate` | `service_account_tokens.deactivate` | ### Decisions | Method | Route | Action | | --- | --- | --- | | `POST` | `/v2/iam/explain` | `iam.explain` | | `POST` | `/v2/iam/simulate` | `iam.simulate` | ### Preview These endpoints are not available yet. The pages that describe them show the intended behavior. | Method | Route | Action | | --- | --- | --- | | `GET` | `/v2/iam/audit_events` | | | `GET` | `/v2/iam/api_keys` | `api_keys.read` | | `POST` | `/v2/iam/api_keys` | `api_keys.create` | | `GET` | `/v2/iam/api_keys/{id}` | `api_keys.read` | | `DELETE` | `/v2/iam/api_keys/{id}` | `api_keys.delete` | | `POST` | `/v2/iam/tokens` | | | `GET` | `/v2/iam/guardrail` | | | `PUT` | `/v2/iam/guardrail` | `iam.guardrail.update` | | `POST` | `/v2/iam/projects` | `iam.projects.create` | | `POST` | `/v2/iam/projects/{name}/resources` | | | `GET` | `/v2/iam/delegations` | | | `PUT` | `/v2/iam/delegations/{id}/grants` | | | `PUT` | `/v2/iam/delegations/{id}/guardrail` | | | `PUT` | `/v2/iam/delegation_defaults` | | | `PUT` | `/v2/iam/delegation_defaults/guardrail` | | | `POST` | `/v2/iam/settings/actions/apply_template` | | Roles, their statements, and grants are described with their bodies on [Roles](/docs/iam/access/roles) and [Grants](/docs/iam/access/grants), the settings on [Enable IAM](/docs/iam/organization/enable-iam), and the action catalog, `GET /v2/iam/actions`, on [Actions](/docs/iam/access/actions). --- ### Limits > Source: https://developers.telnyx.com/docs/iam/reference/limits.md IAM enforces a few sizes and counts. Each answers `422` when exceeded, apart from the propagation time. | Limit | Value | | --- | --- | | Grants per principal | 10 | | Role name | 1 to 150 characters, unique in the organization without regard to case | | Role description | Up to 255 characters | | Actions per statement | At least 1. No upper limit. | | List page size | Up to 250, 25 by default | | Propagation | Changes to roles, grants, and settings apply within 5 seconds | | Roles per simulate | 10 | | Requests per simulate | 50 | | Resources per statementPreview | Capped. For larger sets, use a project or a managed organization. | ---