Skip to content

Use ChromaDB API

Use the following input fields to auto-fill your configuration in API reference examples.

GET /api/v1/collections route to list all collections.

Terminal window
curl -X GET -v \
{SERVER_URL}/api/v1/collections \
-H "Authorization: Bearer {AUTH_TOKEN}"

GET /api/v1/collections/{COLLECTION_ID}/count route to count items in a collection.

Terminal window
curl -X GET -v \
{SERVER_URL}/api/v1/collections/{COLLECTION_ID}/count \
-H "Authorization: Bearer {AUTH_TOKEN}"

POST /api/v1/collections/{COLLECTION_ID}/get route to peek at the first item in a collection.

Terminal window
curl -X POST -v \
{SERVER_URL}/api/v1/collections/{COLLECTION_ID}/get \
-H "Authorization: Bearer {AUTH_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"limit": 1
}'

POST /api/v1/collections route to create a new collection using cosine similarity.

Terminal window
curl -X POST -v \
{SERVER_URL}/api/v1/collections \
-H "Authorization: Bearer {AUTH_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"name": "{COLLECTION_NAME}",
"metadata": {
"hnsw:space": "cosine"
},
"get_or_create": true
}'

DELETE /api/v1/collections/{COLLECTION_NAME} route to delete a collection.

Terminal window
curl -X DELETE -v \
{SERVER_URL}/api/v1/collections/{COLLECTION_NAME} \
-H "Authorization: Bearer {AUTH_TOKEN}"

Copy collection contents to another collection

Section titled “Copy collection contents to another collection”
  • POST /api/v1/collections/{COLLECTION_ID}/get to get entire collection contents.
  • POST /api/v1/collections/{TARGET_COLLECTION_ID}/add to insert contents into another collection.
Terminal window
curl -X POST -v \
{SERVER_URL}/api/v1/collections/{COLLECTION_ID}/get \
-H "Authorization: Bearer {AUTH_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"include": [ "embeddings", "documents", "metadatas" ]
}' \
> collection.json
curl -X POST -v \
{SERVER_URL}/api/v1/collections/{TARGET_COLLECTION_ID}/add \
-H "Authorization: Bearer {AUTH_TOKEN}" \
-H "Content-Type: application/json" \
-d @collection.json