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

# Delete records

> Deletes records in a collection. Can filter by IDs or metadata.



## OpenAPI

````yaml https://api.trychroma.com/openapi.json post /api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/delete
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}/delete:
    post:
      tags:
        - Record
      summary: Delete records
      description: Deletes records in a collection. Can filter by IDs or metadata.
      operationId: collection_delete
      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/DeleteCollectionRecordsPayload'
        required: true
      responses:
        '200':
          description: Records deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteCollectionRecordsResponse'
        '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: Delete records by IDs
          lang: typescript
          source: 'await collection.delete({ ids: [''id1'', ''id2''] });'
        - label: Delete records by metadata filter
          lang: typescript
          source: 'await collection.delete({ where: { category: ''old'' } });'
        - label: Delete records by IDs
          lang: python
          source: collection.delete(ids=['id1', 'id2'])
        - label: Delete records by metadata filter
          lang: python
          source: 'collection.delete(where={''category'': ''old''})'
        - label: Delete records by IDs
          lang: rust
          source: >-
            collection.delete(Some(vec!["id1".to_string(), "id2".to_string()]),
            None).await?;
        - label: Delete records by metadata filter
          lang: rust
          source: >-
            use chroma_types::{Where, MetadataExpression, MetadataComparison,
            MetadataValue, PrimitiveOperator};

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

            collection.delete(None, Some(where_clause)).await?;
components:
  schemas:
    DeleteCollectionRecordsPayload:
      allOf:
        - $ref: '#/components/schemas/RawWhereFields'
        - type: object
          properties:
            ids:
              type:
                - array
                - 'null'
              items:
                type: string
            limit:
              type:
                - integer
                - 'null'
              format: int32
              minimum: 0
      description: >-
        Payload for deleting records from a collection.


        Records can be deleted by their IDs or by a metadata filter. At least
        one of `ids` or `where`

        must be provided.
    DeleteCollectionRecordsResponse:
      type: object
      properties:
        deleted:
          type: integer
          format: int32
          minimum: 0
    ErrorResponse:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
        message:
          type: string
    RawWhereFields:
      type: object
      properties:
        where: {}
        where_document: {}
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-chroma-token

````