Upload Document
Upload a document to your knowledge base.
POST /v1/documents
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Document text content |
metadata | object | No | Key-value metadata |
chunking | object | No | Chunking configuration |
Chunking Options
| Field | Type | Default | Description |
|---|---|---|---|
strategy | string | tokens | tokens, paragraphs, or headings |
max_tokens | integer | 512 | Maximum tokens per chunk |
overlap | integer | 50 | Token overlap between chunks |
Example Request
- cURL
- Python
- JavaScript
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
}
}'
import requests
response = requests.post(
"https://api.inherent.systems/v1/documents",
headers={"Authorization": f"Bearer {api_key}"},
json={
"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
}
}
)
const response = await fetch('https://api.inherent.systems/v1/documents', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
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
| Field | Type | Description |
|---|---|---|
id | string | Unique document identifier |
status | string | processing, completed, or failed |
version | integer | Document version number |
metadata | object | Document metadata |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last 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
| Type | Extensions | Max Size |
|---|---|---|
| Text | .txt, .md, .rst | 10 MB |
| Documents | .pdf, .docx, .doc | 50 MB |
| Code | .py, .js, .ts, etc. | 10 MB |
| Data | .json, .yaml, .csv | 10 MB |
Errors
| Code | Description |
|---|---|
400 | Invalid request body |
401 | Missing or invalid API key |
413 | Content too large |
429 | Rate limit exceeded |
500 | Processing error |
{
"error": {
"code": "content_too_large",
"message": "Document content exceeds maximum size of 10MB",
"request_id": "req_abc123"
}
}