Projects API reference
Reference documentation for the projects HTTP endpoint.
The project API allows you to create and manage projects and datasets.
For role and permission management, we suggest using the newer Access API instead.
Authentication
- All requests must be authenticated.
- Managing projects requires the Administrator or Developer role, or equivalent.
Base API server URL
Sanity API base URL
https://api.sanity.io/{apiVersion}Variables
- apiVersionstringdefault:
"v2021-06-07"API version
Endpoints
Responses
A list of projects.
- idstring
- displayNamestring
- studioHoststring | null
- organizationIdstring | null
- metadataobject
Show child attributes
- colorstring
- isBlockedboolean
- isDisabledboolean
- activityFeedEnabledboolean
- createdAtstring (date-time)
- membersarray
items
Request body application/json
The display name of the project.
Example:My Project- organizationIdstring
Assign the created project to the specified organization. The organization to which organizationId belongs must already exist and you must have sufficient permissions to assign a project to the organization. If omitted, the project is assigned to your personal account.
Example:org_123 - isBlockedbooleanExample:
false - isDisabledbooleanExample:
false - isDisabledByUserbooleanExample:
false - maxRetentionDaysinteger
- activityFeedEnabledbooleanExample:
true - idstringExample:
wefsadfj - updatedAtstring (date-time)Example:
2021-01-01T00:00:00Z - createdAtstring (date-time)Example:
2021-01-01T00:00:00Z - metadataobject
Show child attributes
- colorstringExample:
#000000 This field is deprecated. Use the /user-applications API instead.
Example:https://my-project.my-domain.com
- membersarray
Responses
Project created successfully.
- idstring
- displayNamestring
- studioHoststring | null
- organizationIdstring | null
- metadataobject
Show child attributes
- colorstring
- isBlockedboolean
- isDisabledboolean
- activityFeedEnabledboolean
- createdAtstring (date-time)
- membersarray
Path parameters
The unique ID of the project.
Responses
Project details.
- idstring
- displayNamestring
- studioHoststring | null
- organizationIdstring | null
- metadataobject
Show child attributes
- colorstring
- isBlockedboolean
- isDisabledboolean
- activityFeedEnabledboolean
- createdAtstring (date-time)
- membersarray
Path parameters
The unique ID of the project.
Request body application/json
- displayNamestring
- studioHoststring
Your studio hostname for deployment on Sanity's hosted service: https://
.sanity.studio/. Example:https://my-project.sanity.studio - metadataobject
Show child attributes
- colorstring
The color of the project.
Example:#000000 - externalStudioHoststring
The external studio hostname for deployment on a custom domain.
Example:https://my-project.my-domain.com
- isDisabledByUserboolean
- activityFeedEnabledboolean
Responses
Project updated successfully.
Path parameters
The unique ID of the project.
Responses
Project deleted successfully.
List all CORS entries
/projects/{projectId}/corsReturns a list of all CORS origins for a specific project.
Path parameters
Responses
A list of CORS entries.
- idinteger
- originstring
- allowCredentialsboolean
- createdAtstring (date-time)
items
Delete a CORS entry
/projects/{projectId}/cors/{id}Deletes a specific CORS origin for a project.
List all datasets available to the project
/projects/{projectId}/datasetsReturns a list of all datasets for the project.
Retrieve a dataset
/projects/{projectId}/datasets/{name}Returns the details of a specific dataset by name.
Request body application/json
The ACL mode to set for the new dataset. Defaults to public.
Example:public- embeddingsobject
The settings for the embeddings index for the dataset.
Show child attributes
Whether the embeddings index is enabled for the dataset.
- projectionstring
The GROQ projection that defines which fields to include in the embeddings index. If you don't include a projection, we process the entire document JSON into a less verbose format and embed all of it. Example: "{title, author}" or "{...}" for all fields
Example:{title, author}
Responses
OK
Update a dataset
/projects/{projectId}/datasets/{name}Updates a specific dataset in the project.
Copy a dataset
/projects/{projectId}/datasets/{name}/copyCopies a dataset to a new dataset. This is a feature available to Business and Enterprise customers.
Path parameters
The unique ID of the project.
The name of the dataset to copy.
Request body application/json
- targetDatasetstring
The name of the new dataset to create.
If true, revision history is not copied, which will usually result in a much faster copy. If false or omitted, revision history is copied to targetDataset.
The ACL mode to set for the new dataset.
Responses
OK
List copy jobs history
/projects/{projectId}/datasets/{name}/copyList copy jobs history for a dataset. This is a feature available to Business and Enterprise customers.
Path parameters
The unique ID of the project.
The name of the dataset.
Query parameters
Start position in list.
Number of items to return.
Comma separated list of job states.
items
- itemsstring
Responses
OK
- idstringExample:
123456 - statestringExample:
pending - createdAtstring (date-time)Example:
2021-01-01T00:00:00Z - updatedAtstring (date-time)Example:
2021-01-01T00:00:00Z - sourceDatasetstringExample:
my-dataset - targetDatasetstringExample:
my-dataset-copy
items
List active features for the project
/projects/{projectId}/featuresReturns a list of active features for the project.
Path parameters
The unique ID of the project.
Responses
OK
- stringExample:
privateDataset
items
List permissions for the project
/projects/{projectId}/permissionsReturns a list of permissions for the project.
Path parameters
The unique ID of the project.
Responses
OK
- string
items
Path parameters
The unique ID of the project.
The unique ID of the user. If authenticated with a user token, you can substitute "me" for the user ID.
Responses
OK
- idstring
- sanityUserIdstring
- projectIdstring
- displayNamestring
- familyNamestring
- givenNamestring
- imageUrlstring
- createdAtstring (date-time)
- updatedAtstring (date-time)
List tokens for the project
/projects/{projectId}/tokensReturns a list of tokens for the project.
This endpoint does not reveal the actual token, only details about the token.
Create a new token for the project
/projects/{projectId}/tokensCreates a new token for the project.
Path parameters
The unique ID of the project.
Request body application/json
A descriptive label for your token. This can help you identify it later so you know where it's being used.
The permissions to assign your token. These will vary by plan. On a Free plan, roleName must be viewer, editor, or deploy-studio.
Delete a token for the project
/projects/{projectId}/tokens/{tokenId}Deletes a token for the project.
List tags for a dataset
/projects/{projectId}/datasets/{name}/tagsReturns a list of tags for the dataset.
Create a new tag for the project
/projects/{projectId}/tagsCreates a new tag for the project. Datasets cannot be assigned at tag creation. Use the PUT endpoint to assign datasets to the tag.
Path parameters
The unique ID of the project.
Request body application/json
- titlestring
The title of the tag.
- namestring
The name of the tag.
- descriptionstring
The description of the tag.
- metadataobject
A set of additional configuration options
Show child attributes
The color of your tag.
Path parameters
The unique ID of the project.
The unique ID of the tag.
Request body application/json
- titlestring
The title of the tag.
- namestring
The name of the tag.
- descriptionstring
The description of the tag.
- metadataobject
A set of additional configuration options
Show child attributes
The color of your tag.
Delete a tag by identifier
/projects/{projectId}/tags/{tagIdentifier}Deletes a tag by identifier. The tag must not be assigned to any datasets.
Path parameters
The unique ID of the project.
The unique ID of the tag.
Responses
Assign a tag to a dataset
/projects/{projectId}/datasets/{datasetName}/tags/{tagIdentifier}Assigns a tag to a dataset.
Path parameters
The unique ID of the project.
The name of the dataset.
The unique ID of the tag.
Responses
OK
Remove a tag from a dataset
/projects/{projectId}/datasets/{datasetName}/tags/{tagIdentifier}Removes a tag from a dataset.
Path parameters
The unique ID of the project.
The name of the dataset.
The unique ID of the tag.
Responses
Get embeddings index settings for a dataset
/projects/{projectId}/datasets/{name}/settings/embeddingsReturns the settings for the embeddings index for a dataset.
Path parameters
The unique ID of the project.
The name of the dataset.
Responses
OK
- enabledboolean
- projectionstring
The GROQ projection that defines which fields to include in the embeddings index. If you don't include a projection, we process the entire document JSON into a less verbose format and embed all of it. Example: "{title, author}" or "{...}" for all fields
Example:{title, author} - statusstring
The status of the embeddings index. (ready, updating, error)
Example:updating
Update embeddings index settings for a dataset
/projects/{projectId}/datasets/{name}/settings/embeddingsUpdates the settings for the embeddings index for a dataset.
Path parameters
The unique ID of the project.
The name of the dataset.
Enables the embeddings index for a dataset.
{
"enabled": true,
"projection": "{title, author}"
}Request body application/json
- enabledboolean
- projectionstring
The GROQ projection that defines which fields to include in the embeddings index. If you don't include a projection, we process the entire document JSON into a less verbose format and embed all of it. Example: "{title, author}" or "{...}" for all fields
Example:{title, author}
Responses
OK
- enabledboolean
- projectionstring
The GROQ projection that defines which fields to include in the embeddings index. If you don't include a projection, we process the entire document JSON into a less verbose format and embed all of it. Example: "{title, author}" or "{...}" for all fields
Example:{title, author} - statusstring
The status of the embeddings index. (ready, updating, error)
Example:updating