Object Record Uploads
This design describes API for Object Record Uploads.
Object Records Uploads API
POST /api/object-records/uploads/
Creates Object Record Upload instance.
Permissions
Requires authentication
Request example
- Headers
Request Method: POST
Content-Type: application/json
Authorization: JWT access_tokenBody
| Key | Notes |
|---|---|
| object_class | Object Class ID |
| object_class_field | Object Class Field ID |
Validations
- object_class
- integer
- required
- must be a valid Class ID
- user sending the request must have permission to object_records.create for this Object Class
- object_class_field
- integer
- required
- must be a valid field in the specified Object Class and of type "document"
Sample request body
POST /api/object-records/uploads/
json
{
"object_class": <object_class_id>,
"object_class_field": <object_class_field_id>
}Response
| Key | Type | Notes |
|---|---|---|
| upload_id | UUID | Automatically generated by the backend. |
json
{
"upload_id": <UUID>
}Errors
| Cause | Response code | Message |
|---|---|---|
| object_class is invalid | 400 Bad Request | "object_class": ["Invalid pk "99999" - object does not exist."] |
| object_class is not int | 400 Bad Request | "object_class": ["Incorrect type. Expected pk value, received str."] |
| object_class is required | 400 Bad Request | "object_class": ["This field is required."] |
| object_class is empty | 400 Bad Request | "object_class": ["This field may not be null."] |
| insufficient permissions to object_class | 400 Bad Request | "object_class": ["You do not have permission to use this object class."] |
| object_class_field is invalid | 400 Bad Request | "object_class_field": ["Invalid pk "99999" - object does not exist."] |
| object_class_field is not int | 400 Bad Request | "object_class_field": ["Incorrect type. Expected pk value, received str."] |
| object_class_field is required | 400 Bad Request | "object_class_field": ["This field is required."] |
| object_class_field is empty | 400 Bad Request | "object_class_field": ["This field may not be null."] |
| object_class_field is not document type | 400 Bad Request | "object_class_field": ["Invalid type - field "field name" is not Document type."] |
| object_class_field does not belong to object_class | 400 Bad Request | "details": ["Object Class Field ID "field_id" does not belong to Object Class ID "class_id"."] |
GET /api/object-records/uploads/me/
Endpoint retrieving the list of upload sessions.
Permissions
Requires authentication and uploads.list permission.
Request example
- Headers
Request Method: GET
Location: /api/object-records/uploads/me/
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| upload_id | UUID | |
| object_class_name | str | |
| document_field_name | str | |
| zip_filename | str | |
| process_initiated | datetime | |
| total_files | int | |
| status | enum | |
| _meta.permissions | Object |
Response example
- Status
200 OK - Body
json
{
"limit": 50,
"offset": 0,
"filtered_count": 2,
"total_count": 2,
"next": null,
"previous": null,
"results": [
{
"upload_id": "3c2b9b89-2f2a-497c-aa0a-1be5a8fd93c8",
"object_class_name": "Invoices",
"document_field_name": "Invoices ready",
"zip_filename": "jan2025_invoices.zip",
"process_initiated": "2025-06-20T14:32:10.341Z",
"total_files": 20,
"status": "complete with fails",
"_meta": {
"permissions": {
"list": true,
"view": true
}
}
},
{
"upload_id": "23ae9b77-1f3e-4aa9-87a4-b9c3a7ef481c",
"object_class_name": "Payments",
"document_field_name": "Payments file",
"zip_filename": "april_payments.zip",
"process_initiated": "2025-04-11T11:02:00.134Z",
"total_files": 12,
"status": "complete",
"_meta": {
"permissions": {
"list": true,
"view": true
}
]
}
}
]
}Sorting
Not available. Results are sorted by {process_initiated} descending.
Filtering
Please check ALX API standards for predicates available per type.
| Parameter | Type |
|---|---|
| status | enum |
Errors
| Error | Response code | Message |
|---|---|---|
| Not authenticated | 401 Unauthorized | "detail": "Authentication credentials were not provided." |
GET /api/object-records/uploads/upload_id/summary/
Endpoint retrieving single upload summary.
Permissions
Requires authentication and uploads.view permission.
Request example
- Headers
Request Method: GET
Location: /api/object-records/uploads/`upload_id`/summary/
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| upload_id | UUID | |
| object_class_name | str | |
| document_field_name | str | |
| zip_filename | str | |
| process_completed | datetime | |
| total_files | int | |
| successful_count | int | |
| successful_percent | int | |
| failed_count | int | |
| failed_percent | int | |
| _meta.permissions | Object |
Response example
- Status
200 OK - Body
json
{
"upload_id": "3c2b9b89-2f2a-497c-aa0a-1be5a8fd93c8",
"object_class_name": "Invoice",
"document_field_name": "field_invoice_document",
"zip_filename": "jan2025_invoices.zip",
"process_completed": "2025-06-20T14:32:10.341Z",
"total_files": 20,
"successful_count": 17,
"successful_percent": 85,
"failed_count": 3,
"failed_percent": 15,
"_meta": {
"permissions": {
"list": true,
"view": true
}
}
}Errors
| Error | Response code | Message |
|---|---|---|
| Not authenticated | 401 Unauthorized | "detail": "Authentication credentials were not provided." |
| Upload not found or invalid ID | 404 Not Found | "detail": "Not found." |
| Upload is still being processed | 404 Not Found | "detail": "Not found." |
GET /api/object-records/uploads/upload_id/files/
Endpoint retrieving the list of completed upload files.
Permissions
Requires authentication and uploads.view permission.
Request example
- Headers
Request Method: GET
Location: /api/object-records/uploads/`upload_id`/files/
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| file_name | str | |
| file_size | str | |
| status | enum | |
| record_id | id | |
| created_at | datetime | |
| error_reason | Object |
Response example
- Status
200 OK - Body
json
{
"limit": 50,
"offset": 0,
"filtered_count": 3,
"total_count": 3,
"next": null,
"previous": null,
"results": [
{
"file_name": "invoice_002.pdf",
"file_size": 58723,
"status": "successful",
"record_id": 7891,
"created_at": "2025-06-20T14:36:45.410Z",
"error_reason": null
},
{
"file_name": "invoice_001.pdf",
"file_size": 45678,
"status": "successful",
"record_id": 7842,
"created_at": "2025-06-20T14:31:00.120Z",
"error_reason": null
},
{
"file_name": "broken_scan.tiff",
"file_size": 38791,
"status": "failed",
"record_id": null,
"created_at": null,
"error_reason": "Unsupported file format: .tiff"
}
]
}Sorting
| Parameter | Example | Notes |
|---|---|---|
| created_at | {build}/api/object-records/uploads/{upload_id}/files/?ordering=created_a | Ascending |
| created_at | {build}/api/object-records/uploads/{upload_id}/files/?ordering=-created_a | Descending (-) |
| file_name | {build}/api/object-records/uploads/{upload_id}/files/?ordering=file_name | Ascending |
| file_name | {build}/api/object-records/uploads/{upload_id}/files/?ordering=-file_name | Descending (-) |
Filtering
Please check ALX API standards for predicates available per type.
| Parameter | Type |
|---|---|
| status | enum |
Errors
| Error | Response code | Message |
|---|---|---|
| Not authenticated | 401 Unauthorized | "detail": "Authentication credentials were not provided." |
| Upload not found or invalid ID | 404 Not Found | "detail": "Not found." |
| Upload is still being processed | 404 Not Found | "detail": "Not found." |
| Invalid query parameter status | 400 Bad Request | "status": "Select a valid choice. {value} is not one of the available choices." |
OPTIONS /api/object-records/uploads/upload_id/files/
Permissions
Requires authentication only.
Request example
- Headers
Request Method: OPTIONS
Location: /api/object-records/uploads/`upload_id`/files/Response example
- Status
200 OK - Body
json
{
"list": {
"columns": [
{
"alias": "file_name",
"type": "string",
"predicates": [],
"sort_ok": true
},
{
"alias": "file_size",
"type": "int",
"predicates": [],
"sort_ok": false
},
{
"alias": "status",
"type": "enum",
"predicates": [
"exact",
"in"
],
"sort_ok": false,
"values": [
{
"value": "completed",
"text": "Completed"
},
{
"value": "failed",
"text": "Failed"
}
]
},
{
"alias": "record_id",
"type": "int",
"predicates": [],
"sort_ok": false
},
{
"alias": "created_at",
"type": "datetime",
"predicates": [],
"sort_ok": true
},
{
"alias": "error_reason",
"type": "json",
"predicates": [],
"sort_ok": false
}
]
},
"details": {
"schema": []
},
"restrictions": {}
}OPTIONS /api/object-record/uploads/me/
Permissions
Requires authentication only.
Request example
- Headers
Request Method: OPTIONS
Location: /api/object-record/uploads/me/Response example
- Status
200 OK - Body
json
{
"list": {
"columns": [
{
"alias": "upload_id",
"type": "uuid",
"predicates": [],
"sort_ok": false
},
{
"alias": "object_class_name",
"type": "string",
"predicates": [],
"sort_ok": false
},
{
"alias": "document_field_name",
"type": "string",
"predicates": [],
"sort_ok": false
},
{
"alias": "zip_filename",
"type": "string",
"predicates": [],
"sort_ok": false
},
{
"alias": "process_initiated",
"type": "datetime",
"predicates": [],
"sort_ok": true
},
{
"alias": "total_files",
"type": "int",
"predicates": [],
"sort_ok": false
},
{
"alias": "status",
"type": "enum",
"predicates": [
"exact",
"in"
],
"sort_ok": false,
"values": [
{
"value": "pending",
"text": "Pending"
},
{
"value": "in_progress",
"text": "In Progress"
},
{
"value": "completed",
"text": "Completed"
},
{
"value": "failed",
"text": "Failed"
},
{
"value": "completed_with_fails",
"text": "Completed With Fails"
}
]
}
]
},
"details": {
"schema": []
}
}