Skip to main content
POST
/
ai-knowledge-bases
/
{kb_id}
/
documents
Upload Document to Knowledge Base
curl --request POST \
  --url https://api.wacht.dev/ai-knowledge-bases/{kb_id}/documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file' \
  --form 'metadata={}'
{
  "id": "<string>",
  "knowledge_base_id": "<string>",
  "name": "user-manual.pdf",
  "type": "pdf",
  "size": 2048576,
  "token_count": 15000,
  "status": "ready",
  "uploaded_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

JWT Bearer token authentication using the Authorization header

Path Parameters

kb_id
string
required

(i64 formatted as string)

Body

multipart/form-data
file
file
required

Document file (PDF, TXT, MD, DOCX, HTML)

metadata
object

Additional metadata for the document

Response

Document uploaded successfully

id
string

(i64 formatted as string)

knowledge_base_id
string

(i64 formatted as string)

name
string
Example:

"user-manual.pdf"

type
enum<string>
Available options:
pdf,
txt,
md,
docx,
html
Example:

"pdf"

size
integer
Example:

2048576

token_count
integer
Example:

15000

status
enum<string>
Available options:
processing,
ready,
failed
Example:

"ready"

uploaded_at
string<date-time>