> ## 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.

# Get records

> Returns records from a collection by ID or metadata filter.



## OpenAPI

````yaml https://api.trychroma.com/openapi.json post /api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/get
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}/get:
    post:
      tags:
        - Record
      summary: Get records
      description: Returns records from a collection by ID or metadata filter.
      operationId: collection_get
      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/GetRequestPayload'
        required: true
      responses:
        '200':
          description: Records retrieved from the collection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetResponse'
              example:
                documents:
                  - Document 1
                  - Document 2
                embeddings:
                  - - 0.1
                    - 0.2
                    - 0.3
                  - - 0.4
                    - 0.5
                    - 0.6
                ids:
                  - record1
                  - record2
                include:
                  - documents
                  - metadatas
                  - embeddings
                metadatas:
                  - key: value
                  - key2: value2
                uris: null
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Collection not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - label: Get records by IDs
          lang: typescript
          source: 'const results = await collection.get({ ids: [''id1'', ''id2''] });'
        - label: Get records by metadata filter
          lang: typescript
          source: >-
            const results = await collection.get({ where: { category: 'science'
            }, limit: 10 });
        - label: Get records by IDs
          lang: python
          source: results = collection.get(ids=['id1', 'id2'])
        - label: Get records by metadata filter
          lang: python
          source: 'results = collection.get(where={''category'': ''science''}, limit=10)'
        - label: Get records by IDs
          lang: rust
          source: |-
            use chroma_types::IncludeList;
            let response = collection.get(
                Some(vec!["id1".to_string(), "id2".to_string()]),
                None,
                None,
                None,
                Some(IncludeList::default_get())
            ).await?;
        - label: Get records by metadata filter
          lang: rust
          source: >-
            use chroma_types::{Where, MetadataExpression, MetadataComparison,
            MetadataValue, PrimitiveOperator, IncludeList};

            let where_clause = Where::Metadata(MetadataExpression {
                key: "category".to_string(),
                comparison: MetadataComparison::Primitive(PrimitiveOperator::Equal, MetadataValue::Str("science".to_string())),
            });

            let response = collection.get(None, Some(where_clause), Some(10),
            None, None).await?;
components:
  schemas:
    GetRequestPayload:
      allOf:
        - $ref: '#/components/schemas/RawWhereFields'
        - type: object
          properties:
            ids:
              type:
                - array
                - 'null'
              items:
                type: string
            include:
              $ref: '#/components/schemas/IncludeList'
            limit:
              type:
                - integer
                - 'null'
              format: int32
              minimum: 0
            offset:
              type:
                - integer
                - 'null'
              format: int32
              minimum: 0
      description: >-
        Records can be retrieved by their IDs or by a metadata filter. At least
        one of `ids` or `where`

        must be provided. Use `include` to specify which fields to return in the
        response.
    GetResponse:
      type: object
      description: >-
        All arrays have the same length, with each index representing a single
        record.

        Only fields specified in the request's `include` parameter are
        populated.
      required:
        - ids
        - include
      properties:
        documents:
          type:
            - array
            - 'null'
          items:
            type:
              - string
              - 'null'
        embeddings:
          type:
            - array
            - 'null'
          items:
            type: array
            items:
              type: number
              format: float
        ids:
          type: array
          items:
            type: string
        include:
          type: array
          items:
            $ref: '#/components/schemas/Include'
          description: List of fields that were included in this response.
        metadatas:
          type:
            - array
            - 'null'
          items:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/HashMap'
        uris:
          type:
            - array
            - 'null'
          items:
            type:
              - string
              - 'null'
    ErrorResponse:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
        message:
          type: string
    RawWhereFields:
      type: object
      properties:
        where: {}
        where_document: {}
    IncludeList:
      type: array
      items:
        $ref: '#/components/schemas/Include'
    Include:
      type: string
      description: >-
        Use this enum to specify which fields should be returned when retrieving
        records.
      enum:
        - distances
        - documents
        - embeddings
        - metadatas
        - uris
    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

````