Resources · Knowledge API

Knowledge API Documentation

Comprehensive reference for workspace knowledge ingestion, retrieval, ask workflows, and production-safe constraints.

Endpoints

GET /api/v1/console/knowledge
POST /api/v1/console/knowledge
POST /api/v1/console/knowledge/upload
GET /api/v1/console/knowledge/{item_id}
PATCH /api/v1/console/knowledge/{item_id}
DELETE /api/v1/console/knowledge/{item_id}
POST /api/v1/console/knowledge/ask

Required Headers

Authorization: Bearer [token] or API key authX-Scope-Type: workspaceX-Workspace-ID: [workspace_uuid]Content-Type: application/json (or multipart/form-data for upload)

Upload Example

bash
curl -X POST "/api/v1/console/knowledge/upload" \
  -H "Authorization: Bearer [token]" \
  -H "X-Scope-Type: workspace" \
  -H "X-Workspace-ID: [workspace_uuid]" \
  -F "file=@handbook.pdf" \
  -F "title=Team Handbook" \
  -F "tags=hr,policy"

Ask Example

json
{
  "question": "What is our remote-work policy?",
  "top_k": 5,
  "filters": {
    "tags": ["hr", "policy"]
  },
  "session_id": "sess_123"
}

Response Example

json
{
  "success": true,
  "answer": "Employees may work remotely up to 3 days per week...",
  "citations": [
    {
      "item_id": "kb_456",
      "title": "Team Handbook",
      "score": 0.91
    }
  ],
  "usage": {
    "input_tokens": 180,
    "output_tokens": 72
  },
  "metadata": {
    "retrieved_items": 5
  }
}

Knowledge Constraints

  • Max file size: 20MB per upload.
  • Supported formats: PDF, DOC, DOCX, TXT, Markdown.
  • Ingestion runs asynchronously in background workers.
  • Workspace scope is required for console knowledge operations.

Ingestion Lifecycle

  1. pending: file accepted and queued.
  2. processing: extraction/chunking/embedding in progress.
  3. processed: item is indexed and query-ready.
  4. failed: ingestion failed with diagnostic metadata.

Error Models

400

Invalid payload or malformed filters.

401

Missing or invalid authentication.

403

Workspace access denied by role/scope.

404

Knowledge item not found.

413

Uploaded file exceeds allowed size.

415

Unsupported file content type.

422

Validation failure in request schema/context.

429

Rate limit exceeded.