Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Get sponsored product candidates

POST /v2/ian/sp_candidate

Retrieves sponsored product candidates for partners that Instacart enables for enhanced integration. The response includes product identifiers and auction metadata. It does not include the rendered item-card payload returned by Get sponsored products. The request body and the supported page and placement pairings match that endpoint. Field tables on this page are generated from the OpenAPI specification. page_context.common_query.partner_request_id is still required. It is a UUID that you generate for the request, and you send the same value on Report sponsored product price candidates. The generated field tables omit it.

After you rank or filter the candidates, report the outcome with Report sponsored product price candidates. For the full workflow, see Enhanced integration.

Security​

NameInDescription
AuthorizationheaderThe Authorization header with the bearer token acquired during authentication.

Parameters​

NameInTypeRequiredDescription
X-Retailer-IdheaderstringOptional

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​

FieldTypeRequiredDescription
page_contextSponsoredProductsPageContextRequired

The page context for the ad request, including the page type, filters, and ad load configuration.

placement_contextSponsoredProductsPlacementContextRequired

The placement configuration for the ad request. The placement kind must be compatible with the selected page query type.

session_contextSessionContextRequired

The user session information, including user ID, IP address, and user agent string.

store_contextStoreContextRequired

The store context identifying the retail location for the ad request.

pagination_contextPaginationContextOptional

The pagination parameters for fetching a specific page of ads. On the first request, omit the token to receive a fresh result set and a session token. On subsequent requests, include the token and advance the offset to retrieve additional pages.

SponsoredProductsPageContext Object​

FieldTypeRequiredDescription
page_querySponsoredProductsQueryRequired

The page type for the ad request. Exactly one page query option must be specified (for example, search_query or storefront_query). The selected option determines which ads are eligible to be served.

filter_queryFilterQueryOptional

Filters to narrow the returned ads. Supports tag-based, category-based, or brand-based filtering. Filters are applied independently of the page type. Your catalog inventory file must include the corresponding tags, category IDs, or brand IDs for filtering to take effect.

ad_load_queryAdLoadQueryOptional

Controls the maximum number of ads returned in the response.

SponsoredProductsQuery Object​

FieldTypeRequiredDescription
search_querySearchQueryOptional

Retrieves sponsored product ads for a search results page. Must be paired with the 'in_grid' placement kind. Only one page query option may be specified per request.

user_previously_purchased_queryUserPreviouslyPurchasedQueryOptional

Retrieves sponsored product ads for a Buy It Again or previously purchased products page. Must be paired with the 'in_grid' placement kind. Only one page query option may be specified per request.

storefront_queryStorefrontQueryOptional

Retrieves sponsored product ads for the storefront page. Must be paired with the 'mixed_ads_carousel' placement kind. Only one page query option may be specified per request.

product_category_queryProductCategoryQueryOptional

Retrieves sponsored product ads for a product category or browse page. Must be paired with the 'in_grid' placement kind. Only one page query option may be specified per request.

candidate_carousel_queryCandidateCarouselQueryOptional

Specify a list of desired UPCs to display in the carousel.

For the Candidate Carousel Query the responses are based on the UPC list provided:

  • Provided UPC list contains all ad-eligible items: All appear in the response, ranked by SP auction
  • Provided UPC list contains no eligible items: Response is (empty payload)
  • Provided UPC list is mixed eligibility: Only eligible items returned; others ignored
  • UPC list contains duplicates: Duplicates are deduplicated before auction
  • Location code does not match an active retailer facility: Response is (empty payload)

SearchQuery Object​

FieldTypeRequiredDescription
page_view_idstringOptional

A unique identifier for the current page view. Must be a valid UUID. Pass the string 'None' if a page view identifier is not available.

search_termstringRequired

The search term entered by the user. Ads are matched based on relevance to this term.

enable_auto_correctbooleanOptional

When set to true, auto-correction is applied to the search term to improve matching for misspellings. Defaults to true. Enabling auto-correction increases response latency.

UserPreviouslyPurchasedQuery Object​

FieldTypeRequiredDescription
page_view_idstringOptional

A unique identifier for the current page view. Must be a valid UUID. Pass the string 'None' if a page view identifier is not available.

StorefrontQuery Object​

FieldTypeRequiredDescription
page_view_idstringOptional

A unique identifier for the current page view. Must be a valid UUID. Pass the string 'None' if a page view identifier is not available.

ProductCategoryQuery Object​

