Report sponsored product price candidates
POST /v2/ian/sp_price_candidate
Reports how a partner ranked, filtered, or displayed the candidates returned by Get sponsored product candidates. Instacart enables this endpoint for specific enhanced integration partners. For the full workflow, see Enhanced integration.
Field tables on this page are generated from the OpenAPI specification.
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 identifying the banner to serve ads for. Required only for multi-banner accounts. Instacart assigns slugs during onboarding. An unknown or missing slug returns 400 with the message Bad X-Retailer-Id. A slug that does not match your account returns 401 with the message the given location code doesn't match the oauth token used. |
X-Retailer-Id is the retailer slug identifying the banner to serve ads for. Required only for multi-banner accounts. Instacart assigns slugs during onboarding. An unknown or missing slug returns 400 with the message Bad X-Retailer-Id. A slug that does not match your account returns 401 with the message the given location code doesn't match the oauth token used. For more information, see Identifiers.
Request
| Field | Type | Required | Description |
|---|---|---|---|
page_context | SponsoredProductPriceCandidatesPageContext | Specific page context for the requested ads. | |
session_context | SessionContext | Context related to the user session. |
SponsoredProductPriceCandidatesPageContext Object
| Field | Type | Required | Description |
|---|---|---|---|
page_query | SponsoredProductPriceCandidatesQuery | The query used to specify price related attributes for the candidate. | |
common_query | CommonQuery | The query used to specify common attributes. |
SponsoredProductPriceCandidatesQuery Object
| Field | Type | Required | Description |
|---|---|---|---|
price_query | PriceQuery | The query used for pricing. |
PriceQuery Object
| Field | Type | Required | Description |
|---|---|---|---|
ic_request_id | string | Unique request identifier generated by Instacart. | |
ad_slots_available | integer | Number of ad slots the partner had available for display | |
tags | Array(string) | Array of tags associated with the price query. | |
candidates | Array(Candidate) | Array of candidate objects representing price candidates. |
Candidate Object
| Field | Type | Required | Description |
|---|---|---|---|
object_tracking_id | string | Unique identifier for the candidate object. | |
position | integer | Position of the candidate in display order. -1 for filtered candidate. | |
relative_score | number | The relative score or ranking of the candidate. | |
filter_reason | string | Reason for filtering this candidate (e.g., 'relevance'). | |
selected | boolean | Flag indicating if the candidate was selected for display. |
SessionContext Object
| Field | Type | Required | Description |
|---|---|---|---|
user_id | string | Unique user ID of the user performing the query. Maximum 50 characters. | |
user_ip | string | The IP address of the end user. Maximum 50 characters. | |
user_agent | string | The user agent of the device making the request. Maximum 50 characters. | |
test_only | boolean | When true, the campaigns created for Carrot Ads testing are guaranteed to participate in the ads auction along with other campaigns. Default is false. |
Send one price_query that includes the ic_request_id from the candidate response and a candidates array. For a candidate you filtered out, set position to -1 and include filter_reason when you have one. Include a positive relative_score for a candidate you serve. You can omit relative_score for a candidate you filter out.
page_context.common_query.partner_request_id is required. Send the same UUID you sent on Get sponsored product candidates. The generated field tables omit it. selected on each candidate indicates whether that candidate is displayed. It is optional for sponsored products.
Request examples
- cURL
- Java
- Python
- Go
- Node.js
curl --request POST \
--url https://connect-ian.instacart.com/v2/ian/sp_price_candidate \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Retailer-Id: string' \
--data '{
"page_context": {
"page_query": {
"price_query": {
"ic_request_id": "string",
"ad_slots_available": 1,
"tags": [
"string"
],
"candidates": [
{
"object_tracking_id": "string",
"position": 1,
"relative_score": 1,
"filter_reason": "string",
"selected": true
}
]
}
},
"common_query": {}
},
"session_context": {
"user_id": "string",
"user_ip": "string",
"user_agent": "string",
"test_only": true
}
}'
HttpResponse<String> response = Unirest.post("https://connect-ian.instacart.com/v2/ian/sp_price_candidate")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.header("X-Retailer-Id", "string")
.body("{\n \"page_context\": {\n \"page_query\": {\n \"price_query\": {\n \"ic_request_id\": \"string\",\n \"ad_slots_available\": 1,\n \"tags\": [\n \"string\"\n ],\n \"candidates\": [\n {\n \"object_tracking_id\": \"string\",\n \"position\": 1,\n \"relative_score\": 1,\n \"filter_reason\": \"string\",\n \"selected\": true\n }\n ]\n }\n },\n \"common_query\": {}\n },\n \"session_context\": {\n \"user_id\": \"string\",\n \"user_ip\": \"string\",\n \"user_agent\": \"string\",\n \"test_only\": true\n }\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect-ian.instacart.com")
payload = "{\n \"page_context\": {\n \"page_query\": {\n \"price_query\": {\n \"ic_request_id\": \"string\",\n \"ad_slots_available\": 1,\n \"tags\": [\n \"string\"\n ],\n \"candidates\": [\n {\n \"object_tracking_id\": \"string\",\n \"position\": 1,\n \"relative_score\": 1,\n \"filter_reason\": \"string\",\n \"selected\": true\n }\n ]\n }\n },\n \"common_query\": {}\n },\n \"session_context\": {\n \"user_id\": \"string\",\n \"user_ip\": \"string\",\n \"user_agent\": \"string\",\n \"test_only\": true\n }\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>",
'X-Retailer-Id': "string"
}
conn.request("POST", "/v2/ian/sp_price_candidate", 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-ian.instacart.com/v2/ian/sp_price_candidate"
payload := strings.NewReader("{\n \"page_context\": {\n \"page_query\": {\n \"price_query\": {\n \"ic_request_id\": \"string\",\n \"ad_slots_available\": 1,\n \"tags\": [\n \"string\"\n ],\n \"candidates\": [\n {\n \"object_tracking_id\": \"string\",\n \"position\": 1,\n \"relative_score\": 1,\n \"filter_reason\": \"string\",\n \"selected\": true\n }\n ]\n }\n },\n \"common_query\": {}\n },\n \"session_context\": {\n \"user_id\": \"string\",\n \"user_ip\": \"string\",\n \"user_agent\": \"string\",\n \"test_only\": true\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>")
req.Header.Add("X-Retailer-Id", "string")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
const http = require('https');
const options = {
method: 'POST',
hostname: 'connect-ian.instacart.com',
port: null,
path: '/v2/ian/sp_price_candidate',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Bearer <token>',
'X-Retailer-Id': 'string'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
page_context: {
page_query: {
price_query: {
ic_request_id: 'string',
ad_slots_available: 1,
tags: ['string'],
candidates: [
{
object_tracking_id: 'string',
position: 1,
relative_score: 1,
filter_reason: 'string',
selected: true
}
]
}
},
common_query: {}
},
session_context: {user_id: 'string', user_ip: 'string', user_agent: 'string', test_only: true}
}));
req.end();
Response
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Sponsored product price candidates response. |
A successful request returns message set to Successfully processed.
4xx errors
When the request is rejected as an invalid argument, the endpoint returns 400 with error code 1001. error.message is the message returned for that error. Correct the request and retry.
Response examples
Success
200Sponsored product price candidate request
{
"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 | empty page context | "can't be blank" | 1001 | {"key":"page_context"} |
400 | empty session context | "Couldn't find user_id in the request" | 4001 | Not applicable |