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

# Wipe Entity Table

> Delete every record in one database table at once, for example to reset a table between test imports. First call it without expected_count: nothing is deleted and matched_count says how many records the table holds. Show that count to the user and get confirmation, then call it again with expected_count set to that count. If the table changed in between, the call fails with FAILED_PRECONDITION and nothing is deleted. Otherwise every record is deleted in one transaction and wiped_count is returned. The audit log gets one table-wiped event, not one event per record. Refused with FAILED_PRECONDITION for tables with workflow rules (use Delete Entities By Filter, or Delete Entities for before-save workflows), tables over 200,000 records or with validation checks on deletes (use Delete Entities By Filter), tables with child tables (empty the child tables first), and callers who may delete only some of the table's records.

## Authentication and permissions

> **Token requirements:** **User-based token (OAuth)** or **Organization-scoped API key** or **Workspace-scoped API key**.
>
> Send a bearer access token for one of these identities. The permissions and resource restrictions below also apply.

| Credential | Access requirements |
| - | - |
| Organization-scoped API key | `entities:write` |
| Workspace-scoped API key | `entities:write` |
| User-based token (OAuth) | Supported, subject to permissions |

Permissions joined by **+** are all required; **or** separates alternatives. Full-access keys still cannot call endpoints marked unsupported. Workspace keys must allow every workspace checked by the request. OAuth access depends on the user’s roles and resource access.

* **Wipe a table in a workspace's database:** Owner-only: the permission is checked on the table's owning workspace. Worker tokens are refused. Refused when the caller may delete only some of the table's records.


## OpenAPI

````yaml /sections/api-reference/openapi-spec-v2.yaml post /v2/entities/wipe-table
openapi: 3.1.0
info:
  title: Serval Public API
  description: Serval Public API
  contact:
    name: Serval
    url: https://serval.com
    email: support@serval.com
  license:
    name: Serval License
    url: https://serval.com/license
  version: 2.0.0
servers:
  - url: https://public.api.serval.com
security:
  - BearerAuth: []
tags:
  - name: Access Membership API
  - name: Access Policy API
  - name: Access Policy Approval Procedure API
  - name: Access Profile API
  - name: Access Relationship API
  - name: Access Request API
  - name: Agent API
  - name: Alerts API
  - name: Analytics API
  - name: App Instance API
  - name: App Resource API
  - name: App Resource Role API
  - name: Approval Delegation API
  - name: Approval Procedure API
  - name: Approval Request API
  - name: Assignment Rules API
  - name: Audit Log API
  - name: Billing API
  - name: Browser API
  - name: Campaign API
  - name: Catalog Categories API
  - name: Change Blackout API
  - name: Change Model API
  - name: Connected Channels API
  - name: Custom Field API
  - name: Custom Role API
  - name: Custom Service API
  - name: Dashboards API
  - name: Email Intake API
  - name: Entity API
  - name: Entity Field Mapping API
  - name: Entity Ingestion Config API
  - name: Entity Type API
  - name: Folder API
  - name: Forms
  - name: Forms API
  - name: Group API
  - name: Guidance API
  - name: Help Agent API
  - name: Improvement Request API
  - name: Journey API
  - name: Knowledge API
  - name: Knowledge Base API
  - name: One-Time Window API
  - name: Package API
  - name: Platform Migration API
  - name: Project API
  - name: Report API
  - name: Review API
  - name: Role Sync API
  - name: Roles API
  - name: SLA API
  - name: Schedule API
  - name: Skills API
  - name: Tag API
  - name: Ticket API
  - name: Ticket Import API
  - name: Ticket Type API
  - name: Topic API
  - name: User API
  - name: User Relationship API
  - name: Widgets API
  - name: Worker API
  - name: Workflow API
  - name: Workflow Approval Procedure API
  - name: Workflow Run API
  - name: Workspace API
  - name: Workspace Group API
  - name: Workspace SDLC Settings API
  - name: Workspace User API
paths:
  /v2/entities/wipe-table:
    post:
      tags:
        - Entity API
      summary: Wipe Entity Table
      description: >-
        Delete every record in one database table at once, for example to reset
        a table between test imports. First call it without expected_count:
        nothing is deleted and matched_count says how many records the table
        holds. Show that count to the user and get confirmation, then call it
        again with expected_count set to that count. If the table changed in
        between, the call fails with FAILED_PRECONDITION and nothing is deleted.
        Otherwise every record is deleted in one transaction and wiped_count is
        returned. The audit log gets one table-wiped event, not one event per
        record. Refused with FAILED_PRECONDITION for tables with workflow rules
        (use Delete Entities By Filter, or Delete Entities for before-save
        workflows), tables over 200,000 records or with validation checks on
        deletes (use Delete Entities By Filter), tables with child tables (empty
        the child tables first), and callers who may delete only some of the
        table's records.
      operationId: svrelay.publicv2.PublicAPIServiceV2.WipeEntityTable
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/svstore.publicapi.WipeEntityTableRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/svstore.publicapi.WipeEntityTableResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    svstore.publicapi.WipeEntityTableRequest:
      type: object
      properties:
        teamId:
          type: string
          title: team_id
          description: The ID of the workspace that owns the table.
          x-stainless-terraform-configurability: required
        entityTypeId:
          type: string
          title: entity_type_id
          x-stainless-terraform-configurability: required
        expectedCount:
          type:
            - integer
            - string
            - 'null'
          title: expected_count
          format: int64
          description: >-
            Omit to only count the table's records. Set it to the matched_count
            of a
             previous call to wipe the table; if the count has changed since, the call
             fails with FAILED_PRECONDITION and nothing is deleted.
          x-stainless-terraform-configurability: optional
      title: WipeEntityTableRequest
      required:
        - teamId
        - entityTypeId
      additionalProperties: false
    svstore.publicapi.WipeEntityTableResponse:
      type: object
      properties:
        matchedCount:
          type:
            - integer
            - string
          title: matched_count
          format: int64
          x-stainless-terraform-configurability: optional
        wipedCount:
          type:
            - integer
            - string
          title: wiped_count
          format: int64
          description: >-
            How many records the wipe deleted; 0 when expected_count was
            omitted.
          x-stainless-terraform-configurability: optional
      title: WipeEntityTableResponse
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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