PrimeThink Documentation Help

API: Use metadata in collections

When using collections via the api, it's possible to add metadata to the documents uploaded to the collection.

This will allow you to use the metadata to filter the documents within the collection when searching into the collection.

Example:

  1. Upload a text document to the collection.

curl -X "POST" "https://api.primethink.ai/api/v1/collections/<collection_id>/texts" \ -H 'Authorization: <auth>' \ -H 'Content-Type: application/json' \ -d $'[ { "name": "My report", "text": "report text", "metadata": "{\\"year\\":\\"\2025\"}" } ]'

Here we have added a metadata field called "year" with the value "2025".

Now let's say we want to search only the 2025 reports in the collection:

curl -X "POST" "https://api.primethink.ai/api/v1/collections/<collection_id>/search?query=<my_query>" \ -H 'Authorization: <auth>' \ -H 'Content-Type: application/json; charset=utf-8' \ -d $'{ "extra": { "year": "2025" } }'
12 July 2025