Documentation
Feedback
Guides
API Reference

Guides
Guides
Logistics

Batch inventory updates (Beta)

Learn how to update large volumes of inventory data asynchronously using the new Batch operations endpoints in the Logistics API.

This feature is in early access, which means that we are working to improve it. If you want to use this feature, please contact our Support Center.

The Batch operations endpoints of the Logistics API let you update large volumes of inventory data asynchronously by uploading a single CSV file to Amazon S3 and tracking its processing through the API. This flow is designed for scenarios such as full inventory refreshes and bulk synchronizations, where the existing per-SKU endpoints would require too many requests.

This guide walks you through the end-to-end flow: creating a batch job, uploading the CSV file, committing the batch for processing, polling the processing status, and downloading the error report if there are failed rows.

The integration involves four API endpoints and one direct upload to the pre-signed S3 URL returned by VTEX:

  1. Create batch: Call the Create batch inventory job endpoint to register a new batch. The response includes a batchId and a pre-signed S3 URL for the CSV upload.
  2. Upload CSV: Upload the CSV file directly to S3 using the pre-signed URL. This step does not go through the VTEX API.
  3. Commit batch: Call the Commit batch inventory endpoint to confirm the upload and queue the batch for processing.
  4. Monitor processing: Poll the Get batch inventory status endpoint until the batch reaches a terminal status.
  5. Download error report (optional): If the status response indicates errorCount > 0, call the Get batch inventory errors endpoint to retrieve a pre-signed URL for the error CSV.

Create a batch inventory job

Use the Create batch inventory job endpoint to register a new batch. The response returns the batchId you will use throughout the flow and the pre-signed upload object you will use to send the CSV to S3.

Response example:


_12
{
_12
"batchId": "550e8400-e29b-41d4-a716-446655440000",
_12
"status": "AWAITING_UPLOAD",
_12
"upload": {
_12
"method": "PUT",
_12
"url": "https://availability-bulk-upload.s3.amazonaws.com/550e8400-e29b-41d4-a716-446655440000.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
_12
"headers": {
_12
"Content-Type": "text/csv"
_12
},
_12
"expiresAt": "2026-01-12T20:10:00Z"
_12
}
_12
}

The batch starts in AWAITING_UPLOAD status and remains in this state until the CSV is uploaded and committed.

The pre-signed URL returned in url is valid for 30 minutes (see expiresAt). If the URL expires before you upload the file, create a new batch.

Upload the CSV to S3 (data plane)

Upload the CSV file directly to S3 using the url returned by the Create batch inventory job endpoint. This request does not go through the VTEX API.

Keep the following requirements in mind:

  • Submit every field following the order defined in the CSV file.
  • The CSV file name must match the batchId returned in the Create batch inventory job response (for example, 550e8400-e29b-41d4-a716-446655440000.csv).
  • Use the HTTP method (PUT) and headers (Content-Type: text/csv) returned in the upload object.

Example request:


_10
curl -X PUT \
_10
"{presignedUrl}" \
_10
-H "Content-Type: text/csv" \
_10
--data-binary "@550e8400-e29b-41d4-a716-446655440000.csv"

Replace {presignedUrl} with the value returned in url. A successful upload returns an HTTP 200 OK response from S3.

Commit the batch

After uploading the CSV to S3, call the Commit batch inventory endpoint, passing the batchId as a path parameter. This request confirms that the upload is complete and triggers the asynchronous processing of the batch.

A successful commit returns an HTTP 202 Accepted response, and the batch transitions to the QUEUED status. From this point on, processing is handled asynchronously by VTEX, and you can use the status endpoint to track progress.

If you call this endpoint twice in parallel for the same batchId, the second request will receive a 423 Locked response. Wait for the first commit to complete before retrying.

Monitor the batch status

Use the Get batch inventory status endpoint to track the processing progress of the batch. The response returns row counts, error counts, percentage completed, processing stages, and a final summary once the batch is processed.

Response example:


_26
{
_26
"batchId": "550e8400-e29b-41d4-a716-446655440000",
_26
"status": "PROCESSING",
_26
"rowCount": 13800000,
_26
"processedCount": 8500000,
_26
"errorCount": 0,
_26
"amountCompleted": 61,
_26
"createdAt": "2026-01-12T20:00:00Z",
_26
"startedAt": "2026-01-12T20:01:00Z",
_26
"stages": {
_26
"ingestedChunks": 276,
_26
"classifiedChunks": 250,
_26
"processedChunks": 170,
_26
"notifiedChunks": 165,
_26
"totalChunks": 276
_26
},
_26
"summary": {
_26
"insertCount": 5200000,
_26
"updateCount": 3100000,
_26
"noopCount": 200000,
_26
"conflictCount": 0,
_26
"skippedDueApiUpdateCount": 0,
_26
"perItemRoutedCount": 0,
_26
"dlqEventsCount": 0
_26
}
_26
}

