younifyd
Menu

Create Token

Create a new token for the project

POST/projects/{projectId}/tokens

Use it in a workflow

  1. Add a step and choose the Sanity connector.
  2. Pick the Create Token action (under Projects).
  3. Fill in the fields below, then reference the result from later steps as {{createToken.response.data}}.

Request

Path parameters

projectIdstringrequired

The unique ID of the project.

Query parameters

sendNotificationboolean

Whether to email the project's administrators about the new token. You can only set it to false within five minutes of creating the project. Otherwise, the request fails with `Cannot skip token notification`.

Default true

Request body

Enter the body as JSON in the step's Body field.

labelstringrequired

A descriptive label for your token. This can help you identify it later so you know where it's being used. The label must be unique within the project.

roleNamestring

The permissions to assign your token. These will vary by plan. On a Free plan, roleName must be viewer, editor, or deploy-studio. Provide either roleName or roleNames.

roleNamesarray<string>

The names of the roles to assign your token. Provide either roleName or roleNames.

json
{
  "label": "string",
  "roleName": "string",
  "roleNames": [
    "string"
  ]
}

Response

Returns 201 with an object. Read it in later steps with {{createToken.response.data.<field>}}.

idstring
labelstring
keystring
projectUserIdstring
rolesarray<object>
namestring
titlestring
json
{
  "id": "string",
  "label": "string",
  "key": "string",
  "projectUserId": "string",
  "roles": [
    {
      "name": "string",
      "title": "string"
    }
  ]
}

Need more? See the Sanity guide for connection setup and behaviour shared by every action.

Was this page helpful?
Create Token — Sanity — Documentation