Skip to main content

Upload Document

Upload a document to your knowledge base.

POST /v1/documents

Request Body

FieldTypeRequiredDescription
contentstringYesDocument text content
metadataobjectNoKey-value metadata
chunkingobjectNoChunking configuration

Chunking Options

FieldTypeDefaultDescription
strategystringtokenstokens, paragraphs, or headings
max_tokensinteger512Maximum tokens per chunk
overlapinteger50Token overlap between chunks

Example Request

curl -X POST https://api.inherent.systems/v1/documents \
-H "Authorization: Bearer $INHERENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "# API Authentication\n\nAll API requests require a Bearer token...",
"metadata": {
"title": "API Authentication Guide",
"category": "documentation",
"version": "2.0"
},
"chunking": {
"strategy": "headings",
"max_tokens": 1024
}
}'

Response

{
"id": "doc_abc123xyz",
"status": "processing",
"version": 1,
"metadata": {
"title": "API Authentication Guide",
"category": "documentation",
"version": "2.0"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}

Response Fields

FieldTypeDescription
idstringUnique document identifier
statusstringprocessing, completed, or failed
versionintegerDocument version number
metadataobjectDocument metadata
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp

File Upload

To upload files (PDF, DOCX, etc.), use the file upload endpoint:

curl -X POST https://api.inherent.systems/v1/documents/upload \
-H "Authorization: Bearer $INHERENT_API_KEY" \
-F "file=@document.pdf" \
-F 'metadata={"title": "My PDF Document"}'

Supported File Types

TypeExtensionsMax Size
Text.txt, .md, .rst10 MB
Documents.pdf, .docx, .doc50 MB
Code.py, .js, .ts, etc.10 MB
Data.json, .yaml, .csv10 MB

Errors

CodeDescription
400Invalid request body
401Missing or invalid API key
413Content too large
429Rate limit exceeded
500Processing error
{
"error": {
"code": "content_too_large",
"message": "Document content exceeds maximum size of 10MB",
"request_id": "req_abc123"
}
}