Skip to main content
PATCH
Adds fields to a database’s metadata schema after creation. The call is additive only: it cannot delete or rename fields, change the type or flags of an existing field, or add dense or sparse search fields. Get Metadata Schema returns the current schema in the same field shape.

Request body

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

Rules

  • Conflicts: An existing field name 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 resent with its identical definition is a no-op, including an existing field that already has dense or sparse flags.
  • Field limit: A database can have at most 32 custom metadata fields. Skipped fields do not count toward the new total.
  • Reserved names: Names such as source_id, chunk_id, metadata, and document_metadata are rejected.

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

Send your API key as Authorization: Bearer <your_api_key>.

Path Parameters

database
string
required

Database identifier

Example:

"acme_corp"

Body

application/json

Metadata schema fields to add

add_fields
TenantsCustomPropertyDefinition · object[]

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

Example:

Response

OK

added_fields
string[]
required

Names of the metadata schema fields successfully added.

Example:
database
string
required

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

Example:

"acme_corp"

tenant_id
string
deprecated

Deprecated: use database.

Example:

"acme_corp"