Skip to main content
PATCH
Update one existing source’s metadata or ACL without re-ingesting its content. Changes also apply to the indexed chunks used by Query and List Context. See Metadata Filters for the metadata workflow.
id is the ID you supplied at ingest, or the source ID HydraDB returned. The route PATCH /context/sources/{source_id}/metadata is a deprecated alias that still works; migrate to the route above. source_id and id identify the same source.

Request rules

  • collection is required. This endpoint does not default it.
  • At least one of database_metadata, additional_metadata, acl, or acl_inherit: true is required.
  • acl combined with acl_inherit: true is invalid. acl_inherit: false or omitted is a no-op and can accompany acl. Inheritance is rejected for uploads and sources without connector resource attribution.
  • database_metadata merges into the source’s metadata, and its keys must satisfy the database metadata schema when one exists. additional_metadata merges into the source’s free-form additional_metadata.
  • The endpoint does not accept metadata or document_metadata.

How updates apply

  • Metadata keys included in the request are added or overwritten. Omitted keys keep their existing values.
  • Sending acl replaces the entire stored ACL, so send the complete new list. [] or null revokes access for everyone. Omit acl to keep the stored list. See Query.
  • Sending acl_inherit: true removes the source’s own ACL and immediately uses its connector resource permissions. This can widen access. Later connector syncs can replace the ACL because ACL writes use last-writer-wins behavior. See Restore resource permissions.
  • 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 /query metadata filters and /context/list filters.
  • If an edited database metadata field has enable_dense_embedding or enable_sparse_embedding, HydraDB synchronously refreshes the relevant metadata search index and the response has vector_sync_required: true. Otherwise no vector refresh is needed and vector_sync_required is false.

Partial failures

A 200 response can still report an incomplete edit:
  • vector_sync_error: The metadata was saved but the dense or sparse vector store sync failed. vector_synced is absent. Retry the same idempotent edit to converge.
  • partial_commit: The edit was saved in one store but a later write failed. Retry the same edit.
  • vector_acl_synced absent after an acl edit: The new list is still enforced, but an added principal may miss this source in results until it is re-indexed.

Validation and errors

Size limits

database_metadata is capped at 16 KiB. additional_metadata is capped at 1 KiB. See metadata size limits for how HydraDB measures these caps. Limits apply to the request payload, before merging with stored metadata. An oversized request returns 400 with the actual and maximum sizes:

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

context_id of the context to update.

Example:

"HydraDoc1234"

Body

application/json

Metadata update request

acl
string[]

Replaces the context's access-control list. Send the full list, [] or null for private, or ["__public__"] for every identified caller. Omit to leave it unchanged.

additional_metadata
object

Free-form values merged into the context's additional_metadata. At most 1 KiB as compact JSON.

Example:
collection
string

Collection that holds the context. Required; this endpoint does not default it. Formerly sub_tenant_id.

Example:

"team_docs"

database
string

Database that holds the context. Required. Formerly tenant_id.

Example:

"acme_corp"

database_metadata
object

Values merged into the context's metadata. Keys must be declared in the schema when there is one. At most 16 KiB as compact JSON.

Example:
document_metadata
object
deprecated

Deprecated: not accepted here; any non-null value returns 400. Use additional_metadata.

sub_tenant_id
string
deprecated

Deprecated: use collection.

Example:

"sub_tenant_4567"

tenant_id
string
deprecated

Deprecated: use database.

Example:

"tenant_1234"

tenant_metadata
object
deprecated

Deprecated: use database_metadata. Still accepted; database_metadata wins when both are sent.

Example:

Response

OK

data
GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult · object
Example:
error
HandlerApiError · object | null

Error details on failure, or null on success.

Example:

null

meta
HandlerResponseMeta · object
Example:
success
boolean

Whether the request succeeded.

Example:

true