Delete a document for the authenticated organization.
import { Agentset } from "agentset";
const agentset = new Agentset({ apiKey: 'agentset_xxx' });
const ns = agentset.namespace('ns_xxx');
await ns.documents.delete("doc_123");
console.log("Document queued for deletion");{
"success": true,
"data": {
"id": "<string>",
"ingestJobId": "<string>",
"name": "<string>",
"tenantId": "<string>",
"status": "BACKLOG",
"error": "<string>",
"source": {
"type": "<string>",
"text": "<string>"
},
"properties": {
"fileSize": 123,
"mimeType": "<string>"
},
"config": {
"chunkSize": 4503599627370512,
"metadata": {},
"languageCode": "af",
"forceOcr": true,
"mode": "fast",
"disableImageExtraction": true,
"disableOcrMath": true,
"useLlm": true,
"chunkOverlap": 123,
"maxChunkSize": 123,
"chunkingStrategy": "basic",
"strategy": "auto"
},
"totalChunks": 123,
"totalTokens": 123,
"totalCharacters": 123,
"totalPages": 123,
"createdAt": "<string>",
"queuedAt": "<string>",
"preProcessingAt": "<string>",
"processingAt": "<string>",
"completedAt": "<string>",
"failedAt": "<string>"
}
}Default authentication mechanism
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.
The id of the namespace (prefixed with ns_)
The id of the document (prefixed with doc_)
The deleted document
Show child attributes
The unique ID of the document.
The ingest job ID of the document.
The name of the document.
The tenant ID of the ingest job.
The status of the document.
BACKLOG, QUEUED, QUEUED_FOR_RESYNC, QUEUED_FOR_DELETE, PRE_PROCESSING, PROCESSING, DELETING, CANCELLING, COMPLETED, FAILED, CANCELLED The error message of the document. Only exists when the status is failed.
The document config.
Show child attributes
Chunk size (in characters). Controls approximately how much text is included in each chunk. Defaults to 2048.
32 <= x <= 9007199254740991Language code to use for text processing (for example, en, ar, or fr). When omitted, the partition API will attempt to detect the language automatically.
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 Force OCR on the document even if selectable text exists. Useful for scanned documents with unreliable embedded text. Defaults to false.
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.
fast, balanced, accurate Disable image extraction from the document. When combined with useLlm, images may still be automatically captioned by the partition API. Defaults to false.
Disable inline math recognition in OCR. This can be useful if the document contains content that is frequently misclassified as math. Defaults to false.
Enable LLM-assisted parsing to improve tables, forms, inline math, and layout detection. May increase latency and token usage. Defaults to true.
[Deprecated] Custom chunk overlap (in characters) between consecutive chunks. Helps preserve context across chunk boundaries.
[Deprecated] Hard chunk size. This option is ignored by the current partition pipeline and kept only for backwards compatibility.
[Deprecated] The legacy chunking strategy. This option is ignored by the current partition pipeline and kept only for backwards compatibility.
basic, by_title [Deprecated] Legacy processing strategy used by the previous partition API. This option is ignored by the current pipeline and kept only for backwards compatibility.
auto, fast, hi_res, ocr_only The total number of chunks.
The total number of tokens.
The total number of characters.
The total number of pages. Will be 0 if the document is not paged (e.g. PDF).
The date and time the document was created.
The date and time the document was queued.
The date and time the document was pre-processed.
The date and time the document was processed.
The date and time the document was completed.
The date and time the document failed.
import { Agentset } from "agentset";
const agentset = new Agentset({ apiKey: 'agentset_xxx' });
const ns = agentset.namespace('ns_xxx');
await ns.documents.delete("doc_123");
console.log("Document queued for deletion");{
"success": true,
"data": {
"id": "<string>",
"ingestJobId": "<string>",
"name": "<string>",
"tenantId": "<string>",
"status": "BACKLOG",
"error": "<string>",
"source": {
"type": "<string>",
"text": "<string>"
},
"properties": {
"fileSize": 123,
"mimeType": "<string>"
},
"config": {
"chunkSize": 4503599627370512,
"metadata": {},
"languageCode": "af",
"forceOcr": true,
"mode": "fast",
"disableImageExtraction": true,
"disableOcrMath": true,
"useLlm": true,
"chunkOverlap": 123,
"maxChunkSize": 123,
"chunkingStrategy": "basic",
"strategy": "auto"
},
"totalChunks": 123,
"totalTokens": 123,
"totalCharacters": 123,
"totalPages": 123,
"createdAt": "<string>",
"queuedAt": "<string>",
"preProcessingAt": "<string>",
"processingAt": "<string>",
"completedAt": "<string>",
"failedAt": "<string>"
}
}