Bulk Enable or Disable Documents

Enable or disable many documents in one request, either by identifier or, with selectAll, every document in the knowledge base. Bulk delete is not offered; delete documents one at a time with DELETE /api/v2/knowledge/{id}/documents/{documentId}. A workspace API key is rejected with 403; use a personal API key.

PATCH/api/v2/knowledge/{id}/documents
X-API-Key<token>

Your Sim API key, personal or workspace-scoped. Generate one under Settings, then API Keys. Operations that reject workspace keys say so in their own description.

In: header

Path Parameters

id*string

Unique knowledge base identifier.

Length1 <= length

Request Body

application/json

Operation and the documents it applies to.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://www.sim.ai/api/v2/knowledge/string/documents" \  -H "X-API-Key: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",    "operation": "disable",    "documentIds": [      "b2d4f8a0-1c3e-4a5b-9d7c-2e6f0a8b4c12"    ]  }'
{
  "data": {
    "operation": "enable",
    "updatedCount": 42,
    "documentIds": [
      "string"
    ]
  }
}
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "The request is invalid."
  }
}
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "The request is invalid."
  }
}
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "The request is invalid."
  }
}
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "The request is invalid."
  }
}
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "The request is invalid."
  }
}
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "The request is invalid."
  }
}
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "The request is invalid."
  }
}
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "The request is invalid."
  }
}