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

Update a grant

Updates the specified grant's provider settings or scope data.

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.

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.

NYLAS API KEY

Parameters

Path parameters

grantId*string

Request body

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.