Skip to main content
The Recommendation API returns a list of items using the recommendation policy set on an ad unit. This page covers how to request recommendations, show the returned items, and prepare for empty results and failed requests.

Before you begin

  • API URL: Check your API URL. Recommendation requests do not require an access token.
  • Ad unit: Get the ID of an ad unit with recommendations enabled from your A2 contact. Your A2 contact sets the recommendation policy, the number of items, and the impression tracking mode on the ad unit.
  • Catalog: Register the items to recommend in Product Catalog. catalog_id in the response is the item ID in the catalog.

Build the request

When you need a recommendation list, call POST /app/v0/recommendation/{tagid} from the client (web or app) or your server. Put the ad unit ID in tagid. See Serving Recommendation in the API Reference for the available fields.
The number of items is set on the ad unit, not in the request.

Handle the response

Recommendation response example
Handle the response as follows.

Failed requests

Set a maximum time your service waits for recommendations. If that time passes or the request fails, replace it with your service’s default list, and do not show responses that arrive later. With the default settings, A2 returns HTTP 408 for requests it cannot process within one second. Error responses include errorcode and ext.message.
Error response example
If you request again, the recommendation result and tracking_token may change. Use the values of the response you actually showed in events. With On Recommendation Response (on_ad_response), responses that were not shown are also counted as responses.

Next steps

See Recommendation Event Tracking to send impressions, clicks, and conversions of the recommendations you show.