Create tasks in batch - async
This endpoint is helpful if you want to create unassigned tasks quickly for future assignment or optimization, without having to worry about managing multiple requests.
All task data will be processed asynchronously and you will receive a response that includes a jobID
which can be used to query for the status of the batch using Batch Job Status.
The structure of the errors you may get from this endpoint is slightly different from the errors we send back when a request responds with a non-200
code. Batch errors include the following top-level properties: statusCode
(number), error
(number), message
(string) and cause
(string).
There is a limit of 500 tasks in the body per request for this endpoint.
Body Parameter:
Name | Type | Descriptions |
---|---|---|
tasks | object array | An array containing one or more task objects. Refer to the Create task endpoint section for a complete definition of the task object. |
Task Created Webhook
Please note that automatic assignment is not currently supported by this endpoint. You will also not receive taskCreated webhook requests for batch task creations if you have registered for this trigger.
Batch Job Status/Response/Webhook
To check on the request progress, use Batch Job Status endpoint.
You can also set up Asynchronous Batch Job Webhook to automatically receive the Responses without having to continuously query for the Status
curl -X POST "https://onfleet.com/api/v2/tasks/batch-async" \
-u "cd3b3de84cc1ee040bf06512d233719c:" \
-d '{"tasks":[{"destination":{"address":{"unparsed":"2829 Vallejo St, SF, CA, USA"},"notes":"Small green door by garage door has pin pad, enter *4821*"},"recipients":[{"name":"Blas Silkovich","phone":"650-555-4481","notes":"Knows Neiman, VIP status."}],"notes":"Order 332: 24oz Stumptown Finca El Puente, 10 x Aji de Gallina Empanadas, 13-inch Lelenitas Tres Leches"},{"destination":{"address":{"number":"1264","street":"W. Augusta Blvd. ","apartment":"","city":"Chicago","state":"IL","country":"USA"}},"notes":"12 x 2016 Getariako Txakolina (Rosé)","pickupTask":true,"metadata":[{"name":"caseId","type":"number","value":33162}],"recipients":[]},{"destination":{"address":{"number":"420","street":"Infinite Loop","city":"Redmond","state":"WA","country":"USA"}},"recipients":[{"name":"S.N.","phone":"206-341-8826"}]}]}'
{
"status": "pending",
"jobId": "S3oI~WNX4b5cbF1adQxuEeJD"
}