Skip to main content
POST
https://app.autocalls.ai/api/
/
user
/
knowledgebases
/
{knowledgebaseId}
/
documents
Create document
curl --request POST \
  --url https://app.autocalls.ai/api/user/knowledgebases/{knowledgebaseId}/documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "type": "<string>",
  "url": "<string>",
  "links": [
    {
      "link": "<string>"
    }
  ],
  "relative_links_limit": 123
}
'
{
  "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"
  }
}
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

knowledgebaseId
integer
required
The unique identifier of the knowledgebase

Request Body

name
string
required
The name of the document (max 255 characters)
description
string
Optional description of the document (max 255 characters)
type
string
required
Document type: website, pdf, txt, or docx

Website Documents

url
string
The main URL to scrape. Required if links is not provided.
Array of specific URLs to scrape. Required if url is not provided.
Maximum number of relative links to follow when scraping (1-50)

File Documents (PDF, TXT, DOCX)

file
file
required
The file to upload (max 20MB). Use multipart/form-data encoding.

Response

message
string
Success message
data
object
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"
  }
}

Document Types

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

Example: Creating a Website Document

curl -X POST https://app.autocalls.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.autocalls.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.