The status field can return the following values:

StatusDescription
AWAITING_UPLOADBatch created, waiting for CSV upload.
QUEUEDUpload committed, waiting to begin processing.
PROCESSINGBatch is currently being processed.
COMPLETEDAll rows processed successfully.
COMPLETED_WITH_ERRORSProcessing finished with some row errors.
FAILEDProcessing failed due to validation or system errors.
EXPIREDBatch metadata has expired.

COMPLETED, COMPLETED_WITH_ERRORS, FAILED, and EXPIRED are terminal statuses. Once any of these is returned, no further updates will be made to the batch and you can stop polling.

Download the error report

If the batch status response indicates errorCount > 0, use the Get batch inventory errors endpoint to retrieve a pre-signed URL for downloading a CSV report with all rows that failed processing.

Response example:


_10
{
_10
"batchId": "550e8400-e29b-41d4-a716-446655440000",
_10
"downloadUrl": "https://availability-bulk-upload-errors.s3.amazonaws.com/550e8400-e29b-41d4-a716-446655440000-errors.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
_10
"errorCount": 3
_10
}

The downloadUrl is a pre-signed S3 URL valid for 60 minutes. The error report itself remains available until the batch metadata expires, which is 7 days after batch completion.

The endpoint returns a 204 No Content response if errorCount is 0 or the batch is not in a status that produces an error report (PROCESSING, COMPLETED, COMPLETED_WITH_ERRORS, or FAILED).

Error CSV schema

The error CSV contains the following fields:

FieldTypeDescription
line_numberintegerOriginal line number in the uploaded CSV.
item_idstringSKU identifier from the failed row.
container_idstringWarehouse ID from the failed row.
error_codestringMachine-readable error code.
error_messagestringHuman-readable error description.

Example:


_10
line_number,item_id,container_id,error_code,error_message
_10
1523,SKU-12345,WH-01,INVALID_QUANTITY,"quantity cannot be negative: -50"
_10
4892,SKU-67890,WH-01,MISSING_REQUIRED_FIELD,"container_id is required"
_10
10234,SKU-11111,WH-01,INVALID_DATE_FORMAT,"supply_date is not valid"

Error types

The error report distinguishes between two categories of errors:

  • Deterministic errors: Caused by invalid or incomplete data in the submitted file, such as missing required fields or invalid values. They are detected during file ingestion from S3 and fail the affected records immediately. The system does not retry these operations automatically. To resolve them, fix the data in the CSV file and submit a new batch.
  • Non-deterministic errors: Caused by infrastructure or system issues. The system automatically retries the operation up to three times. If it still fails, the message is sent to a Dead Letter Queue (DLQ) for further investigation. These errors appear as UPDATE_FAILED in the error CSV.

Error codes

Error codeDescription
INVALID_QUANTITYQuantity value is invalid (negative or non-numeric).
MISSING_REQUIRED_FIELDA required field is empty or missing.
INVALID_DATE_FORMATA date or time field has an invalid format.
UPDATE_FAILEDDatabase update failed after retries (non-deterministic error).
INSERT_CONFLICTInsert conflicted with a concurrent operation.
INVALID_FORMATRow format is invalid (for example, wrong number of columns).
CONFLICTCompare-And-Set conflict or per-item routing conflict.
UNKNOWNUnclassified error.

Best practices

  • Reuse the same batchId: Always use the batchId returned by the Create batch inventory job endpoint when uploading the CSV, committing the batch, polling its status, and retrieving errors.
  • Respect the upload window: The pre-signed upload URL expires 30 minutes after creation. If it expires before the upload is complete, create a new batch.
  • Avoid concurrent commits: Do not commit the same batch in parallel. A second commit while one is in progress returns a 423 Locked response.
  • Use a reasonable polling interval: When monitoring large batches, poll the status endpoint at intervals proportional to the batch size to avoid unnecessary requests.
  • Fix deterministic errors at the source: If the error report shows deterministic errors, correct them in your source data and submit a new batch instead of retrying the same file.
Contributors
1
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
See also
Logistics API
API Reference
Logistics API Overview
Guides
Contributors
1
Photo of the contributor
Was this helpful?
Suggest edits (GitHub)
On this page