Skip to main content
DELETE
/
v1
/
namespace
/
{namespaceId}
/
documents
/
{documentId}
TypeScript
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 deleted successfully");
{
  "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>"
    },
    "totalChunks": 123,
    "totalTokens": 123,
    "totalCharacters": 123,
    "totalPages": 123,
    "createdAt": "<string>",
    "queuedAt": "<string>",
    "preProcessingAt": "<string>",
    "processingAt": "<string>",
    "completedAt": "<string>",
    "failedAt": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

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.

Path Parameters

namespaceId
string
required

The id of the namespace (prefixed with ns_)

Examples:

"ns_123"

documentId
string
required

The id of the document (prefixed with doc_)

Examples:

"doc_123"

Response

The deleted document

success
boolean
required
data
object
required