openapi: 3.0.3 info: title: Sanity HTTP Assets Projects API description: The Sanity HTTP API provides access to the Sanity Content Lake platform, enabling querying, mutating, and managing structured content. The API supports GROQ queries, real-time event streaming, asset management, project management, webhooks, scheduling, and AI-powered content agents. Authentication uses Bearer tokens generated from Sanity project settings. version: v2024-01-01 contact: name: Sanity Support url: https://www.sanity.io/docs license: name: Commercial url: https://www.sanity.io/legal/terms servers: - url: https://{projectId}.api.sanity.io/v{apiVersion} description: Sanity project-scoped API endpoint variables: projectId: description: Your Sanity project ID default: your-project-id apiVersion: description: API version date (YYYY-MM-DD) default: '2024-01-01' - url: https://api.sanity.io/v{apiVersion} description: Sanity management API endpoint variables: apiVersion: description: API version date default: '2024-01-01' security: - BearerAuth: [] tags: - name: Projects description: Project and dataset management paths: /projects: get: operationId: listProjects summary: List Projects description: List all Sanity projects accessible to the authenticated user, ordered by creation date. tags: - Projects responses: '200': description: List of projects content: application/json: schema: type: array items: $ref: '#/components/schemas/Project' post: operationId: createProject summary: Create Project description: Create a new Sanity project. tags: - Projects requestBody: required: true content: application/json: schema: type: object required: - displayName properties: displayName: type: string description: Human-readable project name organizationId: type: string description: Organization to associate project with responses: '200': description: Project created content: application/json: schema: $ref: '#/components/schemas/Project' /projects/{projectId}: get: operationId: getProject summary: Get Project description: Retrieve details for a specific Sanity project. tags: - Projects parameters: - name: projectId in: path required: true schema: type: string responses: '200': description: Project details content: application/json: schema: $ref: '#/components/schemas/Project' patch: operationId: updateProject summary: Update Project description: Update a Sanity project's settings. tags: - Projects parameters: - name: projectId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: type: object properties: displayName: type: string metadata: type: object responses: '200': description: Project updated content: application/json: schema: $ref: '#/components/schemas/Project' /projects/{projectId}/datasets: get: operationId: listDatasets summary: List Datasets description: List all datasets for a project. tags: - Projects parameters: - name: projectId in: path required: true schema: type: string responses: '200': description: List of datasets content: application/json: schema: type: array items: $ref: '#/components/schemas/Dataset' put: operationId: createDataset summary: Create Dataset description: Create a new dataset in a project. tags: - Projects parameters: - name: projectId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: type: object required: - datasetName properties: datasetName: type: string aclMode: type: string enum: - public - private responses: '200': description: Dataset created content: application/json: schema: $ref: '#/components/schemas/Dataset' /projects/{projectId}/tokens: get: operationId: listTokens summary: List Tokens description: List all API tokens for a project. tags: - Projects parameters: - name: projectId in: path required: true schema: type: string responses: '200': description: List of tokens content: application/json: schema: type: array items: $ref: '#/components/schemas/Token' post: operationId: createToken summary: Create Token description: Create a new API token for a project. The token key is only returned at creation time and cannot be retrieved again. tags: - Projects parameters: - name: projectId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: type: object required: - label - roleName properties: label: type: string roleName: type: string description: Role to assign to the token responses: '200': description: Token created with key content: application/json: schema: $ref: '#/components/schemas/TokenWithKey' components: schemas: Dataset: type: object properties: name: type: string aclMode: type: string enum: - public - private tags: type: array items: type: object TokenWithKey: allOf: - $ref: '#/components/schemas/Token' - type: object properties: key: type: string description: The API token key (only returned at creation) Project: type: object properties: id: type: string description: Unique project ID displayName: type: string organizationId: type: string isBlocked: type: boolean createdAt: type: string format: date-time updatedAt: type: string format: date-time Token: type: object properties: id: type: string label: type: string roleName: type: string createdAt: type: string format: date-time securitySchemes: BearerAuth: type: http scheme: bearer description: Sanity project API token