Skip to main content

List Documents

Retrieve all documents for the authenticated user.
GET
/api/documents

Query Parameters

ParameterTypeDescription
typestringFilter by document type
categorystringFilter by category ID
statusstringFilter by processing status
limitnumberMax results (default: 50)
offsetnumberPagination 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.
GET
/api/documents/:id

Path Parameters

ParameterTypeDescription
idstringDocument ID

Response

Returns full document object including AI analysis.

Upload Document

Upload a new document for processing.
POST
/api/documents

Request

Content-Type: multipart/form-data
FieldTypeDescription
filefileDocument file (PDF, PNG, JPG)
categorystringOptional 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.
DELETE
/api/documents/:id

Path Parameters

ParameterTypeDescription
idstringDocument ID

Response

{
  "message": "Document deleted successfully"
}
Deleting a document also removes associated tasks and AI analysis. This action cannot be undone.

Document Object

FieldTypeDescription
_idstringUnique identifier
userIdstringOwner user ID
originalFileNamestringOriginal file name
documentTypestringAI-detected type
processingStatusstringpending, processing, completed, failed
aiAnalysisobjectAI extraction results
categoriesarrayAssigned categories
createdAtstringISO 8601 timestamp
updatedAtstringISO 8601 timestamp