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

# Purge records

> Deletes a config's records in bulk, leaving the config itself in place. Without space_id or folder the config's whole record range is dropped in one operation. With either, only matching records are removed: the records are read a page at a time and each page's matches are deleted in concurrent batches. One call empties the scope — there is no cursor for the caller to follow — unless the reply carries `truncated`, which means records remain and the same call resumes the purge. Refused with 409 on a set that keeps history: delete its records singly, or delete the set.



## OpenAPI

````yaml /api-reference/endpoint/records/openapi.json delete /records/{config_id}/purge
openapi: 3.1.0
info:
  title: Records API
  version: 1.1.0
  description: >-
    Record configurations (schemas, views, versions) and the records that
    conform to them. Record IDs are server-generated, config IDs are
    client-supplied (`^[a-zA-Z0-9_-]+$`). Configs and records are updated with
    PUT: a config update applies only the fields sent, a record update merges
    `data`. Editing a config schema does not retroactively re-validate existing
    records. Publish a config version to snapshot the stored config; list and
    read versions to see its history.
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Record Configs
    description: >-
      Manage record configuration schemas. Each configuration defines the
      structure (fields, types, validation rules) that records must conform to.
  - name: Records
    description: >-
      Manage individual data records. Each record belongs to exactly one
      configuration and its data is validated against that configuration's
      schema.
  - name: Record Config Collections
    description: Groups of record configs.
  - name: Record Config Versions
    description: Published snapshots of a record config.
  - name: Record History
    description: The change history of a record.
  - name: Record Assessment
  - name: Strategy and Simulation
  - name: Record Metrics
paths:
  /records/{config_id}/purge:
    parameters:
      - name: config_id
        in: path
        required: true
        description: ID of the record configuration whose records are purged
        schema:
          type: string
    delete:
      tags:
        - Records
      summary: Purge records
      description: >-
        Deletes a config's records in bulk, leaving the config itself in place.
        Without space_id or folder the config's whole record range is dropped in
        one operation. With either, only matching records are removed: the
        records are read a page at a time and each page's matches are deleted in
        concurrent batches. One call empties the scope — there is no cursor for
        the caller to follow — unless the reply carries `truncated`, which means
        records remain and the same call resumes the purge. Refused with 409 on
        a set that keeps history: delete its records singly, or delete the set.
      operationId: purgeRecords
      parameters:
        - name: space_id
          in: query
          required: false
          description: Purge only records in this space
          schema:
            type: string
        - name: folder
          in: query
          required: false
          description: >-
            Purge only records in this folder. Matched against the record's own
            folder, not parent_folder.
          schema:
            type: string
      responses:
        '200':
          description: >-
            Purge outcome. A 200 with a non-empty `failed` is a partial purge,
            not a failure.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Response'
                  - properties:
                      body:
                        $ref: '#/components/schemas/PurgeRecordsResult'
        '400':
          description: Missing config_id, or the records could not be read or deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Record configuration not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            The record set keeps history; a bulk purge would write no delete
            events
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Response:
      type: object
      properties:
        status_code:
          type: integer
          description: HTTP status code echoed in the response body.
        body:
          type: object
          description: Response payload.
    PurgeRecordsResult:
      type: object
      description: >-
        `scanned` and `purged` are equal only on an unscoped purge, which
        deletes without reading. Failed records are left in place; a retry with
        the same scope picks them up.
      properties:
        config_id:
          type: string
        space_id:
          type: string
        folder:
          type: string
        scanned:
          type: integer
          description: >-
            Records read to answer the scope. On an unscoped purge, the records
            the config held.
        purged:
          type: integer
        failed:
          type: array
          description: IDs of records whose delete or de-index was refused.
          items:
            type: string
        truncated:
          type: boolean
          description: >-
            The purge stopped short of its scope: records remain, and the same
            call run again carries on from where it left off. Absent or false
            means the scope is empty.
    ErrorResponse:
      type: object
      properties:
        status_code:
          type: integer
        body:
          type: object
          properties:
            error:
              type: string
              description: Human-readable error message.
      example:
        status_code: 400
        body:
          error: field 'rating' is required
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.