List Documents
Retrieve all documents for the authenticated user.
Query Parameters
| Parameter | Type | Description |
|---|
type | string | Filter by document type |
category | string | Filter by category ID |
status | string | Filter by processing status |
limit | number | Max results (default: 50) |
offset | number | Pagination offset |
Response
{
"documents": [
{
"_id": "doc_abc123",
"originalFileName": "home-insurance-2024.pdf",
"documentType": "insurance",
"processingStatus": "completed",
"aiAnalysis": {
"summary": "Home insurance policy from ABC Insurance",
"extractedData": {
"policyNumber": "HI-2024-12345",
"expiryDate": "2025-03-15",
"premiumAmount": 1200
}
},
"createdAt": "2024-01-15T10:30:00Z"
}
],
"total": 42,
"limit": 50,
"offset": 0
}
Get Document
Retrieve a single document by ID.
Path Parameters
| Parameter | Type | Description |
|---|
id | string | Document ID |
Response
Returns full document object including AI analysis.
Upload Document
Upload a new document for processing.
Request
Content-Type: multipart/form-data
| Field | Type | Description |
|---|
file | file | Document file (PDF, PNG, JPG) |
category | string | Optional category ID |
Example
curl -X POST https://api.adminest.com/api/documents \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "[email protected]"
Response
{
"_id": "doc_xyz789",
"originalFileName": "insurance-policy.pdf",
"processingStatus": "processing",
"createdAt": "2024-01-15T10:30:00Z"
}
Document processing is asynchronous. Poll the document endpoint or use webhooks to get notified when processing completes.
Delete Document
Delete a document and associated data.
Path Parameters
| Parameter | Type | Description |
|---|
id | string | Document ID |
Response
{
"message": "Document deleted successfully"
}
Deleting a document also removes associated tasks and AI analysis. This action cannot be undone.
Document Object
| Field | Type | Description |
|---|
_id | string | Unique identifier |
userId | string | Owner user ID |
originalFileName | string | Original file name |
documentType | string | AI-detected type |
processingStatus | string | pending, processing, completed, failed |
aiAnalysis | object | AI extraction results |
categories | array | Assigned categories |
createdAt | string | ISO 8601 timestamp |
updatedAt | string | ISO 8601 timestamp |