Use ChromaDB API
Configure input fields auto-fill
Section titled “Configure input fields auto-fill”Use the following input fields to auto-fill your configuration in API reference examples.
Read collection data
Section titled “Read collection data”List all collections
Section titled “List all collections”GET /api/v1/collections route to list all collections.
curl -X GET -v \ {SERVER_URL}/api/v1/collections \ -H "Authorization: Bearer {AUTH_TOKEN}"Count items in collection
Section titled “Count items in collection”GET /api/v1/collections/{COLLECTION_ID}/count route to count items in a collection.
curl -X GET -v \ {SERVER_URL}/api/v1/collections/{COLLECTION_ID}/count \ -H "Authorization: Bearer {AUTH_TOKEN}"Peek first item in collection
Section titled “Peek first item in collection”POST /api/v1/collections/{COLLECTION_ID}/get route to peek at the first item in a collection.
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 }'Create or delete collections
Section titled “Create or delete collections”Create collection
Section titled “Create collection”POST /api/v1/collections route to create a new collection using cosine similarity.
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 collection
Section titled “Delete collection”DELETE /api/v1/collections/{COLLECTION_NAME} route to delete a collection.
curl -X DELETE -v \ {SERVER_URL}/api/v1/collections/{COLLECTION_NAME} \ -H "Authorization: Bearer {AUTH_TOKEN}"Advanced operations
Section titled “Advanced operations”Copy collection contents to another collection
Section titled “Copy collection contents to another collection”- POST
/api/v1/collections/{COLLECTION_ID}/getto get entire collection contents. - POST
/api/v1/collections/{TARGET_COLLECTION_ID}/addto insert contents into another collection.
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