Delivery Solutions

Create Batch

The "Create Batch" API endpoint requires a unique batchExternalId, dispatch details specifying scheduling and reference times, sorting parameters to prioritize order dispatch by fields like deliveryDistance, and optionally order details, with example usage shown via a POST request including headers and JSON body, returning status codes such as 201 for success or 400 for errors.

Parameters

batchExternalId (string, required)

Unique ID of the batch. This is usually the ID generated in your system. Use this for easier identification of the batch of orders.

dispatch (object, required)

Batch dispatch details.

sortBy (object, required)

Parameters to set the priority of dispatch for orders in a batch.

orders (array of objects)

Order details.


Example Request

curl --request POST \
     --url https://sandbox.api.deliverysolutions.co/api/v2/batches \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'tenantId: YOUR_TENANT_ID' \
     --header 'x-api-key: YOUR_API_KEY' \
     --header 'x-compression: true' \
     --data '
{
  "dispatch": {
    "type": "scheduled",
    "scheduledBy": "absolute",
    "basedOn": "pickupTimeStartsAt",
    "referTo": "firstPickupTime"
  },
  "sortBy": {
    "type": "asc",
    "sortField": "deliveryDistance"
  }
}
'

Example Responses

  • 201 - Create Batch Response
  • 400 - Invalid values Error
  • 400 - Required Fields Missing Error