Update Source Metadata
Merge tenant metadata and additional metadata for one existing source without re-ingesting its content.
PATCH /context/sources/{source_id}/metadata still works but is deprecated - migrate to the route above. Both dispatch to the same handler; source_id and id name the same value.Request
Path parameters
Body
database_metadata or additional_metadata is required.
Behavior
- The update is a merge/upsert:
- keys present in the request are inserted or overwritten
- keys omitted from the request are preserved
- The source must already exist. This endpoint does not create sources.
- The endpoint edits one source at a time. Bulk metadata edits are not supported.
- Updated metadata is visible to
/querymetadata filters and/context/listfilters. - If an edited tenant metadata field has
enable_dense_embeddingorenable_sparse_embedding, HydraDB synchronously refreshes the relevant vector store metadata search lane. - If the edited fields are
enable_match-only, the edit remains MongoDB-only andvector_sync_requiredisfalse.
Response
Validation and errors
Size limits
database_metadata (and its still-accepted tenant_metadata alias) is capped at
16 KiB; additional_metadata at 1 KiB. Each cap applies to the whole map,
measured on its compact JSON encoding in UTF-8 bytes - keys, quotes and
punctuation count toward the budget, so budget in bytes rather than in characters
of content.
The cap is checked against the payload in this request, before the merge - not
against the stored map the merge produces. A small edit to an already-large map is
therefore accepted, so treat the cap as a per-request budget rather than a
guarantee about the final stored size. Over-cap fails the whole edit with 400 and
reports both numbers:
Related
Authorizations
API key sent as a Bearer token: "Bearer prefix.secret"
Path Parameters
Source ID
"HydraDoc1234"
Body
Metadata update request
Free-form key-value pairs to merge into the source's additional_metadata. The only accepted spelling for document metadata on this endpoint. Capped at 1 KiB, measured on the compact JSON encoding of the whole map in UTF-8 bytes — keys, quotes, commas and braces count toward the budget. Over-cap returns 400 with the actual byte count.
Collection scope. Defaults to the default collection when omitted. Formerly sub_tenant_id; the sub_tenant_id alias is still accepted (deprecated).
"team_docs"
Database/Collection are the canonical v2 names; TenantID/SubTenantID are their deprecated aliases. The TenantAliases middleware reconciles them in the request body before binding, so the handler reads TenantID/SubTenantID.
"acme_corp"
Schema-backed metadata fields to merge into the source's metadata (database metadata). Canonical name; tenant_metadata is a deprecated alias. Capped at 16 KiB, measured on the compact JSON encoding of the whole map in UTF-8 bytes — keys, quotes, commas and braces count toward the budget. Over-cap returns 400 with the actual byte count.
Not accepted on this endpoint. Sending any non-null value returns 400 (document_metadata is not accepted; use additional_metadata), regardless of size. Use additional_metadata instead. Accepted as an alias on /context/ingest only.
deprecated: use collection
"sub_tenant_4567"
deprecated: use database
"tenant_1234"
Deprecated alias for database_metadata, still accepted here; database_metadata wins when both are sent. Capped at 16 KiB, measured on the compact JSON encoding of the whole map in UTF-8 bytes — keys, quotes, commas and braces count toward the budget. Over-cap returns 400 with the actual byte count.
