Validate items
POST /v2/fulfillment/validate_items
For a given delivery address or pickup store location, this operation validates each provided item against Instacart’s current instance of the store's catalog. Specifically, it checks whether each items[] exists and whether its quantity parameter (count or weight) matches the product-type configuration.
If your request defines address and omits location_code, Instacart finds the store nearest to that delivery location and performs the checks against its catalog. If your request defines location_code and omits address, Instacart validates the items using the catalog of the store associated with that code. In the event both fields are defined, location_code takes precedence.
The response contains a validation_failures array. Each object in this array references an item and contains an error that describes the check that failed. An empty array indicates all the items passed the validations.
Unlike create order, the validate items operation doesn't accept an order or user reference, so it checks each item individually rather than as a set. Specifically, it doesn't validate whether:
- All the items comply with alcohol and over-the-counter medication laws.
- The total number of items, as well as those classified as big and bulky, exceeds what’s allowed.
- The total weight of the items, as well as those classified as beverages, exceeds what’s allowed.
- The customer’s account is inactive or deactivated.
Additionally, calling this endpoint doesn’t place a hold on or reserve the provided items[], and an empty validation_failures array doesn’t guarantee the success of the downstream create order call.
Security
| Name | In | Description |
|---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
None.Request
| Field | Type | Required | Description |
|---|---|---|---|
items | Array(ItemToValidate) | The items to validate. | |
address | ExpandedAddress | The customer's delivery address. Either this field or | |
location_code | string | The code that identifies the store's location. Either this field or |
ItemToValidate Object
| Field | Type | Required | Description |
|---|---|---|---|
item | Item | The item's code. Must be unique within the request. | |
count | integer | The item's count. Must be a non-negative integer. Depending on the item's catalog configuration, either this field or | |
weight | number | The item's weight. Must be a non-negative number. Depending on the item's catalog configuration, either this field or |
Item Object
One of the following:
| Field | Type | Required | Description |
|---|---|---|---|
upc | string | The item's universal product code (upc). |
or
| Field | Type | Required | Description |
|---|---|---|---|
rrc | string | The item's retailer reference code (rrc). |
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., |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url https://connect.instacart.com/v2/fulfillment/validate_items \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"items": [
{
"item": {
"upc": "string"
},
"count": 1,
"weight": 1
}
],
"address": {
"address_line_1": "string",
"address_line_2": "string",
"address_type": "string",
"postal_code": "string",
"city": "string"
},
"location_code": "string"
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/fulfillment/validate_items")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"items\": [\n {\n \"item\": {\n \"upc\": \"string\"\n },\n \"count\": 1,\n \"weight\": 1\n }\n ],\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}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"items\": [\n {\n \"item\": {\n \"upc\": \"string\"\n },\n \"count\": 1,\n \"weight\": 1\n }\n ],\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}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/fulfillment/validate_items", 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/validate_items"
payload := strings.NewReader("{\n \"items\": [\n {\n \"item\": {\n \"upc\": \"string\"\n },\n \"count\": 1,\n \"weight\": 1\n }\n ],\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}")
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 |
|---|---|---|---|
validation_failures | Array(ValidationFailure) | Per-item validation errors. An empty array indicates all submitted items passed validation. |
ValidationFailure Object
| Field | Type | Required | Description |
|---|---|---|---|
item | ItemUpcOrRrc | The code of the item that failed validation. | |
error | Error | The error that occurred while validating the item. |
ItemUpcOrRrc Object
| Field | Type | Required | Description |
|---|---|---|---|
upc | string | The item's universal product code (UPC). | |
rrc | string | The item's retailer reference code (RRC). |
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. |
Response examples
200 Success with validation failures
- 200 Item not found
- 200 Product type mismatch
{
"validation_failures": [
{
"item": {
"upc": "0002373491093004"
},
"error": {
"error": {
"message": "1 item not found.",
"error_code": 2000
},
"meta": {
"items": [
{
"item_code": "0002373491093004"
}
]
}
}
}
]
}
{
"validation_failures": [
{
"item": {
"upc": "00073491093004"
},
"error": {
"error": {
"message": "One of these items had an invalid quantity amount, 00073491093004 expected count",
"error_code": 2012
},
"meta": {
"items": [
{
"item_code": "00073491093004"
}
]
}
}
}
]
}
200 Success
200Items validated successfully with no errors. Using location_code200Items validated successfully with no errors. Using address
{
"validation_failures": []
}
{
"validation_failures": []
}
4XX Errors
Error responses return either a single error or multiple errors.
| HTTP Code | Cause | Error Message | Error Code | Error Meta |
|---|---|---|---|---|
400 | Duplicate items were provided | "Duplicate items provided for this request." | 2007 | {"duplicate_items":[{"item_upc":"111"}]} |
400 | Invalid location code | "Could not find specified store." | 1001 | {"key":"location_code"} |
400 | Without items | "can't be blank" | 1001 | {"key":"items"} |
400 | Neither location_code nor address provided | "Either location_code or address must be provided" | 1001 | {"key":"base"} |