> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trychroma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update records

> Updates records in a collection by ID.



## OpenAPI

````yaml https://api.trychroma.com/openapi.json post /api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/update
openapi: 3.1.0
info:
  title: chroma-frontend
  description: ''
  license:
    name: ''
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/update:
    post:
      tags:
        - Record
      summary: Update records
      description: Updates records in a collection by ID.
      operationId: collection_update
      parameters:
        - name: tenant
          in: path
          description: Tenant UUID
          required: true
          schema:
            type: string
          example: 1e30d217-3d78-4f8c-b244-79381dc6a254
        - name: database
          in: path
          description: Database name
          required: true
          schema:
            type: string
        - name: collection_id
          in: path
          description: Collection UUID
          required: true
          schema:
            type: string
          example: 1e30d217-3d78-4f8c-b244-79381dc6a254
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCollectionRecordsPayload'
        required: true
      responses:
        '200':
          description: Collection updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateCollectionRecordsResponse'
        '404':
          description: Collection not found
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - label: Update records
          lang: typescript
          source: >-
            await collection.update({ ids: ['id1'], documents: ['updated doc'],
            metadatas: [{ key: 'value' }] });
        - label: Update records
          lang: python
          source: >-
            collection.update(ids=['id1'], documents=['updated doc'],
            metadatas=[{'key': 'value'}])
        - label: Update records
          lang: rust
          source: >-
            use chroma_types::UpdateMetadata;

            let mut metadata = UpdateMetadata::new();

            metadata.insert("key".to_string(),
            chroma_types::UpdateMetadataValue::Str("value".to_string()));

            collection.update(
                vec!["id1".to_string()],
                None,
                Some(vec![Some("updated doc".to_string())]),
                None,
                Some(vec![Some(metadata)])
            ).await?;
components:
  schemas:
    UpdateCollectionRecordsPayload:
      type: object
      description: >-
        Payload for updating existing records in a collection.


        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.
      required:
        - ids
      properties:
        documents:
          type:
            - array
            - 'null'
          items:
            type:
              - string
              - 'null'
        embeddings:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/UpdateEmbeddingsPayload'
              description: >-
                Updated embeddings for each record. Can contain the raw f32
                arrays or base64 encoded strings.
        ids:
          type: array
          items:
            type: string
        metadatas:
          type:
            - array
            - 'null'
          items:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/HashMap'
        uris:
          type:
            - array
            - 'null'
          items:
            type:
              - string
              - 'null'
    UpdateCollectionRecordsResponse:
      type: object
    UpdateEmbeddingsPayload:
      oneOf:
        - type: array
          items:
            type:
              - array
              - 'null'
            items:
              type: number
              format: float
        - type: array
          items:
            type:
              - string
              - 'null'
    HashMap:
      type: object
      additionalProperties:
        oneOf:
          - type: boolean
          - type: integer
            format: int64
          - type: number
            format: double
          - type: string
          - $ref: '#/components/schemas/SparseVector'
          - type: array
            items:
              type: boolean
          - type: array
            items:
              type: integer
              format: int64
          - type: array
            items:
              type: number
              format: double
          - type: array
            items:
              type: string
      propertyNames:
        type: string
    SparseVector:
      type: object
      description: >-
        Represents a sparse vector using parallel arrays for indices and values.


        On deserialization: accepts both old format `{"indices": [...],
        "values": [...]}`

        and new format `{"#type": "sparse_vector", "indices": [...], "values":
        [...]}`.


        On serialization: always includes `#type` field with value
        `"sparse_vector"`.
      required:
        - indices
        - values
      properties:
        indices:
          type: array
          items:
            type: integer
            format: int32
            minimum: 0
          description: Dimension indices
        tokens:
          type:
            - array
            - 'null'
          items:
            type: string
          description: Tokens corresponding to each index
        values:
          type: array
          items:
            type: number
            format: float
          description: Values corresponding to each index
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-chroma-token

````