List time slots for last mile delivery
POST /v2/fulfillment/users/{user_id}/service_options/cart/last_mile
Lists the available last mile delivery service options for the customer's location and cart details. In this context, service options are time slots, such as Today 4pm-6pm or Friday 9am-11am. Availability is based on current and anticipated shopper availability for the relevant store and delivery location.
By default, the time slots returned are immediate and scheduled time slots. If ETA options are enabled in your retailer configuration, you can retrieve ETA time slots instead of immediate time slots. To get a standard ETA time slot with the scheduled time slots, set the with_eta_options field to true. To also retrieve a priority ETA time slot, set the with_priority_eta_options field to true. For more information, see Retrieve an ETA time slot.
If the location_code in the request references a store that offers long-distance deliveries and Instacart estimates the delivery time to be between 30 and 60 minutes, inclusive, then flags.long_distance_delivery is set to true. For more information, see Service areas for delivery.
After a time slot is selected, save the service_option_id. You specify the ID when reserving the time slot.
This operation differs from preview service options in that the service enforces all the parameters necessary to return accurate, complete service options. Use this operation when the customer is ready to check out.
Security
| Name | In | Description |
|---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user_id | path | string | The ID of the user. |
Request
| Field | Type | Required | Description |
|---|---|---|---|
address | ExpandedAddress | The address of the user. | |
location_code | string | Location code of the store where the delivery driver picks up the order. | |
cart_total_cents | integer | The total value of all items for the order in cents. | |
items_count | integer | The number of different types of items in the order. | |
units_count | number | The number of all items, including multiples of an item, in the order. | |
earliest_option_start_at | string | The earliest time that an order can be ready for delivery. Only time slots that start after this time are retrieved. | |
with_eta_options | boolean | Returns ETA options instead of immediate options when true. For more information, contact your Instacart Representative. Defaults to false. | |
with_priority_eta_options | boolean | Returns Priority ETA options instead of immediate options when true. For more information, contact your Instacart Representative. Defaults to false. | |
with_handoff_time | boolean | Indicator whether the handoff time is calculated when fetching service option. Defaults to false. | |
desired_windows | Array(DesiredWindow) | The desired windows for service options. |
ExpandedAddress Object
| Field | Type | Required | Description |
|---|---|---|---|
address_line_1 | string | The first line of the address, e.g., | |
address_line_2 | string | The second line of the address, e.g., | |
address_type | string | The type of address, e.g., | |
postal_code | string | The postal or zip code of the address. | |
city | string | The city or town of the address, e.g., |
DesiredWindow Object
| Field | Type | Required | Description |
|---|---|---|---|
starts_at | string | Start time of the desired window in ISO 8601 format. | |
ends_at | string | End time of the desired window in ISO 8601 format. |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url 'https://connect.instacart.com/v2/fulfillment/users/{user_id}/service_options/cart/last_mile' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"address": {
"address_line_1": "string",
"address_line_2": "string",
"address_type": "string",
"postal_code": "string",
"city": "string"
},
"location_code": "string",
"cart_total_cents": 1,
"items_count": 1,
"units_count": 1,
"earliest_option_start_at": "string",
"with_eta_options": true,
"with_priority_eta_options": true,
"with_handoff_time": true,
"desired_windows": [
{
"starts_at": "string",
"ends_at": "string"
}
]
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/fulfillment/users/{user_id}/service_options/cart/last_mile")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"address\": {\n \"address_line_1\": \"string\",\n \"address_line_2\": \"string\",\n \"address_type\": \"string\",\n \"postal_code\": \"string\",\n \"city\": \"string\"\n },\n \"location_code\": \"string\",\n \"cart_total_cents\": 1,\n \"items_count\": 1,\n \"units_count\": 1,\n \"earliest_option_start_at\": \"string\",\n \"with_eta_options\": true,\n \"with_priority_eta_options\": true,\n \"with_handoff_time\": true,\n \"desired_windows\": [\n {\n \"starts_at\": \"string\",\n \"ends_at\": \"string\"\n }\n ]\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"address\": {\n \"address_line_1\": \"string\",\n \"address_line_2\": \"string\",\n \"address_type\": \"string\",\n \"postal_code\": \"string\",\n \"city\": \"string\"\n },\n \"location_code\": \"string\",\n \"cart_total_cents\": 1,\n \"items_count\": 1,\n \"units_count\": 1,\n \"earliest_option_start_at\": \"string\",\n \"with_eta_options\": true,\n \"with_priority_eta_options\": true,\n \"with_handoff_time\": true,\n \"desired_windows\": [\n {\n \"starts_at\": \"string\",\n \"ends_at\": \"string\"\n }\n ]\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/fulfillment/users/{user_id}/service_options/cart/last_mile", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://connect.instacart.com/v2/fulfillment/users/{user_id}/service_options/cart/last_mile"
payload := strings.NewReader("{\n \"address\": {\n \"address_line_1\": \"string\",\n \"address_line_2\": \"string\",\n \"address_type\": \"string\",\n \"postal_code\": \"string\",\n \"city\": \"string\"\n },\n \"location_code\": \"string\",\n \"cart_total_cents\": 1,\n \"items_count\": 1,\n \"units_count\": 1,\n \"earliest_option_start_at\": \"string\",\n \"with_eta_options\": true,\n \"with_priority_eta_options\": true,\n \"with_handoff_time\": true,\n \"desired_windows\": [\n {\n \"starts_at\": \"string\",\n \"ends_at\": \"string\"\n }\n ]\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, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response
| Field | Type | Required | Description |
|---|---|---|---|
service_options | Array(ServiceOption) | The returned service options. | |
warnings | Array(Error) | Any warnings associated with this request. | |
flags | Flags | Additional properties of the address. |
ServiceOption Object
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | The service option ID. | |
service_option_reference | string | A unique service option reference that acts as a token you pass in downstream requests to place a hold. | |
date | string | The date and time the service is scheduled to take place in ISO 8601 format. | |
handoff_time | string | Indicates in ISO 8601 format when the handoff between the store associate and the Instacart shopper is expected to occur. Only applicable to last mile delivery orders and not supported in Fulfillment API v3. | |
window | Window | The fulfillment window. | |
availability | OptionAvailability | Indicates whether the service option is available and, if it's not, provides details about why. |
OptionAvailability Object
| Field | Type | Required | Description |
|---|---|---|---|
available | boolean | Indicates whether the service option is available. If | |
reasons | Array(string) | If | |
item_codes | Array(string) | The codes of the items which caused the service option to be unavailable. |
Window Object
One of the following:
| Field | Type | Required | Description |
|---|---|---|---|
start_at | string | The delivery window's starting date and time in ISO 8601 format. | |
end_at | string | The delivery window's ending date and time in ISO 8601 format. | |
type | string | The type of service option. One of | |
asap | boolean | Indicates whether delivery is scheduled to occur as soon as possible. |
or
| Field | Type | Required | Description |
|---|---|---|---|
immediate_hour | integer | The number of hours from the time of order creation by which fulfillment is expected to be complete. For example, if | |
type | string | Indicates that the service option is |
Error Object
| Field | Type | Required | Description |
|---|---|---|---|
error | ErrorDetails | The error details. | |
meta | MetaError | Metadata about the error, including the items associated with it. |
ErrorDetails Object
| Field | Type | Required | Description |
|---|---|---|---|
message | string | A human-readable description of the error. | |
error_code | integer | A numeric code that identifies the error type. |
MetaError Object
| Field | Type | Required | Description |
|---|---|---|---|
items | Array(ItemInfo) | The items that triggered the error. |
ItemInfo Object
| Field | Type | Required | Description |
|---|---|---|---|
item_code | string | The retailer reference code (RRC) or universal product code (UPC) of an item that triggered the error. |
Flags Object
| Field | Type | Required | Description |
|---|---|---|---|
long_distance_delivery | boolean | Whether a delivery to the address will be a long distance delivery. |
Reasons for unavailability of a service option
| Reason | Description |
|---|---|
Unmatched city and county | The city and county of the store and customer must match. |
Response examples
200 Success
200Gets service options200Service options returned with flags
{
"service_options": [
{
"id": 327,
"service_option_reference": "ezppZD0-MzI3LCA6dHlwZT0-OSwgOndpbmRvdz0-PEluc3RhY2FydDo6Q3VzdG9tZXJzOjpBdmFpbGFiaWxpdHk6OlYxOjpUaW1lc3RhbXBXaW5kb3c6IHN0YXJ0c19hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTUxOTI2NDgwMCwgbmFub3M6IDA-LCBlbmRzX2F0OiA8R29vZ2xlOjpQcm90b2J1Zjo6VGltZXN0YW1wOiBzZWNvbmRzOiAxNTE5MjcyMDAwLCBuYW5vczogMD4-fQ==",
"date": "2018-02-21",
"window": {
"start_at": "2018-02-22T02:00:00Z",
"end_at": "2018-02-22T04:00:00Z",
"type": "scheduled",
"asap": false
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
},
{
"id": 328,
"service_option_reference": "ezppZD0-MzI4LCA6dHlwZT0-NCwgOndpbmRvdz0-PEluc3RhY2FydDo6Q3VzdG9tZXJzOjpBdmFpbGFiaWxpdHk6OlYxOjpUaW1lc3RhbXBXaW5kb3c6IHN0YXJ0c19hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTUxOTI2NDgwMCwgbmFub3M6IDA-LCBlbmRzX2F0OiA8R29vZ2xlOjpQcm90b2J1Zjo6VGltZXN0YW1wOiBzZWNvbmRzOiAxNTE5MjcyMDAwLCBuYW5vczogMD4-fQ==",
"date": "2018-02-21",
"window": {
"immediate_hour": 2,
"type": "immediate"
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
},
{
"id": 329,
"service_option_reference": "ezppZD0-MzI5LCA6dHlwZT0-NywgOndpbmRvdz0-PEluc3RhY2FydDo6Q3VzdG9tZXJzOjpBdmFpbGFiaWxpdHk6OlYxOjpUaW1lc3RhbXBXaW5kb3c6IHN0YXJ0c19hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTc3NjI4MTc4MCwgbmFub3M6IDIwNDU1NzAwMD4sIGVuZHNfYXQ6IDxHb29nbGU6OlByb3RvYnVmOjpUaW1lc3RhbXA6IHNlY29uZHM6IDE3NzYyODg5ODAsIG5hbm9zOiAyMDQ1NTcwMDA-Pn0=",
"date": "2026-04-15",
"handoff_time": "2018-02-22T00:30:00Z",
"window": {
"start_at": "2026-04-15T19:36:20Z",
"end_at": "2026-04-15T21:36:20Z",
"type": "eta",
"asap": false
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
}
]
}
{
"service_options": [
{
"id": 333,
"service_option_reference": "ezppZD0-MzMzLCA6dHlwZT0-OSwgOndpbmRvdz0-PEluc3RhY2FydDo6Q3VzdG9tZXJzOjpBdmFpbGFiaWxpdHk6OlYxOjpUaW1lc3RhbXBXaW5kb3c6IHN0YXJ0c19hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTUxOTI2NDgwMCwgbmFub3M6IDA-LCBlbmRzX2F0OiA8R29vZ2xlOjpQcm90b2J1Zjo6VGltZXN0YW1wOiBzZWNvbmRzOiAxNTE5MjcyMDAwLCBuYW5vczogMD4-fQ==",
"date": "2018-02-21",
"window": {
"start_at": "2018-02-22T02:00:00Z",
"end_at": "2018-02-22T04:00:00Z",
"type": "scheduled",
"asap": false
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
},
{
"id": 334,
"service_option_reference": "ezppZD0-MzM0LCA6dHlwZT0-NCwgOndpbmRvdz0-PEluc3RhY2FydDo6Q3VzdG9tZXJzOjpBdmFpbGFiaWxpdHk6OlYxOjpUaW1lc3RhbXBXaW5kb3c6IHN0YXJ0c19hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTUxOTI2NDgwMCwgbmFub3M6IDA-LCBlbmRzX2F0OiA8R29vZ2xlOjpQcm90b2J1Zjo6VGltZXN0YW1wOiBzZWNvbmRzOiAxNTE5MjcyMDAwLCBuYW5vczogMD4-fQ==",
"date": "2018-02-21",
"window": {
"immediate_hour": 2,
"type": "immediate"
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
},
{
"id": 335,
"service_option_reference": "ezppZD0-MzM1LCA6dHlwZT0-NywgOndpbmRvdz0-PEluc3RhY2FydDo6Q3VzdG9tZXJzOjpBdmFpbGFiaWxpdHk6OlYxOjpUaW1lc3RhbXBXaW5kb3c6IHN0YXJ0c19hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTc3NjI4MTc4MCwgbmFub3M6IDIwNDU1NzAwMD4sIGVuZHNfYXQ6IDxHb29nbGU6OlByb3RvYnVmOjpUaW1lc3RhbXA6IHNlY29uZHM6IDE3NzYyODg5ODAsIG5hbm9zOiAyMDQ1NTcwMDA-Pn0=",
"date": "2026-04-15",
"window": {
"start_at": "2026-04-15T19:36:20Z",
"end_at": "2026-04-15T21:36:20Z",
"type": "eta",
"asap": false
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
}
],
"flags": {
"long_distance_delivery": true
}
}
4XX Errors
Error responses return either a single error or multiple errors.
| HTTP Code | Cause | Error Message | Error Code | Error Meta |
|---|---|---|---|---|
400 | Handoff time is requested but not configured | "Handoff time calculation is not configured for this retailer." | 1001 | {"key":"with_handoff_time"} |
400 | Address contains PO box | "address contains PO Box" | 1001 | {"key":"address"} |
400 | Invalid location code | "Specified store is not available for lastmile." | 1001 | {"key":"location_code"} |
400 | No stores found | "No store location found for given address." | 1001 | {"key":"address_line_1"} |
400 | Cannot deliver to address | "Unfortunately, we cannot deliver to that area." | 1001 | {"key":"address"} |
400 | Store does not support delivery to address | "We do not currently support delivery from this store to the selected address." | 1001 | {"key":"address"} |
400 | User Not Found | "User Not Found" | 1001 | {"key":"user_id"} |
404 | Resource not found | "Resource not found" | 4000 | Not applicable |