Create Document
Create a new document record in Last Mile Intelligence.
Operation
Section titled “Operation”createDocument
Resource
Section titled “Resource”document
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Document Data | JSON | Yes | - | Document object with required fields |
Document Data Fields
Section titled “Document Data Fields”| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Document name |
| type | string | Yes | Document type (receipt, pod, invoice, etc.) |
| entityType | string | No | Associated entity type (order, task, etc.) |
| entityId | string | No | Associated entity ID |
| content | binary | No | File content (base64 encoded) |
Response
Section titled “Response”Success
Section titled “Success”{ "id": "doc_new123", "name": "New Document", "type": "receipt", "mimeType": "application/pdf", "url": "https://storage.lmi.com/documents/doc_new123.pdf", "createdAt": "2024-06-21T09:00:00Z"}{ "success": false, "error": "Validation failed", "details": { "name": "Name is required" }}Error Handling
Section titled “Error Handling”- Missing API Token: LMI credential is missing API token
- Validation Error: Required fields missing or invalid
- File Too Large: Document exceeds maximum file size
- Permission Denied: API token lacks permission for this operation