Skip to content
Skip to main content
POST
https://api.us.nylas.com/v3/iam/principals/{principal_id}/credentials

Create IAM credential

Creates an API key for an active principal.

name and expires_at are required. expires_at must be in the future and no more than 10 years ahead.

This response is the only time Nylas returns the key's secret, so store it securely. Nylas rejects unknown fields and null values.

Requires an IAM API key with the iam.credentials.create permission. Application API keys and access tokens don't work.

Parameters

Path parameters

principal_id*string

The principal's ID.

Request body

name*string

A name for the API key, such as the service that uses it. Nylas trims leading and trailing spaces.

Example: "Support worker key"
minLength: 1maxLength: 128
statusstring

Whether the API key can authenticate.

activedisabled
Default: "active"
expires_at*integer<int64>

When the API key expires, as a Unix timestamp in seconds. It must be in the future and no more than 10 years ahead. You can't change it later, so create a new API key to use a different expiration.

Example: 1799193600

Responses

request_idstring

The ID of the request.

dataobject
Example: {"id":"8Lp2QwVm4rT6sYxN0cDzB","principal_id":"9Xf3LmQa2rP7sTuV0wYzB","type":"api_key","name":"Support worker key","status":"active","expires_at":1799193600,"created_at":1791417600,"updated_at":1791417600,"secret":"<NYLAS_IAM_API_KEY>"}
POSThttps://api.us.nylas.com/v3/iam/principals/{principal_id}/credentials

Paste the authorization token required for this endpoint.

principal_idrequiredstring

The principal's ID.

Loading editor...

Autocomplete and validation come from this endpoint's request schema.