KrosAI Docs
DashboardGet Started
  • Getting Started
    • Introduction
    • Quickstart Guide
    • Authentication
  • OpenAI SDK Compatability
  • Endpoints
    • Completions API
      • Create Chat Completion
    • Translation API
    • Text Summarization API
    • Audio Transcription API
    • Sentiment Analysis API
  • AGENT
    • Agents API
      • Create Agent
      • List Agents
      • Get Agent
      • Update Agent
      • Delete Agent
      • Start Voice Session
    • Conversations API
      • Create Conversation
      • List Conversations
      • Get Conversation
      • Get Conversation Messages
    • Knowledge Base API
      • Create Knowledge Base
      • List Knowledge Base
      • Upload Document
      • List Document
  • Resources
    • AI Voice Agents
    • In-App Voice Assistants
    • Virtual Health Assistants
    • EdTech Language Tutors
  • SDKS
    • Node.JS SDK
    • React Native SDK
    • Flutter
Powered by GitBook
On this page
  • Endpoint
  • Parameters
  • Authentication
  • Response
  • Example Request
  • Example Response
  • Error Responses
  • Notes
  • Document Status Values
  1. AGENT
  2. Knowledge Base API

List Document

Retrieves all documents in a specific knowledge base.

Endpoint

GET /v1/knowledge-bases/{kb_id}/documents

Parameters

Parameter
Type
Required
Description

kb_id

string

Yes

ID of the knowledge base to list documents from

Authentication

Requires a valid API key or user authentication token.

Response

Returns an array of document objects.

Response Format

[
  {
    "id": "string",
    "knowledge_base_id": "string",
    "name": "string",
    "content_type": "string",
    "size": 0,
    "created_at": "datetime",
    "status": "string",
    "error": "string"
  }
]

Response Fields

Field
Type
Description

id

string

Unique identifier for the document

knowledge_base_id

string

ID of the knowledge base containing the document

name

string

Original filename of the document

content_type

string

MIME type of the document

size

integer

Size of the document in bytes

created_at

datetime

When the document was uploaded

status

string

Processing status ("processing", "ready", "error")

error

string

Error message if processing failed (null if successful)

Example Request

curl -X GET "https://api.krosai.com/v1/knowledge-bases/kb-a1b2c3d4-e5f6-7890-abcd-ef1234567890/documents" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

[
  {
    "id": "doc-c3d4e5f6-g7h8-9012-cdef-gh3456789012",
    "knowledge_base_id": "kb-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "name": "product_manual.pdf",
    "content_type": "application/pdf",
    "size": 1048576,
    "created_at": "2023-07-10T15:30:00Z",
    "status": "ready",
    "error": null
  },
  {
    "id": "doc-d4e5f6g7-h8i9-0123-defg-hi4567890123",
    "knowledge_base_id": "kb-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "name": "troubleshooting_guide.docx",
    "content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "size": 524288,
    "created_at": "2023-07-10T14:15:00Z",
    "status": "ready",
    "error": null
  }
]

Error Responses

Status Code
Description

401

Unauthorized - Invalid or missing API key

403

Forbidden - Not authorized to access this knowledge base

404

Not Found - Knowledge base not found

500

Internal Server Error

Notes

  • Returns documents in reverse chronological order (newest first)

  • Includes all documents regardless of processing status

  • Use the status field to check document availability

  • Processing status updates automatically

  • Documents with "ready" status are available for agent use

  • Error details are provided for failed documents

  • Content type indicates the original file format

Document Status Values

  • processing: Document is being analyzed and indexed

  • ready: Document is processed and available for agent use

  • error: Processing failed, check error field for details

PreviousUpload DocumentNextAI Voice Agents

Last updated 2 months ago