1. U4 ERPx
  2. API Reference
  3. System administration
  4. Batch Operations

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 MethodEndpointDescriptionLimits & Notes
GET/v1/batch-operationsRetrieves 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}/statusRetrieves 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}/resultsRetrieves 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}/cancelRequests 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=T

Sample 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:

ParameterValueDescriptionData TypeDefault Value
controllerNameoptionalName of the batch controller to filter by (e.g. “AttributeRelationBatch”)stringempty
methodNameoptionalName of the controller method to filter by (e.g. “CreateBatch”)stringempty
timeFromoptionalDateTime of jobs submitted on or after the specified date and timestringempty
timeWindowoptionalTimeSpan to retrieve jobs within a TimeSpan window fromstringempty
statusoptionalSingle job status code to filter by; only jobs with matching status are returned.stringempty

   

Validation Rules for GET Method (Multiple)

GET_001 - User is not authorised
ElementDetails
Scenario IDGET_001
Scenario NameUser is not authorised
HTTP Code401
GIVENList of batch operations needs to be retrieved
WHENCalling the GET method of the API
BUTUser does NOT have permissions or authentication is invalid
THENAPI is not reached; 401 Unauthorised response is returned
Example Error Message“User is not authorised.”
GET_002 - List all jobs with no filter
ElementDetails
Scenario IDGET_002
Scenario NameList all jobs with no filter
HTTP Code200
GIVENMultiple batch operations exist in the system (AttributeRelationBatch, SalesOrderBatch, CustomerBatch, etc.)
WHENCalling GET /v1/batch-operations with no query parameters
BUTUser has valid authentication and permissions
THENReturns complete list of all batch jobs across all controllers and methods
Example ResponseReturns array with all batch operation records (see Sample Response above)
GET_003 - List jobs filtered by status
ElementDetails
Scenario IDGET_003
Scenario NameList jobs filtered by status
HTTP Code200
GIVENMultiple batch jobs exist with mixed statuses (N, W, T, E, C)
WHENCalling GET /v1/batch-operations?status=T
BUTUser has valid authentication and permissions
THENReturns only batch jobs with status = “T” (Success); other statuses excluded
Example ResponseReturns array containing only jobs where “status”: “T”
GET_004 - List jobs with multiple filters (controllerName + methodName + status)
ElementDetails
Scenario IDGET_004
Scenario NameList jobs with multiple filters combined
HTTP Code200
GIVENMultiple AttributeRelationBatch jobs exist with mixed statuses (T, W, E) and different method names (CreateBatch, UpdateBatch)
WHENCalling GET /v1/batch-operations?controllerName=AttributeRelationBatch&methodName=CreateBatch&status=T
BUTUser has valid authentication and permissions
THENReturns only jobs matching ALL three criteria: controllerName=AttributeRelationBatch AND methodName=CreateBatch AND status=T
Example ResponseReturns array with jobs matching all filter conditions (see Sample Response above)
GET_005 - Invalid timeFrom format (400 Bad Request)
ElementDetails
Scenario IDGET_005
Scenario NameInvalid timeFrom format
HTTP Code400
GIVENQuery includes timeFrom parameter with invalid DateTime value
WHENCalling GET /v1/batch-operations?timeFrom=14/2026/32
BUTValue does not match ISO 8601 DateTime format
THEN400 Bad Request response is returned with validation error
Example Error MessagetimeFrom not a valid DateTime format '14/2026/32'.
GET_006 - Invalid timeWindow format (400 Bad Request)
ElementDetails
Scenario IDGET_006
Scenario NameInvalid timeWindow format
HTTP Code400
GIVENQuery includes timeWindow parameter with invalid TimeSpan value
WHENCalling GET /v1/batch-operations?timeWindow=25.01
BUTValue does not match ISO 8601 Duration format (e.g. PT24H, P1D)
THEN400 Bad Request response is returned with validation error
Example Error MessagetimeWindow not a valid TimeSpan format '25.01'.

   

Sample Request

GET /v1/batch-operations/ed95fa34-8d8d-473f-921d-ae408c924875/status

Sample 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:

ParameterValueDescriptionData TypeRequired
batchRequestIdrequiredUnique 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
ElementDetails
Scenario IDGET_001
Scenario NameUser is not authorised
HTTP Code401
GIVENA specific batch operation status needs to be retrieved
WHENCalling the GET method of the API with a batchRequestId
BUTUser does NOT have permissions or authentication is invalid
THENAPI is not reached; 401 Unauthorised response is returned
Example Error MessageUnauthorized.
GET_002 - Batch request ID does not exist
ElementDetails
Scenario IDGET_002
Scenario NameBatch request ID does not exist
HTTP Code404
GIVENA batch operation with the requested ID was never created.
WHENCalling GET /v1/batch-operations/{batchRequestId}/status with non-existent or invalid batchRequestId
BUTUser has valid authentication and permissions
THEN404 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)
ElementDetails
Scenario IDGET_003
Scenario NameBatch job with status W (Working)
HTTP Code200
GIVENBatch operation is actively processing items (submitted 20 seconds ago, still in progress)
WHENCalling GET /v1/batch-operations/{batchRequestId}/status while job is executing
BUTUser has valid authentication and permissions
THEN200 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)
ElementDetails
Scenario IDGET_004
Scenario NameBatch job with status T (Success)
HTTP Code200
GIVENBatch operation completed successfully with some validation errors detected during processing
WHENCalling GET /v1/batch-operations/{batchRequestId}/status on completed batch
BUTUser has valid authentication and permissions
THEN200 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)
ElementDetails
Scenario IDGET_005
Scenario NameBatch job with status E (Error)
HTTP Code200
GIVENBatch operation encountered a critical processing error and failed
WHENCalling GET /v1/batch-operations/{batchRequestId}/status on failed batch
BUTUser has valid authentication and permissions
THEN200 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)
ElementDetails
Scenario IDGET_006
Scenario NameBatch job with status C (Cancelled)
HTTP Code200
GIVENBatch operation was cancelled by user via POST cancel endpoint while processing
WHENCalling GET /v1/batch-operations/{batchRequestId}/status on cancelled batch
BUTUser has valid authentication and permissions
THEN200 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=success

