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

# Delete Entities

> Delete up to 100 database records from one table in a single transaction: either every record is deleted or none are. Use this instead of calling Delete Entity once per record; to delete more records, call it once per batch of 100. deleted_entity_ids lists the deleted records. When a before-save workflow holds the delete, pending_changes lists the held changes, nothing is deleted yet, and each record is deleted as its workflow approves it. A batch where before-save workflows match some records but not others fails with FAILED_PRECONDITION; split it so either every record matches at least one workflow or none do.

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

* **Delete a record in a workspace's database:** Owner-only: the permission is checked on the record's owning workspace. A caller admitted to the database only through a share cannot delete its records. Delete access to the record is also required; Read or Update alone does not allow deletion.


## OpenAPI

````yaml /sections/api-reference/openapi-spec-v2.yaml post /v2/entities/bulk-delete
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/bulk-delete:
    post:
      tags:
        - Entity API
      summary: Delete Entities
      description: >-
        Delete up to 100 database records from one table in a single
        transaction: either every record is deleted or none are. Use this
        instead of calling Delete Entity once per record; to delete more
        records, call it once per batch of 100. deleted_entity_ids lists the
        deleted records. When a before-save workflow holds the delete,
        pending_changes lists the held changes, nothing is deleted yet, and each
        record is deleted as its workflow approves it. A batch where before-save
        workflows match some records but not others fails with
        FAILED_PRECONDITION; split it so either every record matches at least
        one workflow or none do.
      operationId: svrelay.publicv2.PublicAPIServiceV2.DeleteEntities
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/svstore.publicapi.DeleteEntitiesRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/svstore.publicapi.DeleteEntitiesResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    svstore.publicapi.DeleteEntitiesRequest:
      type: object
      properties:
        entityIds:
          type: array
          items:
            type: string
          title: entity_ids
          description: >-
            Up to 100 record IDs from one table. Duplicate IDs are deleted once.
            The
             records are deleted in one transaction: either all are deleted or none
             are. Before-save workflows must match every record or none; a held
             delete is applied record by record as its workflows approve each one.
          x-stainless-terraform-configurability: required
      title: DeleteEntitiesRequest
      required:
        - entityIds
      additionalProperties: false
    svstore.publicapi.DeleteEntitiesResponse:
      type: object
      properties:
        deletedEntityIds:
          type: array
          items:
            type: string
          title: deleted_entity_ids
          x-stainless-terraform-configurability: optional
        pendingChanges:
          type: array
          items:
            $ref: '#/components/schemas/svstore.EntityPendingChange'
          title: pending_changes
          description: >-
            Set instead of deleted_entity_ids when a before-save workflow holds
            the delete.
          x-stainless-terraform-configurability: optional
      title: DeleteEntitiesResponse
      additionalProperties: false
    svstore.EntityPendingChange:
      type: object
      properties:
        id:
          type: string
          title: id
          x-stainless-terraform-configurability: optional
        entityId:
          type: string
          title: entity_id
          x-stainless-terraform-configurability: optional
        entityTypeId:
          type: string
          title: entity_type_id
          x-stainless-terraform-configurability: optional
        operation:
          $ref: '#/components/schemas/svstore.EntityChangeOperation'
          title: operation
          x-stainless-terraform-configurability: optional
        state:
          $ref: '#/components/schemas/svstore.EntityPendingChangeState'
          title: state
          x-stainless-terraform-configurability: optional
        entityWorkflowRuleIds:
          type: array
          items:
            type: string
          title: entity_workflow_rule_ids
          x-stainless-terraform-configurability: optional
        submittedByUserId:
          type: string
          title: submitted_by_user_id
          x-stainless-terraform-configurability: optional
        createdAt:
          $ref: '#/components/schemas/google.protobuf.Timestamp'
          title: created_at
          x-stainless-terraform-configurability: optional
        fieldChanges:
          type: array
          items:
            $ref: '#/components/schemas/svstore.EntityPendingFieldChange'
          title: field_changes
          x-stainless-terraform-configurability: optional
        runs:
          type: array
          items:
            $ref: '#/components/schemas/svstore.EntityPendingChangeRun'
          title: runs
          x-stainless-terraform-configurability: optional
        reason:
          type: string
          title: reason
          description: The workflow's rejection messages or why the change was not applied.
          x-stainless-terraform-configurability: optional
      title: EntityPendingChange
      additionalProperties: false
    svstore.EntityChangeOperation:
      type: string
      title: EntityChangeOperation
      enum:
        - ENTITY_CHANGE_OPERATION_UNSPECIFIED
        - ENTITY_CHANGE_OPERATION_CREATE
        - ENTITY_CHANGE_OPERATION_UPDATE
        - ENTITY_CHANGE_OPERATION_ARCHIVE
        - ENTITY_CHANGE_OPERATION_UNARCHIVE
        - ENTITY_CHANGE_OPERATION_DELETE
    svstore.EntityPendingChangeState:
      type: string
      title: EntityPendingChangeState
      enum:
        - ENTITY_PENDING_CHANGE_STATE_UNSPECIFIED
        - ENTITY_PENDING_CHANGE_STATE_PENDING
        - ENTITY_PENDING_CHANGE_STATE_APPLIED
        - ENTITY_PENDING_CHANGE_STATE_REJECTED
        - ENTITY_PENDING_CHANGE_STATE_CONFLICTED
        - ENTITY_PENDING_CHANGE_STATE_ERRORED
    google.protobuf.Timestamp:
      type: string
      examples:
        - '2025-01-15T01:30:15.000Z'
        - '2025-06-01T00:00:00.000Z'
      format: date-time
      description: A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
    svstore.EntityPendingFieldChange:
      type: object
      properties:
        fieldId:
          type: string
          title: field_id
          x-stainless-terraform-configurability: optional
        beforeJson:
          type: string
          title: before_json
          description: JSON values; empty when the field had or gets no value.
          x-stainless-terraform-configurability: optional
        afterJson:
          type: string
          title: after_json
          x-stainless-terraform-configurability: optional
        redacted:
          type: boolean
          title: redacted
          description: The caller cannot read this field, so both values are withheld.
          x-stainless-terraform-configurability: computed_optional
        pinned:
          type:
            - boolean
            - 'null'
          title: pinned
          description: The pin state the change sets; unset when it keeps the current pin.
          x-stainless-terraform-configurability: optional
      title: EntityPendingFieldChange
      additionalProperties: false
    svstore.EntityPendingChangeRun:
      type: object
      properties:
        entityWorkflowRuleId:
          type: string
          title: entity_workflow_rule_id
          x-stainless-terraform-configurability: optional
        workflowId:
          type: string
          title: workflow_id
          x-stainless-terraform-configurability: optional
        workflowRunId:
          type:
            - string
            - 'null'
          title: workflow_run_id
          x-stainless-terraform-configurability: optional
        state:
          $ref: '#/components/schemas/svstore.EntityPendingChangeRunState'
          title: state
          x-stainless-terraform-configurability: optional
      title: EntityPendingChangeRun
      additionalProperties: false
    svstore.EntityPendingChangeRunState:
      type: string
      title: EntityPendingChangeRunState
      enum:
        - ENTITY_PENDING_CHANGE_RUN_STATE_UNSPECIFIED
        - ENTITY_PENDING_CHANGE_RUN_STATE_QUEUED
        - ENTITY_PENDING_CHANGE_RUN_STATE_RUNNING
        - ENTITY_PENDING_CHANGE_RUN_STATE_ALLOWED
        - ENTITY_PENDING_CHANGE_RUN_STATE_REJECTED
        - ENTITY_PENDING_CHANGE_RUN_STATE_ERRORED
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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