Skip to main content
POST
/
api
/
v2
/
tenants
/
{tenant}
/
databases
/
{database}
/
collections
/
{collection_id}
/
query
curl --request POST \
--url https://api.trychroma.com/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/query \
--header 'Content-Type: application/json' \
--header 'x-chroma-token: <api-key>' \
--data '
{
"include": [
"documents",
"metadatas",
"distances"
],
"n_results": 10,
"query_embeddings": [
[
0.1,
0.2,
0.3
]
]
}
'
{
  "ids": [
    [
      "<string>"
    ]
  ],
  "include": [
    "distances"
  ],
  "distances": [
    [
      123
    ]
  ],
  "documents": [
    [
      "<string>"
    ]
  ],
  "embeddings": [
    [
      [
        123
      ]
    ]
  ],
  "metadatas": [
    [
      "<unknown>"
    ]
  ],
  "uris": [
    [
      "<string>"
    ]
  ]
}

Authorizations

x-chroma-token
string
header
required

Path Parameters

tenant
string
required

Tenant UUID

database
string
required

Database name

collection_id
string
required

Collection UUID

Query Parameters

limit
integer<int32>

Limit for pagination

Required range: x >= 1
offset
integer<int32>

Offset for pagination

Required range: x >= 0

Body

application/json

Query request payload

query_embeddings
number<float>[][]
required
where
any
where_document
any
ids
string[] | null
include
enum<string>[]

Use this enum to specify which fields should be returned when retrieving records.

Available options:
distances,
documents,
embeddings,
metadatas,
uris
n_results
integer<int32> | null
Required range: x >= 0

Response

Records matching the query

ids
string[][]
required
include
enum<string>[]
required

Use this enum to specify which fields should be returned when retrieving records.

Available options:
distances,
documents,
embeddings,
metadatas,
uris
distances
((number<float> | null)[])[] | null
documents
((string | null)[])[] | null
embeddings
((number<float>[] | null)[])[] | null
metadatas
((null | object)[])[] | null
uris
((string | null)[])[] | null