---
title: "Delete a document"
method: DELETE
path: "/v1/namespace/{namespaceId}/documents/{documentId}"
tags: ["Documents"]
---

# Delete a document

`DELETE /v1/namespace/{namespaceId}/documents/{documentId}`

Delete a document for the authenticated organization.

## Path parameters

- `namespaceId` string, required — The id of the namespace (prefixed with ns_)
- `documentId` string, required — The id of the document (prefixed with doc_)

## Headers

- `x-tenant-id` string — Optional tenant id to use for the request. If not provided, the namespace will be used directly. Must be alphanumeric and up to 64 characters.

## Response `204`

The deleted document

- object
  - `success` true, required
  - `data` Document, required
    - `id` string, required — The unique ID of the document.
    - `ingestJobId` string, required — The ingest job ID of the document.
    - `name` string, nullable, required — The name of the document.
    - `tenantId` string, nullable, required — The tenant ID of the ingest job.
    - `status` 'BACKLOG' | 'QUEUED' | 'QUEUED_FOR_RESYNC' | 'QUEUED_FOR_DELETE' | 'PRE_PROCESSING' | 'PROCESSING' | 'DELETING' | 'CANCELLING' | 'COMPLETED' | 'FAILED' | 'CANCELLED', required — The status of the document.
    - `error` string, nullable, required — The error message of the document. Only exists when the status is failed.
    - `source` union, required — The source of the document.
      - object
        - `type` 'TEXT', required
        - `text` string, required — The text to ingest.
      - object
        - `type` 'FILE', required
        - `fileUrl` string, uri, required — The URL of the file to ingest.
      - object
        - `type` 'MANAGED_FILE', required
        - `key` string, required — The key of the managed file to ingest.
      - object
        - `type` 'CRAWLED_PAGE', required
        - `title` string — The title of the crawled page.
        - `description` string — The description of the crawled page.
        - `language` string — The language of the crawled page.
      - object
        - `type` 'YOUTUBE_VIDEO', required
        - `videoId` string, required — The ID of the youtube video.
        - `duration` number — The duration of the youtube video in seconds.
    - `properties` object, nullable, required — The properties of the document.
      - `fileSize` number, required — The size of the file in bytes.
      - `mimeType` string, nullable, required — The MIME type of the file.
    - `config` DocumentConfigOutput, required — The document config.
      - `chunkSize` integer — Chunk size (in characters). Controls approximately how much text is included in each chunk. Defaults to `2048`.
      - `delimiter` string — Delimiter to use for separating text before chunking.
      - `metadata` object — Custom metadata to be added to the ingested documents. It cannot contain nested objects; only string, number, boolean, and array of strings are allowed.
      - `languageCode` 'af' | 'am' | 'ar' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'en' | 'es' | 'et' | 'fa' | 'fi' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hr' | 'hu' | 'id' | 'is' | 'it' | 'jp' | 'kr' | 'lt' | 'lv' | 'mk' | 'ms' | 'mt' | 'ne' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sl' | 'sr' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tr' | 'uk' | 'ur' | 'vi' | 'zh' | 'zu'
      - `mode` 'fast' | 'balanced' | 'accurate' — Processing mode for the parser. `fast` favors speed, `accurate` (pro subscription only) favors quality and layout fidelity, and `balanced` offers a compromise between the two. Defaults to `balanced`.
      - `disableImageExtraction` boolean — Disable image extraction from the document. When combined with `useLlm`, images may still be automatically captioned by the partition API. Defaults to `false`.
      - `disableImageCaptions` boolean — Disable synthetic image captions/descriptions in output. Images will be rendered as plain img tags without alt text. Defaults to `false`.
      - `chartUnderstanding` boolean — Enable chart understanding. This will extract the data from the charts in the document. Defaults to `false`.
      - `keepPageheaderInOutput` boolean — Keep the page header in the output. Defaults to `false`.
      - `keepPagefooterInOutput` boolean — Keep the page footer in the output. Defaults to `false`.
      - `forceOcr` boolean — Force OCR on the document even if selectable text exists. Useful for scanned documents with unreliable embedded text. Defaults to `false`.
      - `disableOcrMath` boolean — Disable inline math recognition in OCR. This can be useful if the document contains content that is frequently misclassified as math. Defaults to `false`.
      - `useLlm` boolean — Enable LLM-assisted parsing to improve tables, forms, inline math, and layout detection. May increase latency and token usage. Defaults to `true`.
      - `chunkOverlap` number — [Deprecated] Custom chunk overlap (in characters) between consecutive chunks. Helps preserve context across chunk boundaries.
      - `maxChunkSize` number — [Deprecated] Hard chunk size. This option is ignored by the current partition pipeline and kept only for backwards compatibility.
      - `chunkingStrategy` 'basic' | 'by_title' — [Deprecated] The legacy chunking strategy. This option is ignored by the current partition pipeline and kept only for backwards compatibility.
      - `strategy` 'auto' | 'fast' | 'hi_res' | 'ocr_only' — [Deprecated] Legacy processing strategy used by the previous partition API. This option is ignored by the current pipeline and kept only for backwards compatibility.
    - `totalChunks` number, required — The total number of chunks.
    - `totalTokens` number, required — The total number of tokens.
    - `totalCharacters` number, required — The total number of characters.
    - `totalPages` number, required — The total number of pages. Will be 0 if the document is not paged (e.g. PDF).
    - `createdAt` string, required — The date and time the document was created.
    - `queuedAt` string, nullable, required — The date and time the document was queued.
    - `preProcessingAt` string, nullable, required — The date and time the document was pre-processed.
    - `processingAt` string, nullable, required — The date and time the document was processed.
    - `completedAt` string, nullable, required — The date and time the document was completed.
    - `failedAt` string, nullable, required — The date and time the document failed.

## Other responses

- `400` — The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
- `401` — Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.
- `403` — The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server.
- `404` — The server cannot find the requested resource.
- `409` — This response is sent when a request conflicts with the current state of the server.
- `410` — This response is sent when the requested content has been permanently deleted from server, with no forwarding address.
- `422` — The request was well-formed but was unable to be followed due to semantic errors.
- `429` — The user has sent too many requests in a given amount of time ("rate limiting")
- `500` — The server has encountered a situation it does not know how to handle.

---

[API](https://skmtc.dev/agentset/apis/agentsetapi.md) · [All operations](https://skmtc.dev/agentset/apis/agentsetapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agentset/agentsetapi/revisions/cc6ac802092e/schema)
