Reserve a time slot
POST /v2/fulfillment/users/{user_id}/service_options/{service_option_id}/reserve
Reserves the selected time slot (service_hold_id
) for the specified user ID. Time slots are reserved for 10 minutes. If the reservation expires before you can create the order, you can attempt to reserve the same time slot. If the time slot still has capacity, the request is successful. For more information about time slots, see Service options (time slots).
A user ID can have one reserved time slot at a time. If you send another reservation request for this user, even if it specifies the same time slot, the currently reserved time slot is cancelled before the new reservation request is processed.
After a time slot is reserved, save the service_option_hold_id
. You specify this ID when creating an order.
To reduce the chance that the reservation expires before you can create an order, send the reservation request near the end of the checkout process.
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. | |
service_option_id | path | integer | The ID of the service option. |
Request
None.
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url 'https://connect.instacart.com/v2/fulfillment/users/{user_id}/service_options/{service_option_id}/reserve' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/fulfillment/users/{user_id}/service_options/{service_option_id}/reserve")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/fulfillment/users/{user_id}/service_options/{service_option_id}/reserve", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://connect.instacart.com/v2/fulfillment/users/{user_id}/service_options/{service_option_id}/reserve"
req, _ := http.NewRequest("POST", url, nil)
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 |
---|---|---|---|
service_option_hold | ServiceOptionHold | The created service option hold. |
ServiceOptionHold Object
Field | Type | Required | Description |
---|---|---|---|
id | integer | The ID of the service option hold. | |
expires_at | string | The expiration time of the service option hold in ISO 8601 format. | |
service_option | ServiceOption | The held service option. |
ServiceOption Object
Field | Type | Required | Description |
---|---|---|---|
id | integer | The ID of the service option. | |
service_option_reference | string | The reference of the service option. | |
date | string | The date the service will take place in ISO 8601 format. | |
handoff_time | string | The ETA for shopper to arrive at store. | |
window | Window | The time window when the service will take place. | |
availability | OptionAvailability | The availability of this service option. |
OptionAvailability Object
Field | Type | Required | Description |
---|---|---|---|
available | boolean | Indicates if this service option is available for the user. | |
reasons | Array(string) | The reasons for unavailability of a service option. Currently, the reasons are related to the laws governing the sale of alcohol. For example, restrictions on quantity, delivery time, pickup, and matched city and county of stores and customers. The reasons are subject to change without notice. | |
item_codes | Array(string) | The item codes which caused the option to be unavailable. |
Window Object
One of the following:
Field | Type | Required | Description |
---|---|---|---|
start_at | string | The start of the delivery window in ISO 8601 format. | |
end_at | string | The end of the delivery window in ISO 8601 format. | |
type | string | The type of service option. One of 'scheduled', 'eta' (contact your Instacart Connect representative), or 'asap' (contact your Instacart Connect representative). | |
asap | boolean | Indicates if delivery will happen as soon as possible. Only true when type is asap. |
or
Field | Type | Required | Description |
---|---|---|---|
immediate_hour | integer | Indicates the number of hours after order creation that delivery will occur. | |
type | string | Indicates this is an immediate option. Defaults to immediate. |
Reasons for unavailability of a service option
Reason | Description |
---|---|
State law restricts amount of {beer/wine/spirits} to {#} fl oz, cart quantity is: {#} fl oz. | The quantity of this alcohol type exceeds the state law limit. |
Error validating alcohol quantities. Please try again. | The quantity of alcohol can’t be validated. |
Unmatched city and county | The city and county of the store and customer must match. |
Cannot deliver alcohol to this postal code | Instacart can’t deliver alcohol to this postal code. |
State law doesn't allow delivery of alcohol in this window | Instacart can’t deliver alcohol in this delivery window because of state law. |
Unfortunately alcohol pickup is not available at this location. Please remove alcohol from your basket or try delivery. | Alcohol pickup is not available at this location. |
Response examples
200 Success
200
Service option hold returned
{
"service_option_hold": {
"id": 148,
"expires_at": "2018-02-22T00:10:00Z",
"service_option": {
"id": 247,
"date": "2018-02-22",
"window": {
"start_at": "2018-02-22T00:00:00Z",
"end_at": "2018-02-22T02:00:00Z",
"type": "scheduled",
"asap": false
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
}
}
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Retry later | "Please try again in a little while" | 2003 | Not applicable |
400 | User Not Found | "User Not Found" | 1001 | {"key":"user_id"} |
400 | Blank service option id | "can't be blank" | 1001 | {"key":"service_option_id"} |
400 | Service Option Expired | "The requested ETA option has expired." | 1001 | {"key":"service_option_id"} |
403 | Inactive user | "User Not Active" | null | Not applicable |
404 | Resource not found | "Resource not found" | 4000 | Not applicable |