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

# Delete documents

> Deletes up to 100 documents named by `ids`, `external_ids`, or both, with a result for each: deleted, or failed when the knowledge base has no such document. There is no 'replace everything' sync: delete what your source removed. Each counts against your rate limit. Writes go into a knowledge base this API made or one that takes uploads in the app (`writable`); a connector's is a 409. A digital worker's own key can't write.



## OpenAPI

````yaml /api/statisfy-api.openapi.json post /v1/knowledge_bases/{knowledge_base_id}/documents/batch/delete
openapi: 3.1.0
info:
  description: >-
    The agent-first Statisfy API. Authenticate with an API key (`Authorization:
    Bearer stfy_live_…`), then call `GET /v1/meta/capabilities` to discover
    every operation and its schemas.
  title: Statisfy API
  version: 1.0.0
servers:
  - url: https://api.statisfy.com
    description: Production
security: []
paths:
  /v1/knowledge_bases/{knowledge_base_id}/documents/batch/delete:
    post:
      tags:
        - knowledge_bases
      summary: Delete documents
      description: >-
        Deletes up to 100 documents named by `ids`, `external_ids`, or both,
        with a result for each: deleted, or failed when the knowledge base has
        no such document. There is no 'replace everything' sync: delete what
        your source removed. Each counts against your rate limit. Writes go into
        a knowledge base this API made or one that takes uploads in the app
        (`writable`); a connector's is a 409. A digital worker's own key can't
        write.
      operationId: knowledge_bases_batch_delete_documents
      parameters:
        - description: The knowledge base's id, from GET /v1/knowledge_bases
          in: path
          name: knowledge_base_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                external_ids:
                  description: Documents by your id
                  items:
                    type: string
                  maxItems: 100
                  title: External Ids
                  type: array
                ids:
                  description: Documents by id
                  items:
                    type: string
                  maxItems: 100
                  title: Ids
                  type: array
              type: object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteDocumentsResult'
          description: Successful Response
      security:
        - HTTPBearer: []
components:
  schemas:
    DeleteDocumentsResult:
      properties:
        items:
          description: 'In request order: ids first, then external ids'
          items:
            $ref: '#/components/schemas/DeletedDocument'
          title: Items
          type: array
      required:
        - items
      title: DeleteDocumentsResult
      type: object
    DeletedDocument:
      properties:
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
        error:
          anyOf:
            - $ref: '#/components/schemas/ItemError'
            - type: 'null'
          description: Set exactly when `status` is `failed`
        ref:
          description: The id or external id as you sent it
          title: Ref
          type: string
        status:
          enum:
            - deleted
            - failed
          title: Status
          type: string
      required:
        - ref
        - status
      title: DeletedDocument
      type: object
    ItemError:
      description: The error envelope a single request would have returned.
      properties:
        code:
          title: Code
          type: string
        details:
          items:
            additionalProperties: true
            type: object
          title: Details
          type: array
        message:
          title: Message
          type: string
      required:
        - code
        - message
      title: ItemError
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http
      description: >-
        An API key, sent as `Authorization: Bearer stfy_live_…`. See
        [Authentication](/rest-api/authentication) for how to get one and which
        scopes it needs.

````

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