FieldTypeRequiredDescription
category_idsArray(integer)Required

An array of product category IDs for the category page being viewed. Sponsored products are matched based on these categories.

page_view_idstringOptional

A unique identifier for the current page view. Must be a valid UUID. Pass the string 'None' if a page view identifier is not available.

CandidateCarouselQuery Object​

FieldTypeRequiredDescription
page_view_idstringOptional

A unique identifier for the current page view. Must be a valid UUID. Pass the string 'None' if a page view identifier is not available.

upc_listArray(string)Required

An array of UPC strings identifying the products eligible for the carousel ad auction.

FilterQuery Object​

FieldTypeRequiredDescription
filter_tagsFilterTagsOptional

Filters ad results by product tags. When specified, only products matching at least one tag are returned. The object must contain a 'tags' array. Example: { "filter_tags": { "tags": ["tag1", "tag2"] } }. Not applicable to display banner requests.

product_category_filter_queryProductCategoryFilterQueryOptional

Filters available ads by product category. Ads are returned only if the advertised product matches at least one of the specified category IDs. Applies to search, Buy It Again, and storefront placements. For product category placements, specify category IDs in the PageQuery object.

brand_idsArray(integer)Optional

An array of brand IDs to filter available ads. Ads are returned only if they match at least one of the specified brand IDs.

FilterTags Object​

FieldTypeRequiredDescription
tagsArray(string)Required

An array of tag strings. Only products matching at least one of the specified tags are returned.

ProductCategoryFilterQuery Object​

FieldTypeRequiredDescription
category_idsArray(integer)Required

An array of product category IDs. Ads are returned only if the advertised product belongs to at least one of the specified categories.

AdLoadQuery Object​

FieldTypeRequiredDescription
ads_countstringOptional

The maximum number of ads to return, specified as a string (for example, "10"). Must be an integer value between 1 and 100. The actual number of ads returned may be lower depending on available inventory.

SponsoredProductsPlacementContext Object​

FieldTypeRequiredDescription
placement_kindSponsoredProductsKindRequired

Specifies how sponsored product ads are displayed on the page. Exactly one placement option must be provided: 'in_grid' for ads within a product grid, or 'mixed_ads_carousel' for ads within a carousel.

SponsoredProductsKind Object​

FieldTypeRequiredDescription
in_gridInGridOptional

Displays sponsored product ads inline within the main product grid. Only one placement option may be specified per request. Must be paired with one of the following page queries: search_query, user_previously_purchased_query, product_category_query, or candidate_carousel_query.

mixed_ads_carouselMixedAdsCarouselOptional

Displays sponsored product ads in a carousel alongside organic products. Only one placement option may be specified per request. Pair mixed_ads_carousel with a storefront_query or candidate_carousel_query page query. The carousel_query supports only user_previously_purchased_query. Do not pair search_query or product_category_query with mixed_ads_carousel. Those page queries must use the in_grid placement kind. Combining search_query or product_category_query with mixed_ads_carousel returns error code 1001.

InGrid Object​

FieldTypeRequiredDescription
supported_formatArray(string)Required

The ad format for the placement, specified as an array. The supported value is ["item_card"].

MixedAdsCarousel Object​

FieldTypeRequiredDescription
supported_formatArray(string)Required

The ad format for the placement, specified as an array. The supported value is ["item_card"].

carousel_queryInCarouselQueryRequired

The organic product context for the carousel. Ads are matched to be relevant to this context. Typically uses a user_previously_purchased_query.

InCarouselQuery Object​

FieldTypeRequiredDescription
user_previously_purchased_queryUserPreviouslyPurchasedQueryOptional

Provides previously purchased product context for the carousel. Only one option may be specified per request.

SessionContext Object​

FieldTypeRequiredDescription
user_idstringRequired

A unique identifier for the end user. Maximum 50 characters.

user_ipstringRequired

The IP address of the end user. Must be a valid IPv4 or IPv6 address.

user_agentstringRequired

The User-Agent string from the end user's device. Maximum 1000 characters.

test_onlybooleanOptional

When set to true, only test campaigns are returned in the response. Regular campaigns are excluded. Use this to validate your integration without serving live ads. Defaults to false.

StoreContext Object​

FieldTypeRequiredDescription
location_codestringRequired

The store location code for the retail location to retrieve ads for. Must match a location code associated with your account. Maximum 100 characters.

PaginationContext Object​

