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

# Delete a document permanently

> Permanently deletes a document: it is removed from every agent and its stored file is scheduled for deletion. This cannot be undone. Calls already in progress keep the text they loaded. Call the preview operation first and send its `ETag` in the `If-Match` header.



## OpenAPI

````yaml /api-reference/openapi.json delete /api/v1/knowledge-base/documents/{document_uuid}/permanent
openapi: 3.1.0
info:
  description: >-
    Manage your Klatt voice and chat agents, conversations, contacts and
    knowledge with an organization API key. Start with the
    [introduction](https://docs.klatt.ai/api-reference/introduction).
  title: Klatt API
  version: 1.0.0
servers:
  - url: https://api.klatt.ai
security:
  - bearerAuth: []
tags:
  - description: >-
      Agents that answer and place phone calls, and where they can transfer a
      call.
    name: Voice agents
  - description: Agents that answer WhatsApp chats.
    name: Chat agents
  - description: Calls and chats your agents have handled, with their analysis and state.
    name: Conversations
  - description: Lists of contacts and the custom fields each list defines.
    name: Contact lists
  - description: The people in a contact list.
    name: Contacts
  - description: Documents your agents read from, and their extracted text.
    name: Knowledge documents
  - description: >-
      Short question-and-answer and company-information entries your agents can
      use.
    name: Knowledge entries
paths:
  /api/v1/knowledge-base/documents/{document_uuid}/permanent:
    delete:
      tags:
        - Knowledge documents
      summary: Delete a document permanently
      description: >-
        Permanently deletes a document: it is removed from every agent and its
        stored file is scheduled for deletion. This cannot be undone. Calls
        already in progress keep the text they loaded. Call the preview
        operation first and send its `ETag` in the `If-Match` header.
      operationId: deleteKnowledgeDocument
      parameters:
        - description: Unique identifier (UUID) of the knowledge document.
          in: path
          name: document_uuid
          required: true
          schema:
            type: string
        - description: >-
            The `ETag` returned by the preview operation. The deletion is
            refused unless the agents affected are still the ones the preview
            listed.
          in: header
          name: If-Match
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
      responses:
        '204':
          description: Successful Response
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceDeletionError'
          description: The document does not exist in your organization.
        '412':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceDeletionError'
          description: >-
            The agents affected changed since the preview. Preview again and
            retry.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: The request failed validation.
        '428':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceDeletionError'
          description: The `If-Match` header is missing.
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  responses:
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The API key is missing, malformed, unknown, deleted or sent to the wrong
        host. `detail` is a code such as `api_key_required`,
        `console_token_not_accepted` or `api_key_wrong_host`, or a short text
        such as `Invalid or expired API key`. Keys do not expire.
      headers:
        WWW-Authenticate:
          description: Always `Bearer`.
          schema:
            type: string
    Forbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The key is valid but may not do this. `detail` is `permission_required`,
        `organization_deleted` or `Organization API keys cannot access this
        operation`.
    RateLimited:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: The key exceeded its request limit. `detail` is `rate_limited`.
      headers:
        Retry-After:
          description: Seconds to wait before sending the next request.
          schema:
            type: integer
    ServiceUnavailable:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        A dependency the request needs is temporarily unavailable. `detail`
        names it, for example `rate_limit_unavailable` or
        `contacts_unavailable`. Retry with backoff.
  schemas:
    ResourceDeletionError:
      properties:
        error_code:
          description: >-
            `resource_not_found`, `if_match_required` or
            `deletion_preview_changed`.
          type: string
        preview:
          anyOf:
            - $ref: '#/components/schemas/ResourceDeletionPreview'
            - type: 'null'
          description: >-
            The current preview, so you can confirm it and retry. `null` when
            the resource was not found.
      required:
        - error_code
      type: object
    HTTPValidationError:
      description: 'Body of a `422` response: the request failed validation.'
      properties:
        detail:
          anyOf:
            - items:
                $ref: '#/components/schemas/ValidationError'
              type: array
            - type: string
            - type: object
          description: >-
            A list of field errors when the body or a parameter is invalid, a
            string with an error code for some other refusals, or an object with
            a `code` when a knowledge limit is exceeded.
      type: object
    Error:
      description: Body of an error response.
      properties:
        detail:
          description: >-
            A stable error code such as `agent_not_found`. A few authentication
            errors carry a short text instead, such as `Invalid or expired API
            key`.
          type: string
        message:
          description: >-
            A human-readable explanation. Present only on errors raised before
            the request reaches the API, such as `api_key_wrong_host`.
          type: string
      required:
        - detail
      type: object
    ResourceDeletionPreview:
      properties:
        affected_agents:
          description: The agents that use the resource and would lose it.
          items:
            $ref: '#/components/schemas/ResourceDeletionAgent'
          type: array
        etag:
          description: >-
            Identifies this preview. The same value as the `ETag` header; send
            it in `If-Match` to confirm the deletion.
          type: string
        name:
          description: Name of the resource.
          type: string
        resource_uuid:
          description: Unique identifier (UUID) of the resource that would be deleted.
          type: string
        retained_sender_count:
          default: 0
          description: >-
            Number of messaging senders that keep their history after the
            deletion. Always `0` for documents.
          type: integer
      required:
        - resource_uuid
        - name
        - affected_agents
        - etag
      type: object
    ValidationError:
      description: One invalid field of a request.
      properties:
        ctx:
          description: Extra details about the error, such as the limit that was exceeded.
          type: object
        input:
          description: The value that failed validation, when it is returned.
        loc:
          description: 'Where the error is: `body`, `query` or `path`, then the field names.'
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          description: What is wrong with the value.
          type: string
        type:
          description: A short code for the kind of error.
          type: string
      required:
        - loc
        - msg
        - type
      type: object
    ResourceDeletionAgent:
      properties:
        agent_uuid:
          description: Unique identifier (UUID) of the agent.
          type: string
        name:
          description: Name of the agent.
          type: string
      required:
        - agent_uuid
        - name
      type: object
  securitySchemes:
    bearerAuth:
      description: >-
        An organization API key created in the Klatt console, sent as
        `Authorization: Bearer <key>`. The key belongs to one organization.
      scheme: bearer
      type: http

````

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