API Setup
Documents API
API reference for managing documents and files
Get Document
Retrieve a specific document and its associated files.
GET /api/v1/documents/{documentId}Parameters
| Parameter | Type | Description |
|---|---|---|
| documentId | string | The ID of the document to retrieve |
Response
{
"id": "document_id",
"name": "Document Name",
"description": "Document Description",
"tags": ["tag1", "tag2"],
"files": [
{
"id": "file_id",
"name": "file.pdf",
"description": "File Description",
"fileUrl": "https://storage.example.com/file.pdf",
"whatsapp_media_id": "whatsapp_id"
}
]
}Update Document
Update a document and its associated files.
PUT /api/v1/documents/{documentId}Parameters
| Parameter | Type | Description |
|---|---|---|
| documentId | string | The ID of the document to update |
Request Body (multipart/form-data)
| Field | Type | Description |
|---|---|---|
| name | string | Document name |
| description | string | Document description |
| tags | string (JSON) | Array of tags |
| fileDescriptions | string (JSON) | Array of file descriptions |
| files | file[] | Array of files to upload |
Response
{
"id": "document_id",
"name": "Updated Document Name",
"description": "Updated Description",
"tags": ["updated_tag1", "updated_tag2"],
"files": [
{
"id": "file_id",
"name": "updated_file.pdf",
"description": "Updated File Description",
"fileUrl": "https://storage.example.com/updated_file.pdf",
"whatsapp_media_id": "whatsapp_id"
}
]
}Delete Document
Delete a document and all its associated files.
DELETE /api/v1/documents/{documentId}Parameters
| Parameter | Type | Description |
|---|---|---|
| documentId | string | The ID of the document to delete |
Response
Returns a 204 No Content response on successful deletion.
File Storage
- Files are stored in DigitalOcean Spaces
- Files are publicly accessible via their URLs
- WhatsApp media IDs are stored for quick sharing via WhatsApp
- Supported file types: PDF, images, videos, and other common document formats
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid input parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - Document not found |
| 500 | Internal Server Error |
Security
- All endpoints require authentication
- Files are scanned for malware before storage
- File access can be restricted by organization
- File deletion removes both storage and WhatsApp media entries