API Reference
Create document
Add a new document to a knowledgebase
On this page
This endpoint creates a new document in a knowledgebase. Documents are processed asynchronously - the endpoint returns immediately while processing continues in the background.
Path Parameters
knowledgebaseIdintegerrequired
The unique identifier of the knowledgebase
Request Body
namestringrequired
The name of the document (max 255 characters)
descriptionstring
Optional description of the document (max 255 characters)
typestringrequired
Document type: website, pdf, txt, or docx
Website Documents
urlstring
The main URL to scrape. Required if links is not provided.
linksarray
Array of specific URLs to scrape. Required if url is not provided.
relative_links_limitinteger
Maximum number of relative links to follow when scraping (1-50)
File Documents (PDF, TXT, DOCX)
filefilerequired
The file to upload (max 20MB). Use multipart/form-data encoding.
Response
messagestring
Success message
dataobject
The created document object
{
"message": "Document created successfully. Processing will begin shortly.",
"data": {
"id": 1,
"name": "Company Website",
"description": "Main website content",
"type": "website",
"type_label": "Website",
"status": "processing",
"status_label": "Processing",
"created_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "Document created successfully. Processing will begin shortly.",
"data": {
"id": 2,
"name": "Product Manual",
"description": "User guide for our product",
"type": "pdf",
"type_label": "PDF",
"status": "processing",
"status_label": "Processing",
"created_at": "2025-01-08T10:35:00.000000Z"
}
}
{
"error": "Knowledgebase not found."
}
{
"message": "A file is required for this document type.",
"errors": {
"file": [
"A file is required for this document type."
]
}
}
{
"error": "Failed to create document. Please try again."
}
Document Types
| Type | Description | Input |
|---|---|---|
website |
Scrapes web pages and extracts text content | URL or list of URLs |
pdf |
Extracts text from PDF files | PDF file upload |
txt |
Plain text content | TXT file upload |
docx |
Extracts text from Word documents | DOCX file upload |
Example: Creating a Website Document
curl -X POST https://app.voxlink.ai/api/user/knowledgebases/1/documents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Company Website",
"description": "Main website content",
"type": "website",
"url": "https://example.com",
"relative_links_limit": 20
}'
Example: Uploading a PDF Document
curl -X POST https://app.voxlink.ai/api/user/knowledgebases/1/documents \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "name=Product Manual" \
-F "description=User guide for our product" \
-F "type=pdf" \
-F "file=@/path/to/document.pdf"
Document processing is asynchronous. Poll the get document endpoint to check when processing is complete.
Related guides
API Reference
Introduction
Welcome to the VoxLink API
Read guide →API Reference
Authentication
Learn how to authenticate your API requests
Read guide →API Reference
Get current user
Get the authenticated user's profile information
Read guide →API Reference
List assistants
List all assistants for the authenticated user with pagination
Read guide →