Skip to main content
Adds a new document to a knowledge base. Documents are processed asynchronously — the endpoint returns immediately while processing continues in the background.

Endpoint

POST /user/knowledgebases/{knowledgebaseId}/documents

Path parameters

knowledgebaseId
integer
required
Unique identifier of the knowledge base.

Request

name
string
required
Name of the document. Maximum 255 characters.
type
string
required
Document type: website, pdf, txt, or docx.
description
string
Optional description. Maximum 255 characters.

Website documents

url
string
Main URL to scrape. Required if links is not provided.
Specific URLs to scrape. Required if url is not provided.
Maximum number of relative links to follow when scraping. Range: 1–50.

File documents (PDF, TXT, DOCX)

file
file
required
File to upload. Maximum 20 MB. Use multipart/form-data encoding.

Document types

TypeDescriptionInput
websiteScrapes web pages and extracts textURL or list of URLs
pdfExtracts text from PDF filesPDF file upload
txtPlain text contentTXT file upload
docxExtracts text from Word documentsDOCX file upload

Response

message
string
Confirmation message.
data
object
The created document.

Example

curl -X POST "https://portal.intellixent.ai/api/user/knowledgebases/1/documents" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Company Website",
    "type": "website",
    "url": "https://example.com",
    "relative_links_limit": 20
  }'
201 Created
{
  "message": "Document created successfully. Processing will begin shortly.",
  "data": {
    "id": 1,
    "name": "Company Website",
    "type": "website",
    "type_label": "Website",
    "status": "processing",
    "status_label": "Processing",
    "created_at": "2025-01-08T10:30:00.000000Z"
  }
}
404 Knowledge base not found
{
  "error": "Knowledgebase not found."
}
Document processing is asynchronous. Poll the knowledge base status using Get knowledge bases to check when all documents are ready.