---
title: "Update a metadata schema"
method: PATCH
path: "/v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}"
tags: ["Metadata Schemas"]
---

# Update a metadata schema

`PATCH /v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}`

## Request

- Base URL: `https://api.naturali.ai`
- URL: `https://api.naturali.ai/v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.naturali.ai/authorize`, token URL `https://api.naturali.ai/token`, scopes: `mcp:access`)

Changes the schema, the selector, or both. `resource_type` is fixed at creation: it decides the selector's spelling and which write path reads the row, so changing it would silently repoint the declaration at a different door — delete it and declare again instead.

## Path parameters

- `metadata_schema_id` string, required

## Request body

- object
  - `path_prefix` string: The declaration's new selector.
  - `schema` object: Replaces the declared JSON Schema.

## Response `200`

The declaration

- MetadataSchemaRecord
  - `id` string: Public ID (mdschema_ prefix)
  - `project_id` string
  - `resource_type` 'document': The resource whose metadata this declaration governs.
  - `path_prefix` string: The selector, in the field its resource type is addressed by. A document's is the directory it is filed under.
  - `schema` object: The declared JSON Schema, as written.
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `400`: Bad Request — an unusable selector, or a schema that is not valid JSON Schema
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found
- `409`: Conflict — this selector is already declared for this type

---

[API](https://skmtc.dev/naturali/apis/naturali-ai-api.md) · [All operations](https://skmtc.dev/naturali/apis/naturali-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/naturali/apis/naturali-ai-api/revisions/e4905b78f422?raw)
