Nylas IAM controls which Nylas resources an API caller can access and what actions it can perform. Use it to issue least-privilege API keys for services, workers, and AI agents instead of sharing an application-wide key.
Configure Nylas IAM in the Nylas Dashboard, or manage principals and credentials with the public API. This page covers the Dashboard workflow.
How Nylas IAM works
Section titled “How Nylas IAM works”Nylas has two separate authentication and authorization layers:
- Provider authentication connects a user’s Google, Microsoft, IMAP, or other provider account to Nylas. The resulting grant stores that connection and its provider OAuth scopes.
- Nylas IAM authorization controls which API callers can use Nylas resources. The resource boundary and permissions assigned to each caller define this access.
Provider scopes can’t grant a caller permission that Nylas IAM denies. Likewise, Nylas IAM can’t give a caller access that the connected provider account didn’t authorize.
The IAM access model uses these objects:
| Object | Purpose |
|---|---|
| Principal | Represents an API caller and combines one resource binding with roles and direct permissions. |
| Resource binding | Limits the principal to one organization, application, workspace, or grant. |
| Role | Groups related permissions. Nylas provides system roles, and you can create custom roles. |
| Permission | Controls a specific Nylas action. You can inherit permissions from roles or assign them directly. |
| Credential | Provides an IAM API key that authenticates as its principal. |
| Audit activity | Records IAM configuration changes and allowed or denied requests made with IAM credentials. |
How a principal, its roles, and its keys fit together
401.Diagram as text
- What the principal combines:
- Resource binding: Grant:
support@example.com: Where the principal can act. Every principal has exactly one binding. - Role: Support reader: A custom role: a named set of permissions you can assign to many principals. Nylas also provides system roles. Permissions:
messages.read,threads.read. - Direct permission: Assigned to this principal only: For an exception that doesn't belong in a shared role. Permissions:
messages.update.
- Resource binding: Grant:
- Principal: Customer support app: Represents one API caller. Its permissions are everything from its roles plus its direct permissions. Any permission the binding doesn't support is ignored.
- Can do:
messages.read,threads.read,messages.update - On:
support@example.comonly
- Can do:
- Each key authenticates as the principal:
- Credential (IAM API key): Production key: The support service sends it as a Bearer token. It expires on the date you set, and Nylas shows its secret only once.
- Credential (IAM API key): Replacement key: Created during a rotation. It works exactly like the production key until you delete the old one.
In the Dashboard, define a principal through Name → Resource → Access, then create one or more credentials that authenticate as that principal.
Create and configure a principal
Section titled “Create and configure a principal”A principal is an aggregation of permissions for an API caller. Create one principal for each distinct access pattern. You can issue more than one credential for a principal when callers need the same access.
- In the Dashboard, open your organization’s Nylas IAM page.
- On the Principals tab, click Create principal.
- In Name, enter a descriptive workload name. Add a description that identifies the service or agent that will use this principal, then continue to Resource.
- Choose exactly one resource binding. For Application, Workspace, or Grant, select the application before selecting the final resource.
- Continue to Access and select one or more roles, direct permissions, or both.
- Review the configuration and click Create principal.
Every principal requires exactly one resource binding. An Organization binding covers organization-level actions such as IAM and domain management, and no connected accounts.
What each resource binding reaches
workspace_id, so it never reaches a grant that has no workspace. Application and Grant bindings don't depend on workspaces.Diagram as text
- Your Nylas organization. Organization binding: IAM and email domains only. Reaches no grants.
- Production application. Application binding: Reaches every grant in this application, in a workspace or not.
- Acme workspace. Workspace binding: Reaches the grants in this workspace. Grants:
ana@acme.com,ben@acme.com. - Globex workspace. Grants:
kim@globex.com,kim.lee@gmail.com. - Not in a workspace: Removed from a workspace, or created before the application had a default workspace. Only an Application or Grant binding reaches these grants. Grants:
sam@initech.com.
- Acme workspace. Workspace binding: Reaches the grants in this workspace. Grants:
- Internal tools application: Doesn't use workspaces. Bind to the application or to single grants.
- Grants:
support@example.com,billing@example.com.
- Grants:
- Production application. Application binding: Reaches every grant in this application, in a workspace or not.
- Grant binding: Reaches one grant, such as
ben@acme.com, whether or not it's in a workspace. - When to use each binding:
- Organization binding: The admin key that creates other principals and keys, or manages email domains.
- Application binding: A service that works across the whole application, such as a sync job or a webhook processor.
- Workspace binding: A key for one customer, team, or user. Grants you assign to the workspace later are covered, and grants you remove stop working on the next request.
- Grant binding: A worker or AI agent that acts for one mailbox or calendar. Works for apps with or without workspaces.
A Grant binding searches all grants in the selected application by grant ID or email address. It doesn’t depend on workspace membership, so you can select grants in applications that have no workspaces, including unassigned grants.
You can edit a principal’s name, description, status, resource binding, roles, and direct permissions. Disabling a principal prevents its credentials from accessing Nylas. Deleting a principal also deletes every IAM API key attached to it, and you can’t undo the deletion.
Configure roles and permissions
Section titled “Configure roles and permissions”Roles make common access patterns reusable. On the Roles tab, choose a Nylas system role or create a custom role with the exact permissions your workload needs.
- System roles come from Nylas. You can assign them to principals but can’t edit or delete them.
- Custom roles contain the permissions you select. You can create, edit, and delete them.
- Direct permissions apply to one principal without creating a role. Use them for exceptions or narrowly tailored access.
Permissions from roles and direct assignments are additive, but the resource binding remains the outer access boundary. When a role has permissions that the selected binding doesn’t support, the Dashboard separates them into Effective permissions and Ignored permissions. Ignored permissions don’t grant access at that binding level. For every permission ID and the binding it needs, see the Nylas IAM permissions reference.
Manage IAM through the API
Section titled “Manage IAM through the API”The IAM Admin system role (role_system_iam_admin) grants principal and credential CRUD permissions. IAM Auditor (role_system_iam_auditor) grants read-only access to those objects. Both require an Organization resource binding. Assign either role to a principal, then issue a key for IAM API automation.
Create and manage IAM API keys
Section titled “Create and manage IAM API keys”The Dashboard calls these credentials. An IAM API key is a credential of type api_key attached to a principal. Requests made with the key inherit the principal’s resource binding, roles, direct permissions, and status.
- On the Credentials tab, click Create key.
- Enter a descriptive name and select an active principal.
- Choose an expiration preset or a custom future date, up to 10 years ahead. Every new IAM key expires.
- Click Create and copy the secret immediately. The Dashboard displays it only once.
- Store the secret in a managed secrets service and inject it into your backend at runtime.
Use an IAM API key anywhere you use a Nylas API key. Send it as a Bearer token or pass it to a Nylas SDK:
curl --request GET \ --url "https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/messages" \ --header "Authorization: Bearer <NYLAS_IAM_API_KEY>"IAM API keys differ from application API keys:
| Key type | Access model | Management location |
|---|---|---|
| IAM API key | Inherits one principal’s resource binding and permissions. | Organization Nylas IAM page |
| Application API key | Provides application-wide access to the application’s connected accounts. | Application API keys page |
Prefer IAM API keys for production workloads that don’t need application-wide access. Keep both key types out of source code, client applications, logs, prompts, and error messages.
To rotate an IAM API key without downtime, create a replacement credential for the same principal, deploy the new secret, verify that requests succeed, and then delete the old credential. You can edit a key to change its name or set its status to Disabled. A disabled or deleted key no longer authenticates and returns 401 Unauthorized.
Review and troubleshoot IAM activity
Section titled “Review and troubleshoot IAM activity”How Nylas checks a request made with an IAM API key
support@example.com grant. A role gives it permission to read messages, and a direct permission lets it update them. Changes to the principal apply from the next request.Diagram as text
- Your service: Send a request with the IAM API key: The key goes in the
Authorizationheader as a Bearer token, the same way as any Nylas API key. Example:GET /for thev3/ grants/ {grant_id}/ messages support@example.comgrant. - Nylas: Find the principal the key belongs to: The key must exist, be active, and not have expired, and its principal must be active. Here, the key belongs to the Customer support app principal.
- Key or principal not usable → 401 Unauthorized: The key is unknown, disabled, expired, or deleted, or its principal is disabled.
- Nylas: Check the principal can do this action: Each endpoint needs one permission. Reading messages needs
messages.read, which this principal gets from its role. Permissions from roles and direct permissions add together.- Permission missing → 403 Forbidden: The principal doesn't have the permission. Access Activity records the denial.
- Nylas: Check the grant is inside the binding: A Grant binding reaches that one grant, a Workspace binding reaches the grants in that workspace, and an Application binding reaches every grant in the application. This request targets
support@example.com, the principal's own grant.- Grant outside the binding → 403 Forbidden: The grant is valid, but this principal isn't bound to it. Access Activity records the denial.
- Provider: Nylas runs the request on the connected account: The account's own OAuth scopes still apply. IAM can narrow what a key does, but it can't add access the user didn't grant when they connected the account. (Allowed. Access Activity records it)
Nylas IAM retains both audit views for 400 days:
- Config Changes records changes to principals, credentials, roles, permissions, and resource bindings. Filter by event, resource type, time, principal ID, credential ID, resource ID, actor, or Request ID.
- Access Activity records allowed and denied API, authentication, and MCP requests made with IAM credentials. Filter by result, principal, API key, time, application, grant, workspace, or Request ID.
When an Access Activity event has a Request ID and application, use its request link to open the corresponding API, authentication, or MCP logs. This connects the authorization decision to the underlying request without exposing credential secrets.
Troubleshoot 401 Unauthorized
Section titled “Troubleshoot 401 Unauthorized”A 401 response means Nylas couldn’t authenticate the credential. In the Credentials tab, confirm that the IAM API key still exists and has an Active status. Also confirm that its principal is active and that the caller is sending the current secret as a Bearer token.
Because the Dashboard displays a key secret only once, create a replacement if the stored value is unavailable. Never place a key in a ticket, chat message, log, or screenshot while troubleshooting.
Troubleshoot 403 Forbidden
Section titled “Troubleshoot 403 Forbidden”A 403 response means Nylas authenticated the IAM API key but didn’t authorize the request. Open Access Activity, filter by Request ID or API key, and inspect the denial reason. Then confirm that:
- The principal’s resource binding includes the application, workspace, or grant in the request.
- The principal has an effective permission for the requested action.
- A role permission isn’t listed as ignored for the selected resource binding.
Provider OAuth scopes are a separate authorization layer. If IAM allowed the request but the provider rejected the operation, inspect the grant’s provider scopes and the provider-specific error instead.
What’s next
Section titled “What’s next”- Manage IAM principals and API keys for API workflows, expiration, and object limits
- Authentication overview for provider authentication methods and grants
- Security best practices for protecting credentials and user data
- Nylas MCP server for connecting agents with an IAM API key
- Troubleshoot Nylas API errors for common API and provider failures