Skip to main content
POST
/
v1
/
knowledge
/
{kb_id}
/
documents
Add Knowledge Base Documents
curl --request POST \
  --url https://api.xpander.ai/v1/knowledge/{kb_id}/documents \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "document_urls": [
    "https://example.com/docs/product-guide.pdf"
  ]
}
'
[
  {
    "id": "doc-uuid-1",
    "name": "product-guide.pdf",
    "status": "processing"
  }
]
Upload documents to a knowledge base by providing URLs. The documents will be downloaded, processed, and indexed for semantic search.

Path Parameters

kb_id
string
required
Unique identifier of the knowledge base (UUID format)

Request Body

document_urls
array
required
Array of document URLs to add to the knowledge baseSupported formats:
  • PDF documents
  • Microsoft Word (.docx, .doc)
  • Text files (.txt, .md)
  • Web pages (HTML)
  • CSV and Excel files
  • Presentations (PPTX, PPT)
  • JSON and YAML files

Response

Returns an array of created document objects:
kb_id
string
Knowledge base ID
id
string
Unique identifier for the document (UUID) - initially null, assigned after processing completes
name
string
Document name (initially null)
document_url
string
URL of the document

Example Request

curl -X POST -H "x-api-key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "document_urls": [
      "https://example.com/product-guide.pdf",
      "https://example.com/faq-page"
    ]
  }' \
  https://api.xpander.ai/v1/knowledge/<kb-id>/documents

Example Response

[
  {
    "kb_id": "<kb-id>",
    "id": null,
    "name": null,
    "document_url": "https://example.com/product-guide.pdf"
  },
  {
    "kb_id": "<kb-id>",
    "id": null,
    "name": null,
    "document_url": "https://example.com/faq-page"
  }
]

Processing Flow

  1. Upload - Documents are queued for processing
  2. Download - System downloads documents from provided URLs
  3. Extract - Text content is extracted from documents
  4. Chunk - Content is split into searchable chunks
  5. Embed - Chunks are converted to vector embeddings
  6. Index - Embeddings are stored in the vector database
Processing typically takes 10-60 seconds per document depending on size.

Supported File Types

  • Documents: PDF, DOCX, DOC, TXT, MD, RTF
  • Spreadsheets: CSV, XLSX, XLS
  • Presentations: PPTX, PPT
  • Web: HTML, XML
  • Code: JSON, YAML, various programming languages

Notes

  • Documents must be publicly accessible via HTTP/HTTPS
  • Maximum file size: 50MB per document
  • The id field is null initially until the document is processed and indexed
  • The document ID is assigned after processing/indexing completes
  • Use List Documents to check processing progress
  • Duplicate URLs will create separate document entries

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

kb_id
string
required

Body

application/json

Request model for adding documents to a knowledge base.

document_urls
string[]
required

Array of document URLs to add to the knowledge base. Supported formats: PDF, DOCX, DOC, TXT, MD, HTML, CSV, XLSX, PPTX, JSON, YAML

Response

Successful Response

document_url
string
required

Document URL

kb_id
string | null

KB identifier

id
string | null

Document unique identifier

name
string | null

Document name