Skip to main content
PATCH
Use this endpoint to add new fields to a database’s database_metadata_schema. SDK methods: client.databases.update_metadata_schema() (Python) and client.databases.updateMetadataSchema() (TypeScript). GET /databases/{database}/metadata-schema returns the current schema in the same field shape.
This endpoint is additive only. It cannot delete fields, rename fields, change the type/flags of existing fields, or add dense/sparse search lanes.

Request

Path parameters

Body

Each add_fields[] item uses the same field shape as database_metadata_schema on Create Database:

Rules

  • Existing field names cannot be reused with a different definition, case-insensitively. A field that differs from the existing one in type, max_length, or flags returns 409, as does one name declared twice in a request with different definitions. Resending a field with its identical definition is a no-op.
  • Total custom database metadata fields cannot exceed 32. Skipped fields do not count toward the new total.
  • Reserved names such as source_id, chunk_id, metadata, and document_metadata are rejected.
  • Resending an existing field that already has dense or sparse flags is a no-op.

Response

A success returns database, the deprecated tenant_id, and added_fields directly, without the success/data envelope. added_fields lists only the fields this call added, so an empty list means the database already had everything you sent. Errors use the standard error envelope.

Errors

Apart from a malformed body and a missing database, this endpoint currently returns error.code: "INTERNAL_ERROR" for 400, 409, and 500 alike. Branch on the HTTP status and read error.message, which names the field and the rule it broke.

Authorizations

Authorization
string
header
required

API key sent as a Bearer token: "Bearer prefix.secret"

Path Parameters

database
string
required

Database identifier

Example:

"acme_corp"

Body

application/json

Metadata schema fields to add

add_fields
object[]

New metadata schema fields to add to the database. Additive only — no deletes, renames, or type changes.

Example:

Response

OK

added_fields
string[]

Names of the metadata schema fields successfully added.

Example:
database
string

Owning database. Formerly tenant_id; the tenant_id alias is still accepted (deprecated).

Example:

"acme_corp"

tenant_id
string
deprecated
Example:

"acme_corp"