FieldTypeRequiredDescription
page_sizeintegerOptional

Number of ads to return per page. Defaults to the placement's configured page size when omitted.

offsetintegerOptional

How far into the result set to advance, expressed in whole pages, starting at 1. An offset of 1 returns the first page, 2 returns the second, and so on. Defaults to 1 when omitted.

tokenstringOptional

Opaque session token returned by a previous paginated response. Include this token in subsequent requests to retrieve pages from the same cached result set. Omit on the first request to begin a new pagination session.

Combining search_query or product_category_query with mixed_ads_carousel returns error code 1001.

Request examples​

This example uses one search query and an in-grid placement.

curl --request POST \
--url https://connect-ian.instacart.com/v2/ian/sp_candidate \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Retailer-Id: the-garden' \
--data '{
"page_context": {
"page_query": {
"search_query": {
"page_view_id": "4291d814-8a75-4fef-9426-123c5840f7bc",
"search_term": "pasta",
"enable_auto_correct": true
}
},
"filter_query": {
"filter_tags": {
"tags": [
"organic"
]
}
},
"ad_load_query": {
"ads_count": "10"
},
"common_query": {
"partner_request_id": "68fe21d8-4802-499f-bf12-f7315ae50091"
}
},
"placement_context": {
"placement_kind": {
"in_grid": {
"supported_format": [
"item_card"
]
}
}
},
"session_context": {
"user_id": "kamalsingh1234",
"user_ip": "192.0.2.146",
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64)",
"test_only": true
},
"store_context": {
"location_code": "111"
},
"pagination_context": {
"page_size": 10,
"offset": 1
}
}'
warning

The example sets test_only to true for integration testing. Set test_only to false, or omit it, before you launch to production. For more information, see Environments and testing.

Response​

FieldTypeRequiredDescription
ic_request_idstringOptional

Unique ID for tracking the specific API request.

is_explorationbooleanOptional

Indicates if the candidates were retrieved purely based on bids.

productsArray(SponsoredProductCandidate)Optional

List of sponsored product candidates. When no ads are returned, the response is an empty array.

SponsoredProductCandidate Object​

FieldTypeRequiredDescription
object_tracking_idstringRequired

The unique tracking identifier for this ad.

rrcstringRequired

Retailer reference code (RRC) which can be used by retailers to fetch additional metadata about the product from their own catalog. Either RRC or UPC is returned depending on the retailer's configuration.

relative_bidintegerRequired

The relative Bid value associated with the product for ad auctions.

demand_sourcestringRequired

The source of the demand for the product.

When no ads are returned, products is an empty array.

4xx errors​

These 400 responses use error code 1001.

HTTP codeError codeMessageWhat to do
4001001the given location code is not foundSend a location_code that exists for this account, then retry.
4001001Filter tag not found: followed by the filter tags that were not foundCorrect the filter tags and retry.

When the request is rejected as an invalid argument, the endpoint also returns 400 with error code 1001. error.message is the message returned for that error. Correct the request and retry.

Response examples​

Success

{
"ic_request_id": "ic_request_id",
"is_exploration": false,
"products": [
{
"object_tracking_id": "candidate_1",
"rrc": "rrc_1",
"relative_bid": 1,
"demand_source": "IC_SOURCED_DEMAND"
},
{
"object_tracking_id": "candidate_2",
"rrc": "rrc_2",
"relative_bid": 2,
"demand_source": "PARTNER_SOURCED_DEMAND"
}
]
}

4XX Errors

Error responses return either a single error or multiple errors.

HTTP CodeCauseError MessageError CodeError Meta
400invalid search page query with mixed ads carousel placement kind"No internal placements match the given page query type and placement kind"1001Not applicable
400empty page query"the number of attributes given for page_query is 0"1001{"key":"page_context.page_query"}
400Request with more than one attribute used in page query"the number of attributes given for page_query is 2"1001{"key":"page_context.page_query"}
400empty placement kind"the number of attributes given for placement_kind is 0"1001{"key":"placement_context.placement_kind"}
400more than one attribute used in placement kind"the number of attributes given for placement_kind is 2"1001{"key":"placement_context.placement_kind"}
400too long user_id in the session context"User ID length must be less than 51 characters"1001{"key":"session_context.user_id"}
400too long location code in the store context"Location code length must be less than 101 characters"1001{"key":"store_context.location_code"}
401store that doesn't match the oauth token used"the given location code doesn't match the oauth token used."nullNot applicable