Skip to main content
POST
/
api
/
v2
/
tenants
/
{tenant}
/
databases
/
{database}
/
collections
/
{collection_id}
/
upsert
Python
collection.upsert(ids=['id1', 'id2'], embeddings=[[0.1, 0.2], [0.3, 0.4]], documents=['doc1', 'doc2'])
{}

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

Body

application/json

Payload for upserting records in a collection.

Upsert creates records if they don't exist, or updates them if they do. Records are added in batches. All arrays must have the same length, with each index representing a single record. For example, ids[0], embeddings[0], documents[0], etc. all belong to the same record.

embeddings
required

Embeddings for each record. Can contain the raw f32 arrays or base64 encoded strings.

ids
string[]
required
documents
(string | null)[] | null
metadatas
(null | object)[] | null
uris
(string | null)[] | null

Response

Records upserted successfully

The response is of type object.