Batch Operations
The Batch Operations API in Unit4 ERPx helps you monitor and manage long-running asynchronous batch jobs after they have been submitted. It provides visibility into the current processing status, allows you to retrieve result details for failed or successfully processed items, and supports cancellation of active batch jobs when required. This API is useful for high-volume operations such as bulk imports, data synchronisation, and large-scale updates where processing may take time and immediate completion is not expected.
Purpose:
The Batch Operations API is used when you need to submit asynchronous batch jobs, monitor their execution progress, retrieve detailed results (both successes and failures), and optionally cancel jobs if processing takes longer than expected or if business conditions change. The Batch Operations API provides the operational transparency and control needed for enterprise-scale batch processing workflows.
Base URL:/v1/batch-operations
Authentication:
All APIs require a Client ID and Client Secret.
Refer to the global authentication documentation for details.
Supported Methods
| HTTP Method | Endpoint | Description | Limits & Notes |
|---|---|---|---|
| GET | /v1/batch-operations | Retrieves a list of submitted batch operations. | Returns batch jobs and supports optional filtering by controller, method, timeFrom, timeWindow, and status. timeFrom and timeWindow must use valid DateTime and TimeSpan formats respectively. |
| GET | /v1/batch-operations/{batchRequestId}/status | Retrieves the current status and progress of a specific batch operation. | Use this endpoint to poll the batch operation until processing is complete. Status values include N (Pending), W (Working), C (Cancelled), T (Success), E (Error), and K (Cancelling). |
| GET | /v1/batch-operations/{batchRequestId}/results | Retrieves the result file for a completed batch operation. | By default, this endpoint returns validation errors for items that could not be processed. To retrieve successfully processed items, use the optional query parameter type=success. If the batch operation is still processing, the endpoint may return 202 Accepted to indicate that results are not yet available. |
| POST | /v1/batch-operations/{batchRequestId}/cancel | Requests cancellation of an active batch operation. | Use this endpoint only for active jobs that should be stopped, for example because the payload is incorrect, the process is taking longer than expected, or business conditions have changed. Cancellation is not immediate and the job will move to status C (Cancelled) when cancellation is completed. |
Swagger / Schema
Version v1
Method Details
Sample Request
GET /v1/batch-operations?controllerName=AttributeRelationBatch&methodName=CreateBatch&status=TSample Response
(Success - 200 OK)
[
{
"validationErrorCount": 0,
"batchRequestId": "ed95fa34-8d8d-473f-921d-ae408c924875",
"taskId": "0620a281-57ea-4291-9121-ce0cd35f9764-BatchHost-07c3c1a-d272-453f",
"status": "T",
"controllerClass": "AttributeRelationBatch",
"methodName": "CreateBatch",
"description": "",
"processedSize": 3405,
"payloadSize": 3405,
"processedPage": 1,
"processedItems": 10,
"lastUpdated": {
"updatedAt": "2026-06-05T07:59:47.000",
"updatedBy": "SYSEN"
},
"errorMessage": ""
},
{
"validationErrorCount": 0,
"batchRequestId": "867a6569-6344-4a23-9ace-3df7c9a29168",
"taskId": "0620a281-57ea-4291-9121-ce0cd35f9764-BatchHost-4322455-bc02-4f97",
"status": "T",
"controllerClass": "AttributeRelationBatch",
"methodName": "CreateBatch",
"description": "",
"processedSize": 3405,
"payloadSize": 3405,
"processedPage": 1,
"processedItems": 10,
"lastUpdated": {
"updatedAt": "2026-06-05T04:13:57.000",
"updatedBy": "SYSEN"
},
"errorMessage": ""
}
]
Additional Parameters
The following query parameters help filter and shape the response:
| Parameter | Value | Description | Data Type | Default Value |
|---|---|---|---|---|
| controllerName | optional | Name of the batch controller to filter by (e.g. “AttributeRelationBatch”) | string | empty |
| methodName | optional | Name of the controller method to filter by (e.g. “CreateBatch”) | string | empty |
| timeFrom | optional | DateTime of jobs submitted on or after the specified date and time | string | empty |
| timeWindow | optional | TimeSpan to retrieve jobs within a TimeSpan window from | string | empty |
| status | optional | Single job status code to filter by; only jobs with matching status are returned. | string | empty |
Validation Rules for GET Method (Multiple)
GET_001 - User is not authorised
| Element | Details |
|---|---|
| Scenario ID | GET_001 |
| Scenario Name | User is not authorised |
| HTTP Code | 401 |
| GIVEN | List of batch operations needs to be retrieved |
| WHEN | Calling the GET method of the API |
| BUT | User does NOT have permissions or authentication is invalid |
| THEN | API is not reached; 401 Unauthorised response is returned |
| Example Error Message | “User is not authorised.” |
GET_002 - List all jobs with no filter
| Element | Details |
|---|---|
| Scenario ID | GET_002 |
| Scenario Name | List all jobs with no filter |
| HTTP Code | 200 |
| GIVEN | Multiple batch operations exist in the system (AttributeRelationBatch, SalesOrderBatch, CustomerBatch, etc.) |
| WHEN | Calling GET /v1/batch-operations with no query parameters |
| BUT | User has valid authentication and permissions |
| THEN | Returns complete list of all batch jobs across all controllers and methods |
| Example Response | Returns array with all batch operation records (see Sample Response above) |
GET_003 - List jobs filtered by status
| Element | Details |
|---|---|
| Scenario ID | GET_003 |
| Scenario Name | List jobs filtered by status |
| HTTP Code | 200 |
| GIVEN | Multiple batch jobs exist with mixed statuses (N, W, T, E, C) |
| WHEN | Calling GET /v1/batch-operations?status=T |
| BUT | User has valid authentication and permissions |
| THEN | Returns only batch jobs with status = “T” (Success); other statuses excluded |
| Example Response | Returns array containing only jobs where “status”: “T” |
GET_004 - List jobs with multiple filters (controllerName + methodName + status)
| Element | Details |
|---|---|
| Scenario ID | GET_004 |
| Scenario Name | List jobs with multiple filters combined |
| HTTP Code | 200 |
| GIVEN | Multiple AttributeRelationBatch jobs exist with mixed statuses (T, W, E) and different method names (CreateBatch, UpdateBatch) |
| WHEN | Calling GET /v1/batch-operations?controllerName=AttributeRelationBatch&methodName=CreateBatch&status=T |
| BUT | User has valid authentication and permissions |
| THEN | Returns only jobs matching ALL three criteria: controllerName=AttributeRelationBatch AND methodName=CreateBatch AND status=T |
| Example Response | Returns array with jobs matching all filter conditions (see Sample Response above) |
GET_005 - Invalid timeFrom format (400 Bad Request)
| Element | Details |
|---|---|
| Scenario ID | GET_005 |
| Scenario Name | Invalid timeFrom format |
| HTTP Code | 400 |
| GIVEN | Query includes timeFrom parameter with invalid DateTime value |
| WHEN | Calling GET /v1/batch-operations?timeFrom=14/2026/32 |
| BUT | Value does not match ISO 8601 DateTime format |
| THEN | 400 Bad Request response is returned with validation error |
| Example Error Message | timeFrom not a valid DateTime format '14/2026/32'. |
GET_006 - Invalid timeWindow format (400 Bad Request)
| Element | Details |
|---|---|
| Scenario ID | GET_006 |
| Scenario Name | Invalid timeWindow format |
| HTTP Code | 400 |
| GIVEN | Query includes timeWindow parameter with invalid TimeSpan value |
| WHEN | Calling GET /v1/batch-operations?timeWindow=25.01 |
| BUT | Value does not match ISO 8601 Duration format (e.g. PT24H, P1D) |
| THEN | 400 Bad Request response is returned with validation error |
| Example Error Message | timeWindow not a valid TimeSpan format '25.01'. |
Sample Request
GET /v1/batch-operations/ed95fa34-8d8d-473f-921d-ae408c924875/statusSample Response
(Success - 200 OK)
{
"processorResult": "SuccessWithValidationErrors",
"errorReason": "None",
"validationErrorCount": 10,
"batchRequestId": "ed95fa34-8d8d-473f-921d-ae408c924875",
"taskId": "0620a281-57ea-4291-9121-ce0cd35f9764-BatchHost-07c3c1a-d272-453f",
"status": "T",
"controllerClass": "AttributeRelationBatch",
"methodName": "CreateBatch",
"description": "",
"processedSize": 3405,
"payloadSize": 3405,
"processedPage": 1,
"processedItems": 10,
"lastUpdated": {
"updatedAt": "2026-06-05T07:59:47.000",
"updatedBy": "SYSEN"
},
"errorMessage": ""
}
Path Parameters
The following parameters are required in the URL path:
| Parameter | Value | Description | Data Type | Required |
|---|---|---|---|---|
| batchRequestId | required | Unique identifier of the batch operation to retrieve. You obtain the batchRequestId from the response headers in the “Location” property when submitting or processing the batch. Must be a valid UUID format (e.g., ed95fa34-8d8d-473f-921d-ae408c924875). | string (UUID) | yes |
Limits & Notes
- Use this endpoint to quickly check whether your batch is still waiting, running, finished, failed, or cancelled.
- Query it every 10 to 30 seconds while the batch is in progress; once the status is final, you can stop checking.
- A batch with status T (Success) may still contain some validation issues, so always review validationErrorCount.
- If the batch ends with E (Error), check errorReason and errorMessage to understand the failure.
- If the batch ends with C (Cancelled), processing stopped before completion and only partial results may exist.
- The response is most useful for progress tracking, while detailed success or error records should be retrieved from the results endpoint.
Status Codes for This Endpoint
When you call this endpoint, the batch will be in one of these states:
- N (Pending) — your batch was submitted but has not started processing yet. The system is preparing it. Query again in a few seconds to see progress.
- W (Working) — your batch is actively being processed right now. Check processedItems (how many items done) and validationErrorCount (errors so far) to track progress. These numbers will increase with each query.
- T (Success) — processing is complete. Important: status = T does NOT mean zero errors. Always check validationErrorCount. If > 0, some items had validation issues but were still processed. Download error records via GET /v1/batch-operations/{batchRequestId}/results?type=error to see which items failed validation.
- E (Error) — processing failed. Check errorReason and errorMessage for the failure reason. This is a critical error, not individual item validation errors.
- C (Cancelled) — batch was cancelled (by you or the system). Processing stopped early. Partial results may be available via GET /results.
- K (Cancelling) — batch is in the process of being cancelled. This is temporary, status will change to C within seconds.
Validation Rules for GET Method (Status)
GET_001 - User is not authorised
| Element | Details |
|---|---|
| Scenario ID | GET_001 |
| Scenario Name | User is not authorised |
| HTTP Code | 401 |
| GIVEN | A specific batch operation status needs to be retrieved |
| WHEN | Calling the GET method of the API with a batchRequestId |
| BUT | User does NOT have permissions or authentication is invalid |
| THEN | API is not reached; 401 Unauthorised response is returned |
| Example Error Message | Unauthorized. |
GET_002 - Batch request ID does not exist
| Element | Details |
|---|---|
| Scenario ID | GET_002 |
| Scenario Name | Batch request ID does not exist |
| HTTP Code | 404 |
| GIVEN | A batch operation with the requested ID was never created. |
| WHEN | Calling GET /v1/batch-operations/{batchRequestId}/status with non-existent or invalid batchRequestId |
| BUT | User has valid authentication and permissions |
| THEN | 404 Not Found response is returned; batch record not located |
| Example Error Message | “Requested entity was not found.” |
GET_003 - Batch job with status W (Working)
| Element | Details |
|---|---|
| Scenario ID | GET_003 |
| Scenario Name | Batch job with status W (Working) |
| HTTP Code | 200 |
| GIVEN | Batch operation is actively processing items (submitted 20 seconds ago, still in progress) |
| WHEN | Calling GET /v1/batch-operations/{batchRequestId}/status while job is executing |
| BUT | User has valid authentication and permissions |
| THEN | 200 OK response returned with status = “W”, showing current progress (processedItems, processedSize, validationErrorCount incrementing) |
| Example Response | {“status”: “W”, “processedItems”: 450, “processedSize”: 1890000, “validationErrorCount”: 5, “processorResult”: “PROCESSING”} |
GET_004 - Batch job with status T (Success)
| Element | Details |
|---|---|
| Scenario ID | GET_004 |
| Scenario Name | Batch job with status T (Success) |
| HTTP Code | 200 |
| GIVEN | Batch operation completed successfully with some validation errors detected during processing |
| WHEN | Calling GET /v1/batch-operations/{batchRequestId}/status on completed batch |
| BUT | User has valid authentication and permissions |
| THEN | 200 OK response returned with status = “T”, processorResult showing “SuccessWithValidationErrors”, validationErrorCount populated, errorMessage empty |
| Example Response | {“status”: “T”, “processorResult”: “SuccessWithValidationErrors”, “processedItems”: 1000, “validationErrorCount”: 10, “errorMessage”: “”} |
GET_005 - Batch job with status E (Error)
| Element | Details |
|---|---|
| Scenario ID | GET_005 |
| Scenario Name | Batch job with status E (Error) |
| HTTP Code | 200 |
| GIVEN | Batch operation encountered a critical processing error and failed |
| WHEN | Calling GET /v1/batch-operations/{batchRequestId}/status on failed batch |
| BUT | User has valid authentication and permissions |
| THEN | 200 OK response returned with status = “E”, processorResult = “FAILURE”, errorReason and errorMessage populated with failure details |
| Example Response | {“status”: “E”, “processorResult”: “FAILURE”, “errorReason”: “Database Connection Timeout”, “errorMessage”: “Unable to connect to database after 30 seconds”} |
GET_006 - Batch job with status C (Cancelled)
| Element | Details |
|---|---|
| Scenario ID | GET_006 |
| Scenario Name | Batch job with status C (Cancelled) |
| HTTP Code | 200 |
| GIVEN | Batch operation was cancelled by user via POST cancel endpoint while processing |
| WHEN | Calling GET /v1/batch-operations/{batchRequestId}/status on cancelled batch |
| BUT | User has valid authentication and permissions |
| THEN | 200 OK response returned with status = “C”, processorResult = “CANCELLED”, errorReason = “User Request”, showing partial progress (processedItems < total expected) |
| Example Response | {“status”: “C”, “processorResult”: “CANCELLED”, “errorReason”: “User Request”, “processedItems”: 450, “payloadSize”: 5242880} |
Sample Request
GET /v1/batch-operations/ed95fa34-8d8d-473f-921d-ae408c924875/results?type=successSample Response
(Success - 200 OK)
[
{
"index": 0,
"item": {
"attributeName": "MGA81",
"attributeId": "M81",
"attributeValue": "M81_004001",
"companyId": "EN",
"relationDateFrom": "0001-01-01T00:00:00",
"relationDateTo": "0001-01-01T00:00:00",
"percent": 100.0,
"relatedAttributeName": "MGA82",
"relatedAttributeId": "M82",
"relationValue": "M82_004001",
"relationValueStatus": "N",
"notificationMessages": {
"_objectMessages": [
{
"code": 3010,
"message": "The entity of the following parameters [Company : EN, Attribute ID : M81, Attribute value : M81_004001] was not found."
}
]
}
}
}
]
Limits & Notes
- This endpoint is for final output retrieval, so call it after status becomes a final state (T, E, or C).
- Use type=error for failed or invalid records and type=success for successfully processed records.
- If the batch is still running, the API can return 202 Accepted; continue polling status and retry later.
- A successful response (200) confirms result availability, not business correctness of every record.
Validation Rules for GET Method (Results)
GET_001 - User is not authorised
| Element | Details |
|---|---|
| Scenario ID | GET_001 |
| Scenario Name | User is not authorised |
| HTTP Code | 401 Unauthorised |
| GIVEN | A user without valid authentication or permission to access batch results |
| WHEN | The user calls GET /v1/batch-operations/{batchRequestId}/results?type=success |
| BUT | The batchRequestId and query format are valid |
| THEN | API returns 401 and no result payload |
| Example Error | Unauthorized |
GET_002 - Result available (error)
| Element | Details |
|---|---|
| Scenario ID | GET_002 |
| Scenario Name | Result available (error) |
| HTTP Code | 200 OK |
| GIVEN | Batch processing is completed and error result file exists |
| WHEN | Client calls GET /v1/batch-operations/{batchRequestId}/results?type=error |
| BUT | Batch contains validation or processing errors |
| THEN | API returns 200 with error result records |
| Example Error | N/A (successful retrieval) |
GET_003 - Result available (success)
| Element | Details |
|---|---|
| Scenario ID | GET_003 |
| Scenario Name | Result available (success) |
| HTTP Code | 200 OK |
| GIVEN | Batch processing is completed and success result file exists |
| WHEN | Client calls GET /v1/batch-operations/{batchRequestId}/results?type=success |
| BUT | Some records may still include notification messages |
| THEN | API returns 200 with success result records |
| Example Error | N/A (successful retrieval) |
GET_004 - Job still processing
| Element | Details |
|---|---|
| Scenario ID | GET_004 |
| Scenario Name | Job still processing |
| HTTP Code | 202 Accepted |
| GIVEN | Batch exists but status is still N or W |
| WHEN | Client calls GET /v1/batch-operations/{batchRequestId}/results?type=error or type=success |
| BUT | Result file has not been generated yet |
| THEN | API returns 202 indicating results are not ready |
| Example Error | Batch request is still processing. Results are not available yet. |
GET_005 - Batch request id not found
| Element | Details |
|---|---|
| Scenario ID | GET_005 |
| Scenario Name | Batch request id not found |
| HTTP Code | 404 Not Found |
| GIVEN | batchRequestId does not exist |
| WHEN | Client calls GET /v1/batch-operations/{batchRequestId}/results?type=error |
| BUT | Authentication is valid |
| THEN | API returns 404 because no batch result can be located |
| Example Error Message | Requested entity was not found. |
GET_006 - Invalid type parameter
| Element | Details |
|---|---|
| Scenario ID | GET_006 |
| Scenario Name | Invalid type parameter |
| HTTP Code | 400 Bad Request |
| GIVEN | A valid batchRequestId |
| WHEN | Client calls GET /v1/batch-operations/{batchRequestId}/results?type=failed |
| BUT | type must be only error or success |
| THEN | API returns 400 with validation message |
| Example Error Message | Invalid filter 'failed'. Allowed values are 'error' and 'success'. |
Sample Request
POST /v1/batch-operations/159f2879-c6b7-4cbc-b42a-c89d11d342f1/cancelSample Response
(Success - 200 OK)
{
"batchRequestId": "159f2879-c6b7-4cbc-b42a-c89d11d342f1",
"status": "C",
"processorResult": "CANCELLED",
"errorReason": "User Request",
"errorMessage": ""
}
Limits & Notes
- Use this endpoint when you decide a running batch should stop, for example due to wrong input data or changed priorities.
- Cancellation is asynchronous: first response confirms the request, while final status may briefly show the status K before becoming C.
- Cancel works best for jobs in status N or W; already finished jobs (T, E, C) will not be reprocessed by cancel.
- Always verify final status through the status endpoint after requesting cancel.
- Keep the batchRequestId for audit and support tracking of who cancelled and when.
Validation Rules for POST Method (Cancel)
POST_001 - User is not authorised
| Element | Details |
|---|---|
| Scenario ID | POST_001 |
| Scenario Name | User is not authorised |
| HTTP Code | 401 Unauthorised |
| GIVEN | A user without valid authentication or permission to cancel batch jobs |
| WHEN | The user calls POST /v1/batch-operations/{batchRequestId}/cancel |
| BUT | The batchRequestId format is valid |
| THEN | API returns 401 and the batch is not cancelled |
| Example Error | Unauthorized |
POST_002 - Batch request id not found
| Element | Details |
|---|---|
| Scenario ID | POST_002 |
| Scenario Name | Batch request id not found |
| HTTP Code | 404 Not Found |
| GIVEN | batchRequestId does not exist |
| WHEN | Client calls POST /v1/batch-operations/{batchRequestId}/cancel |
| BUT | Authentication is valid |
| THEN | API returns 404 because the batch cannot be located |
| Example Error | Requested entity was not found |
POST_003 - Cancel request accepted for running job
| Element | Details |
|---|---|
| Scenario ID | POST_003 |
| Scenario Name | Cancel request accepted for running job |
| HTTP Code | 200 OK |
| GIVEN | Batch exists and current status is N (Pending) or W (Working) |
| WHEN | Client calls POST /v1/batch-operations/{batchRequestId}/cancel |
| BUT | Authentication and permissions are valid |
| THEN | API returns 200 and batch moves to K (Cancelling) then C (Cancelled) |
| Example Error | N/A (successful cancellation flow) |
POST_004 - Batch already completed
| Element | Details |
|---|---|
| Scenario ID | POST_004 |
| Scenario Name | Batch already completed |
| HTTP Code | 200 OK |
| GIVEN | Batch status is already final (T, E, or C) |
| WHEN | Client calls POST /v1/batch-operations/{batchRequestId}/cancel |
| BUT | Batch cannot be actively cancelled anymore |
| THEN | API returns current batch state without changing completed outcome |
| Example Error | N/A |
POST_005 - Duplicate cancel request
| Element | Details |
|---|---|
| Scenario ID | POST_005 |
| Scenario Name | Duplicate cancel request |
| HTTP Code | 200 OK |
| GIVEN | A cancel request was already submitted for the same batch |
| WHEN | Client sends POST /cancel again |
| BUT | The batch is already K or C |
| THEN | API returns current state; no duplicate cancellation side effects |
| Example Error Message | N/A |
Best Practices
- Use the GET /v1/batch-operations/{batchRequestId}/status endpoint as your primary monitoring tool throughout the lifecycle.
- Poll every 10–30 seconds while processing (status = W). Stop once status reaches final state (T, E, or C).
- Never assume T (Success) means zero errors. Always check validationErrorCount before business acceptance.
- Retrieve results only after status is final. Download both success and error records for complete reconciliation.
- If status = E, immediately review errorReason and errorMessage for failure diagnostics.
- Use POST /v1/batch-operations/{batchRequestId}/cancel only when there is a clear business reason, expect partial processing.
- Keep and share batchRequestId in operation communication for quick traceability and support troubleshooting.
- Validate API authentication, parameter formats, and UUID format to handle common errors (401, 400, 404)
- Use the GET /v1/batch-operations endpoint with filters to track multiple related batches and operational visibility.