Request ads
POST/server/v2/ads
Run an auction for one or more placements on a page and get ranked ads back.
Call it from your backend while the page loads, once per page view, with every placement on the page. Sponsored Products and Sponsored Display use the same endpoint: the placement decides the ad format.
Your page renders the ads in its own templates. A 204 or a timeout means no ad: keep the slot empty or show your own content.
Payload at a glance
{
// required · Your domain id: the number of your market on GoWit
"domain_id": 1001,
// required · The shopper's session id
"session_id": "ec07083a-8bf812",
// required · The slots on this page that should be filled
"placements": [
{
// required · The key of the placement, set when the placement was created
"placement_id": 1
}
],
// required for on search pages · The shopper's search query
"search": "hiking boots",
// required for listing pages · The products listed organically on the page, in page order, each with its category
"products": [
{
// required · The product id you sent in the catalog push
"id": "P30005",
// optional · The product category as a text path, the same way it appears in retailer_taxonomy, e.g. Outdoor>Footwear
"category": "Outdoor>Footwear>Hiking Sandals"
},
// … 2 more
],
// optional · Results page, starting at 0
"page_number": 0
}
Every field, with types and formats, is listed under Body below.
Limits
- Body up to 2 MiB; at most 100 placements and 1,000 products per request.
- Serving deadline about 200 ms. Set your client timeout close to it and treat a timeout as no ad.
- An
ad_idis valid for one hour by default.
Errors
| Status | Message | What it means |
|---|---|---|
| 400 | Wrong Type Invalid request payload | The body is not valid JSON, or a field has the wrong JSON type. |
| 400 | Wrong Type Missing required fields: validation failure list: … | One failure per line, e.g. domain_id in body is required, session_id in body is required, placements in body should have at most 100 items. |
| 400 | Wrong Type Ad Placements should be provided in request body for version 2 of the API | placements is missing. |
| 400 | Wrong Type Ad Placement ID should not be provided in request body for version 2 of the API | A top-level placement_id was sent. Put it inside placements. |
| 400 | Wrong Type Region ID must be included for multi-region marketplaces | Your market is set up per region: send region_id. |
| 400 | Wrong Type City ID must be included for multi-city marketplaces | Your market is set up per city: send city_id. |
| 401 | Permission Required. | The key is wrong, lacks the ad-serving scope, or belongs to another marketplace. |
| 403 | Forbidden. | The calling IP is not on your allow-list. |
| 404 | Object not found: Marketplace | No market answers to the domain_id sent. Check the number GoWit shared. |
| 408 | (empty) | The request ran past the serving deadline. Treat it as no ad. |
| 413 | Request body too large. | The body is over 2 MiB. |
| 500 | Encountered an unknown error. | Unexpected error. Treat it as no ad and retry on the next page view. |
Request
Responses
- 200
- 204
- 400
Sponsored products. Show each product in its slot, using product_id and seller_ref. / Sponsored display. Build the banner from img_url, size and redirect, or render html when present.
No ads. No placement got an ad. The body is empty.
Invalid request