Advance the batch status
POST /v2/fulfillment_sandbox/batches/{batch_id}/advance
Advances the status of a batch through the statuses for the selected fulfillment workflow. You specified the fulfillment workflow when you generated the batch with the batch_type
attribute set to one of the workflows. The transitions occur in the order shown. Optionally, you can set the status in the request body.
Delivery
# | Status | Description |
---|---|---|
0 | brand_new | The default batch state when a delivery batch is generated. |
1 | acknowledged | Shopper is assigned to a batch that contains the order ID. |
2 | picking | Shopper has started shopping. |
3 | verifying_replacements | Shopper has requested approval for replacements and refunds. |
4 | checkout | Shopper has paid for the order. |
5 | receipt_sanity_check | Shopper has verified the receipt is accurate. |
6 | delivering | Shopper is in transit to the customer's address. |
7 | completed | Shopper has delivered the order to the customer. |
Pickup
# | Status | Description |
---|---|---|
0 | brand_new | The default batch state when a pickup batch is generated. |
1 | acknowledged | Shopper is assigned to a batch that contains the order ID. |
2 | picking | Shopper has started shopping. |
3 | verifying_replacements | Shopper has requested approval for replacements and refunds. |
4 | checkout | Shopper has paid for the order. |
5 | receipt_sanity_check | Shopper has verified the receipt is accurate. |
6 | bags_check | Shopper has verified the contents of the bags. |
7 | staged | Shopper has placed the bags in the staging area. |
At this point, a runner_customer
batch must be created for an employee to run the bags from the staging area to the customer. The Advance batch endpoint moves this batch through the following states:
# | Status | Description |
---|---|---|
0 | brand_new | The default batch state when a runner_customer batch is generated. |
1 | at_store | Customer has arrived at the store to pick up the order. |
2 | bags_verified | Customer has verified the number of bags matches the order. |
3 | completed | Customer has accepted the order. |
Last mile delivery (delivery only)
# | Status | Description |
---|---|---|
0 | brand_new | The default batch state when a delivery_only batch is generated. |
1 | acknowledged_for_delivery | Shopper is assigned to a batch. |
2 | at_store | Shopper has arrived at the store to get the order. |
3 | bags_verified | Shopper has verified the number of bags matches the order. |
4 | delivering | Shopper is in transit to the customer's address. |
5 | completed | Shopper has delivered the order to the customer. |
Security
Name | In | Description |
---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
batch_id | path | integer | The ID of the batch. |
Request
Field | Type | Required | Description |
---|---|---|---|
workflow_state | string | The target workflow state that the batch. |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url 'https://connect.instacart.com/v2/fulfillment_sandbox/batches/{batch_id}/advance' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"workflow_state": "string"
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/fulfillment_sandbox/batches/{batch_id}/advance")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"workflow_state\": \"string\"\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"workflow_state\": \"string\"\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/fulfillment_sandbox/batches/{batch_id}/advance", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://connect.instacart.com/v2/fulfillment_sandbox/batches/{batch_id}/advance"
payload := strings.NewReader("{\n \"workflow_state\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response
Field | Type | Required | Description |
---|---|---|---|
id | integer | The ID of the batch. | |
workflow_state | string | The new workflow state of the batch. |
Response examples
200 Success
200
Batch advanced200
Batch advanced to target workflow state
{
"id": 1,
"workflow_state": "acknowledged"
}
{
"id": 1,
"workflow_state": "picking"
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Batch already completed | "Batch already completed" | 3002 | Not applicable |
404 | Batch not found | "Batch not found" | 4000 | Not applicable |