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

# Permanently erase a past version

> Root and admin only, whatever `history.edit_roles` says. Secure-deletes the version's put message and every amend event holding a copy of its data; a redact stub stays in the timeline so the timeline still shows a version existed. Idempotent — safe to retry after a partial failure; erasing an already-hidden version upgrades the hide. POST rather than DELETE because a reason is required and the gateway only forwards a body reliably on POST/PUT. Erasing the record's current version also reverts it to the newest earlier visible version.



## OpenAPI

````yaml /api-reference/endpoint/records/openapi.json post /records/{config_id}/{id}/history/{version}/erase
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}/{id}/history/{version}/erase:
    post:
      tags:
        - Record History
      summary: Permanently erase a past version
      description: >-
        Root and admin only, whatever `history.edit_roles` says. Secure-deletes
        the version's put message and every amend event holding a copy of its
        data; a redact stub stays in the timeline so the timeline still shows a
        version existed. Idempotent — safe to retry after a partial failure;
        erasing an already-hidden version upgrades the hide. POST rather than
        DELETE because a reason is required and the gateway only forwards a body
        reliably on POST/PUT. Erasing the record's current version also reverts
        it to the newest earlier visible version.
      operationId: eraseRecordHistoryVersion
      parameters:
        - name: config_id
          in: path
          required: true
          description: ID of the record configuration that the record belongs to
          schema:
            type: string
        - name: id
          in: path
          required: true
          description: Record ID
          schema:
            type: string
        - name: version
          in: path
          required: true
          description: >-
            The put event's version to act on. A deletion cannot be amended,
            hidden, erased or restored (400 history_target_not_put).
          schema:
            type: integer
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecordHistoryReasonRequest'
      responses:
        '200':
          description: Version erased.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Response'
                  - properties:
                      body:
                        $ref: '#/components/schemas/RecordHistoryVersionResponse'
        '400':
          description: >-
            Missing/invalid config_id, id or version;
            `{"code":"history_target_not_put"}` — a delete event cannot be
            erased; `{"code":"history_reason_required"}` /
            `{"code":"history_reason_too_long"}` for `reason`, which is required
            here.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: No caller identity on the request token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            `{"code":"history_forbidden"}` — erase is root/admin only regardless
            of `history.edit_roles`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            Record configuration not found, or
            `{"code":"history_version_not_found"}`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            `{"code":"history_no_visible_version"}` — this is the current
            version and there is no earlier visible version to revert to; delete
            the record instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            `{"code":"history_write_failed"}` — the redact stub could not be
            written; nothing was deleted. `{"code":"history_erase_failed"}` —
            the stub was written but the secure delete did not complete; body
            carries `{"stub_written": true}` and the same call can be retried.
            `{"code":"history_restore_failed"}` — erased but the record could
            not be reverted to the previous version; body carries `{"erased":
            true}` (or, if the revert landed but its own history event failed to
            write, `{"code":"history_write_failed"}` with `record` in the body).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    RecordHistoryReasonRequest:
      type: object
      description: >-
        Body of POST .../hide, .../erase and .../restore. An empty or omitted
        body is treated as no reason. `reason` is required for hide and erase
        (400 history_reason_required when empty after trimming,
        history_reason_too_long over 500 characters); optional for restore,
        where it is only echoed back in the response and stored nowhere.
      properties:
        reason:
          type: string
          maxLength: 500
          description: Free text, 1-500 characters after trimming.
      example:
        reason: Correcting a data entry error
    Response:
      type: object
      properties:
        status_code:
          type: integer
          description: HTTP status code echoed in the response body.
        body:
          type: object
          description: Response payload.
    RecordHistoryVersionResponse:
      type: object
      description: 200 body of POST .../hide and .../erase.
      properties:
        config_id:
          type: string
        record_id:
          type: string
        version:
          type: integer
          description: The version acted on.
        hidden:
          type: boolean
        erased:
          type: boolean
          description: Present (true) only on the erase reply.
        restored:
          allOf:
            - $ref: '#/components/schemas/Record'
          description: >-
            The record after being reverted to the previous visible version —
            present only when the acted-on version was the record's current one.
            null otherwise, and null on an erase's idempotent re-run.
      example:
        config_id: exchange_rates
        record_id: aB3xY9k2Lm
        version: 4
        hidden: true
        restored: null
    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
    Record:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier. Auto-generated if not provided on creation.
        config_id:
          type: string
          description: ID of the RecordConfig that defines this record's schema.
        data:
          type: object
          additionalProperties: true
          description: >-
            Key-value map of field values. Keys correspond to SchemaField IDs.
            Values must match the field type defined in the schema. Extra keys
            not defined in the schema are permitted.
        created_at:
          type: string
          format: date-time
          readOnly: true
          description: ISO 8601 timestamp set automatically on creation.
        updated_at:
          type: string
          format: date-time
          readOnly: true
          description: ISO 8601 timestamp updated automatically on every modification.
  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.