Update Document Metadata
PATCHhttps://api.filesearch.dev/v3/collections/:collection_name/documents/:document_id/metadata
Merge keys into a document's custom_metadata without restating the whole object; a null value deletes its key. Use PUT instead to replace the stored object wholesale.
Path parameters
collection_namestringRequired
document_idstringRequired
Request
This endpoint expects an object.
custom_metadatamap from strings to anyOptional
The custom metadata object. Keys that Captain uses for its own chunk attributes are reserved and rejected with 400.
metadatamap from strings to anyOptionalDeprecated
Deprecated alias for custom_metadata.
Response
Update Document Metadata response.
document_idstring
custom_metadatamap from strings to anyOptional
filterablebooleanOptionalDefaults to
falseupdated_atstring or nullOptional
Errors
PATCH/v3/collections/:collection_name/documents/:document_id/metadata
import json
import requests
import uuid
BASE_URL = "https://api.filesearch.dev"
API_KEY = "your_api_key"
COLLECTION_NAME = "my_documents"
DOCUMENT_ID = "b3f9a1c2d4e5f60718293a4b5c6d7e8f"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
"Idempotency-Key": str(uuid.uuid4()),
}
response = requests.patch(
f"{BASE_URL}/v3/collections/{COLLECTION_NAME}/documents/{DOCUMENT_ID}/metadata",
headers=headers,
json={
"custom_metadata": {
"reviewed": "yes",
"draft_flag": null
}
},
timeout=30.0
)
print(json.dumps(response.json(), indent=2))200Updated
{
"document_id": "b3f9a1c2d4e5f60718293a4b5c6d7e8f",
"custom_metadata": {
"external_id": "doc_18842",
"client": "acme-lending",
"reviewed": "yes"
},
"filterable": true,
"updated_at": null
}Was this page helpful?