Ingest orders from a third-party system
POST /v2/ian/order/log
Ingests orders that were fulfilled by a provider other than Instacart. To include this information in the ads metrics, orders must be sent within three days of the order creation date.
Security
Name | In | Description |
---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-Retailer-Id | header | string | ![]() | The retailer slug. This is only required for a retailer with multiple banners. Retailers with single banners can leave this empty. |
Request
Field | Type | Required | Description |
---|---|---|---|
event | string | ![]() | The type of the event. Always set to “order.created”. |
properties | OrderProperties | ![]() | The properties of the order. |
user_id | string | ![]() | The unique identifier of the user. |
sent_at_utc | string | ![]() | The time when the request was sent. Use ISO8601 format with the time zone designator (TZD) appended. Example: 2022-12-03T10:15:30+08:00. |
OrderProperties Object
Field | Type | Required | Description |
---|---|---|---|
order_id | string | ![]() | The unique identifier of the order. |
created_at_utc | string | ![]() | The time the order was submitted by the user. Use ISO8601 format with the time zone designator (TZD) appended. Example: 2022-12-03T10:15:30+08:00. |
updated_at_utc | string | ![]() | The time an existing order was updated, if applicable. Use ISO8601 format with the time zone designator (TZD) appended. Example: 2022-12-03T10:15:30+08:00. |
location_code | string | ![]() | The location code of the store where the order was fulfilled. |
delivery_status | string | ![]() | The delivery status of the order. |
order_items | Array(OrderItem) | ![]() | The items in the order as an array. |
OrderItem Object
Field | Type | Required | Description |
---|---|---|---|
ordered_rrc | string | ![]() | The item's retailer reference code (RRC). At least one of UPC or RRC should be provided. |
ordered_upc | string | ![]() | The item's universal product code (UPC). At least one of UPC or RRC should be provided. |
ordered_price_per_unit | string | ![]() | The price of one unit of this item in nanos before tax. |
ordered_total_discount | string | ![]() | Total discount of the ordered items in nanos. |
ordered_quantity | string | ![]() | The quantity of the item ordered in terms of the specified size. |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url https://connect-ian.instacart.com/v2/ian/order/log \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Retailer-Id: string' \
--data '{
"event": "order.created",
"properties": {
"order_id": "string",
"created_at_utc": "string",
"updated_at_utc": "string",
"location_code": "string",
"delivery_status": "created",
"order_items": [
{
"ordered_rrc": "string",
"ordered_upc": "string",
"ordered_price_per_unit": "string",
"ordered_total_discount": "string",
"ordered_quantity": "string"
}
]
},
"user_id": "string",
"sent_at_utc": "string"
}'
HttpResponse<String> response = Unirest.post("https://connect-ian.instacart.com/v2/ian/order/log")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.header("X-Retailer-Id", "string")
.body("{\n \"event\": \"order.created\",\n \"properties\": {\n \"order_id\": \"string\",\n \"created_at_utc\": \"string\",\n \"updated_at_utc\": \"string\",\n \"location_code\": \"string\",\n \"delivery_status\": \"created\",\n \"order_items\": [\n {\n \"ordered_rrc\": \"string\",\n \"ordered_upc\": \"string\",\n \"ordered_price_per_unit\": \"string\",\n \"ordered_total_discount\": \"string\",\n \"ordered_quantity\": \"string\"\n }\n ]\n },\n \"user_id\": \"string\",\n \"sent_at_utc\": \"string\"\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect-ian.instacart.com")
payload = "{\n \"event\": \"order.created\",\n \"properties\": {\n \"order_id\": \"string\",\n \"created_at_utc\": \"string\",\n \"updated_at_utc\": \"string\",\n \"location_code\": \"string\",\n \"delivery_status\": \"created\",\n \"order_items\": [\n {\n \"ordered_rrc\": \"string\",\n \"ordered_upc\": \"string\",\n \"ordered_price_per_unit\": \"string\",\n \"ordered_total_discount\": \"string\",\n \"ordered_quantity\": \"string\"\n }\n ]\n },\n \"user_id\": \"string\",\n \"sent_at_utc\": \"string\"\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>",
'X-Retailer-Id': "string"
}
conn.request("POST", "/v2/ian/order/log", 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-ian.instacart.com/v2/ian/order/log"
payload := strings.NewReader("{\n \"event\": \"order.created\",\n \"properties\": {\n \"order_id\": \"string\",\n \"created_at_utc\": \"string\",\n \"updated_at_utc\": \"string\",\n \"location_code\": \"string\",\n \"delivery_status\": \"created\",\n \"order_items\": [\n {\n \"ordered_rrc\": \"string\",\n \"ordered_upc\": \"string\",\n \"ordered_price_per_unit\": \"string\",\n \"ordered_total_discount\": \"string\",\n \"ordered_quantity\": \"string\"\n }\n ]\n },\n \"user_id\": \"string\",\n \"sent_at_utc\": \"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>")
req.Header.Add("X-Retailer-Id", "string")
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 |
---|---|---|---|
message | string | ![]() | Response for the user. |
Response examples
200 Success
200
order.created
{
"message": "Successfully processed"
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Missing event properties | "can't be blank" | 1001 | {"key":"properties"} |
400 | Invalid event name | "is not included in the list" | 1001 | {"key":"event"} |
400 | order.created with empty order items | "can't be blank" | 1001 | {"key":"properties.order_items"} |