Sample 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
ElementDetails
Scenario IDGET_001
Scenario NameUser is not authorised
HTTP Code401 Unauthorised
GIVENA user without valid authentication or permission to access batch results
WHENThe user calls GET /v1/batch-operations/{batchRequestId}/results?type=success
BUTThe batchRequestId and query format are valid
THENAPI returns 401 and no result payload
Example ErrorUnauthorized
GET_002 - Result available (error)
ElementDetails
Scenario IDGET_002
Scenario NameResult available (error)
HTTP Code200 OK
GIVENBatch processing is completed and error result file exists
WHENClient calls GET /v1/batch-operations/{batchRequestId}/results?type=error
BUTBatch contains validation or processing errors
THENAPI returns 200 with error result records
Example ErrorN/A (successful retrieval)
GET_003 - Result available (success)
ElementDetails
Scenario IDGET_003
Scenario NameResult available (success)
HTTP Code200 OK
GIVENBatch processing is completed and success result file exists
WHENClient calls GET /v1/batch-operations/{batchRequestId}/results?type=success
BUTSome records may still include notification messages
THENAPI returns 200 with success result records
Example ErrorN/A (successful retrieval)
GET_004 - Job still processing
ElementDetails
Scenario IDGET_004
Scenario NameJob still processing
HTTP Code202 Accepted
GIVENBatch exists but status is still N or W
WHENClient calls GET /v1/batch-operations/{batchRequestId}/results?type=error or type=success
BUTResult file has not been generated yet
THENAPI returns 202 indicating results are not ready
Example ErrorBatch request is still processing. Results are not available yet.
GET_005 - Batch request id not found
ElementDetails
Scenario IDGET_005
Scenario NameBatch request id not found
HTTP Code404 Not Found
GIVENbatchRequestId does not exist
WHENClient calls GET /v1/batch-operations/{batchRequestId}/results?type=error
BUTAuthentication is valid
THENAPI returns 404 because no batch result can be located
Example Error MessageRequested entity was not found.
GET_006 - Invalid type parameter
ElementDetails
Scenario IDGET_006
Scenario NameInvalid type parameter
HTTP Code400 Bad Request
GIVENA valid batchRequestId
WHENClient calls GET /v1/batch-operations/{batchRequestId}/results?type=failed
BUTtype must be only error or success
THENAPI returns 400 with validation message
Example Error MessageInvalid filter 'failed'. Allowed values are 'error' and 'success'.

   

Sample Request

POST /v1/batch-operations/159f2879-c6b7-4cbc-b42a-c89d11d342f1/cancel

Sample 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
ElementDetails
Scenario IDPOST_001
Scenario NameUser is not authorised
HTTP Code401 Unauthorised
GIVENA user without valid authentication or permission to cancel batch jobs
WHENThe user calls POST /v1/batch-operations/{batchRequestId}/cancel
BUTThe batchRequestId format is valid
THENAPI returns 401 and the batch is not cancelled
Example ErrorUnauthorized
POST_002 - Batch request id not found
ElementDetails
Scenario IDPOST_002
Scenario NameBatch request id not found
HTTP Code404 Not Found
GIVENbatchRequestId does not exist
WHENClient calls POST /v1/batch-operations/{batchRequestId}/cancel
BUTAuthentication is valid
THENAPI returns 404 because the batch cannot be located
Example ErrorRequested entity was not found
POST_003 - Cancel request accepted for running job
ElementDetails
Scenario IDPOST_003
Scenario NameCancel request accepted for running job
HTTP Code200 OK
GIVENBatch exists and current status is N (Pending) or W (Working)
WHENClient calls POST /v1/batch-operations/{batchRequestId}/cancel
BUTAuthentication and permissions are valid
THENAPI returns 200 and batch moves to K (Cancelling) then C (Cancelled)
Example ErrorN/A (successful cancellation flow)
POST_004 - Batch already completed
ElementDetails
Scenario IDPOST_004
Scenario NameBatch already completed
HTTP Code200 OK
GIVENBatch status is already final (T, E, or C)
WHENClient calls POST /v1/batch-operations/{batchRequestId}/cancel
BUTBatch cannot be actively cancelled anymore
THENAPI returns current batch state without changing completed outcome
Example ErrorN/A
POST_005 - Duplicate cancel request
ElementDetails
Scenario IDPOST_005
Scenario NameDuplicate cancel request
HTTP Code200 OK
GIVENA cancel request was already submitted for the same batch
WHENClient sends POST /cancel again
BUTThe batch is already K or C
THENAPI returns current state; no duplicate cancellation side effects
Example Error MessageN/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.