Skip to content
Skip to main content
PATCH
https://api.us.nylas.com/v3/grants/{grantId}

Update a grant

Updates the specified grant's display name, provider settings, scope data, or workspace.

Common use cases:

  • Rotate a refresh token — If you obtain a new refresh_token from a provider (for example, after a user re-consents in your own OAuth flow), you can update the grant's stored token without deleting and recreating the grant. Pass the new token in settings.refresh_token.
  • Update provider settings — For non-OAuth providers such as iCloud and IMAP, you can update the credentials and connection settings stored for the grant.
  • Rename an Agent Account — Set name to change the default From name on messages the account sends.

Omitted top-level fields remain unchanged. Nylas does not deep merge a non-empty settings object with the grant's stored settings. Include all provider-required fields for the settings update. An empty settings object is accepted as a no-op. For more information, see Updating objects.

Works with an API key or an IAM API key with the grants.update permission.

Parameters

Path parameters

grantId*string

Request body

namestring

The display name stored on the grant. An Agent Account uses it as the From name on messages that don't set from and on calendar invitations. The next message uses the new name. An empty string isn't accepted.

Example: "Acme Support"
minLength: 1maxLength: 256
settingsobject

Provider-specific settings for the grant. For OAuth providers, this typically contains the refresh_token. Nylas does not deep merge a non-empty object with stored settings, so include all fields required by the provider for this update. An empty object is accepted as a no-op.

Example: {"refresh_token":"<NEW_REFRESH_TOKEN>"}
scopearray<string>

A list of OAuth scopes to validate for the grant update. When Nylas can read the authoritative scopes from the stored provider grant, it stores and returns those provider-granted scopes instead of the values in this array. This field cannot grant or revoke provider permissions. To change provider permissions, the user must re-authenticate through the provider's OAuth consent flow.

Example: ["Mail.Read","Mail.Send","User.Read","offline_access"]
workspace_idstring

The ID of the workspace to move the grant to. The workspace must belong to the same application as the grant. The workspace's domain doesn't need to match the grant's email domain. Omit the field to leave the grant's workspace unchanged. This field can't remove a grant from its workspace. Use remove_grants on the Update workspace assignments endpoint instead.

Example: "abf6ff99-05ad-4c0a-aaf8-400aacf2470a"

Responses

request_idstring

ID of the request

Example: "5967ca40-a2d8-4ee0-a0e0-6f18ace39a90"
dataobject
PATCHhttps://api.us.nylas.com/v3/grants/{grantId}

Find your API key in the Nylas Dashboard under API Keys in your application settings.

grantIdrequiredstring
Loading editor...

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