Skip to content

Updating Documents

You can use the Update Document endpoint to update your documents. This page provides additional information on how this endpoint functions.

Partial updates

Only the fields included in your Update Document request will be updated. All other fields will retain their existing values.

This allows you to easily update specific fields without impacting the rest of the document.

Token usage

Updating a document will consume semantic tokens if any of these fields are included in your API request:

  • title
  • content
  • language

Updating a document will not consume tokens if only the other fields are updated.

Setting fields to null

You can set the following fields of a document to null by passing them a null value:

  • content
  • metadata
  • source_uri

For all other fields, null is not a valid value, and passing null will not update the existing values of those fields.

Metadata update logic

For the metadata field of a document:

  • New key-value pairs will be merged with the existing ones.
  • Passing new values for existing keys will overwrite the old values.
  • To unset individual keys, pass a null value for them.
  • To clear all metadata, pass null for the entire metadata field.