younifyd
Menu

Create Permission Resource

Create a permission resource

POST/projects/{projectId}/permissionResources

Use it in a workflow

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

Request

Path parameters

projectIdstringrequired

The ID of the project

Request body

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

permissionResourceTypestringrequired

The name of the permission resource schema to base the resource on

namestring

A unique name for the resource. Use lowercase letters, numbers, hyphens, and underscores. Can't start with `res-` or `sanity`.

titlestringrequired

The title of the resource

descriptionstring

A description of the resource

configobjectrequired

Configuration that matches the permission resource schema's `config`. Unknown keys return `422`.

json
{
  "permissionResourceType": "sanity.document.filter",
  "title": "Articles",
  "config": {
    "filter": "_type == \"article\""
  },
  "name": "articles",
  "description": "Documents of type article"
}

Response

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

idstring

The ID of the permission resource

namestring

The name of the permission resource

titlestring

The title of the permission resource

descriptionstring

A description of the permission resource

configobject

The resource configuration. For `sanity.document.filter` resources, `filter` is a GROQ filter.

isCustomboolean

Whether the resource was created by a user rather than by Sanity

permissionResourceTypestring

The name of the permission resource schema the resource is based on

json
{
  "id": "res-k2d8fj3a",
  "name": "articles",
  "title": "Articles",
  "description": "Documents of type article",
  "config": {
    "filter": "_type == \"article\""
  },
  "isCustom": true,
  "permissionResourceType": "sanity.document.filter"
}

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

Create Permission Resource — Sanity — Documentation