The winning ads endpoint is used to retrieve ads from the Koddi Ad server.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
This endpoint requests an ad or multiple ads for ad placements on pages throughout your site or app. The winning ad(s) result from an auction that the Koddi Ads platform runs in realtime, based on the business logic, bids and bid modifiers, and eligibility rules of your ad program.
Winning ads will return a list in rank order of the page-unique information and attributes for display of an ad, tracking data, and potentially an error message all contained within the response.
The parameters client_name, site and experience_name must match a unique valid combination (that will be provided by your Koddi team). No additional authentication is required for this endpoint by default, but an API key can be implemented if needed. When a key is configured for your client, send it in the x-api-key header (exact, case-sensitive match per client). A wrong or missing key returns 401 invalid api key; the key is checked after request validation, so a 400 takes precedence. The endpoint is also reachable at the alias POST /v2/winning_ads.
A Note on UUIDs (aka GUID)A UUID (or GUID) is an acronym for 'universally unique identifier' (or 'globally unique identifier'). It is a 128-bit integer number used to identify resources. More information can be found here.
You'll see we use GUIDs throughout the Koddi platform. We generally recommend that these values follow the format of a standard GUID, but realize there are times when that is not possible. When not possible, we ask that the ID you use contains only numbers and letters (no special characters). If that is not possible, your Koddi team can provide additional guidance.
Inputs
Sample InputsThis is a sample - the actual parameters in the categories and targeting sections in your instance of Koddi Ads are configured for your use cases. Please work with your Koddi team on specifics.
{
"client_name": "Your Name",
"domain": "www.yoursite.com",
"site_id": "127",
"experience_name": "Experience 1",
"page_name": "Search",
"max_requested": 25,
"slots_available": 5,
"bidders": [
{
"id": "27538",
"publisher_score": 1.23
},
{
"id": "345543",
"publisher_score": 1.00
},
{
"id": "657456",
"publisher_score": 0.89
},
{
"id": "857444",
"publisher_score": 0.50
}
],
"user": {
"guid": "[generated by publisher]",
"id": "[generated by publisher]",
"ip_address": "127.0.0.1",
"is_authenticated": false,
"culture": "en-US",
"currency": "USD",
"user_agent": "Chrome/20.0.1132.47"
},
"model": {
"name": "test_model",
"ab_segment_key": "pqs",
"test_version": [
"1202.2",
"9202.1",
"129.1"
]
},
"categories": {
"team": "Lions",
"gender": "W",
"category": "Apparel > Clothing > Shirts > Jerseys"
},
"targeting": {
"device_type": "Desktop",
"units": 2,
"new_cust": 0,
"value": 1,
"start": "1900-01-01",
"finish": "1900-01-02",
"hotel_country": "US",
"cuisine": [
"AmericanBreakfast"
]
},
"yield_management": {
"price_floor": 0,
"include_bids_below_price_floor": true,
"attributes": {
"market": [
"NY"
],
"adults": 5
}
}
}| Field | Type | Description | Required | |
| client_name | string | Your company name. Your Koddi team will provide this value. | Required | |
| domain | string | This is the domain of the site calling for winning ads. The format is generally "www.yoursite.com". This is used for downstream reporting only. | Optional (Usage of this field is strongly suggested if utilizing the Koddi SSP) | |
| site_id | string | This is the publisher defined ID of the site calling for winning ads. The format is flexible (any string) and is intended to map to your POS (Point of Sale) structure in a flexible and easy way. You must provide Koddi with a list of all values that will be passed so that our system can be configured to accept them. |
Required | |
| experience_name | string | This is the name of the experience that corresponds to the auction. Please work with your Koddi team to know what possible values exist for this parameter. (Must map to an experience already created within Koddi). | Required (a missing value returns 400 `experience name is missing`) | |
| page_name | string | The name of the page on your site (search, homepage, product details, category page, checkout, etc.)
Koddi requires a list of all values that could be passed, so that our system can be configured to accept them. |
Required | |
| max_requested | int | The max number of ads that will be returned by Koddi. | Optional | |
| slots_available | int | The number of slots that could be filled by ads on the page. Must be accurate to get proper coverage and inventory utilization metrics. | Required | |
| include_all_categories | bool | Requests ads across all categories. When sent together with bidders, the call returns an empty 200. | Optional | |
| client_tracking_id | string | Your own identifier for the request. Maximum 100 characters; longer values return 400. | Optional | |
| shared_context_id | string | An identifier shared across related requests. Values longer than 100 characters are truncated. | Optional | |
| bidders | array of objects | The list of ids (for each entity/product) and corresponding publisher_scores (relevance or quality score of each entity) to be entered in the auction. Duplicate values should be avoided. |
||
| id | string | The bidders for the auction. Duplicate values should be avoided. | Required if using bidders method | |
| publisher_score | float | The publisher defined relevance or quality score associated with each bidder. This value is used in auction ranking. | Optional | |
| user | object | Information about the user. | ||
| guid | string | Unique user ID generated by the publisher (used for tracking to conversion events). This value must remain consistent across auctions, impressions, clicks and conversions for attribution. | Required | |
| id | string | Optional secondary user ID from the publisher site. | Optional | |
| ip_address | string | The end user's IP (where allowed by local law). This is only used for fraud detection and is deleted within 48 hours. Please consult with your Koddi team if local law prevents sharing this information. | Optional, but highly suggested for bot detection and if utilizing the Koddi SSP | |
| is_authenticated | bool | Is the user signed in to the publisher site? | Optional | |
| culture | string | This is the language of the user (site) calling for winning ads. Koddi suggests using the language-COUNTRY format (Ex: en-US).
Koddi needs a listing of all values that might be passed before our system can be configured to accept them. |
Required | |
| currency | string | This is the currency of the user (site) calling for winning ads. We use the ISO 3 character code (Ex: USD, CAD, GBP, etc). | Required | |
| user_agent | string | The end user's user agent. Identifies what browser, OS, and device the user is on. This is used for fraud detection only. | Required | |
| model | object | Used for testing different ad treatments for users. Please contact your Koddi team to use this. | ||
| name | string | Used for testing different ad treatments for users. Please contact your Koddi team to use this. | Optional | |
| ab_segment_key | string | Used in certain instances to manually group an auction into a testing bucket. Please contact your Koddi team to use this. | Optional | |
| test_version | array of strings | Used for testing different ad treatments for users. Please contact your Koddi team to use this. | Optional | |
| categories | object | The categories that have been applied in user search (names should match the corresponding inventory feed column names; matching is case-insensitive). The categories don’t need to be configured. Values must be a string or a string array. If your page contains multiple values for a single category, use a string array. For example: “Brand”: [“Nike”, “Jordan”] | ||
| targeting | object | The targeting that has been applied in user search. These will be configured by Koddi for you based on your use cases during the implementation of Koddi Ads. | ||
| device_type | string | Identifies the device or platform associated with the request (Ex: Desktop, Mobile, Tablet, App, etc). | Optional | |
| hotel_country | string | The country the hotel is physically located. Please use standard 2 letter ISO codes on implementation. (Ex: US, CA, GB, FR). | Optional | |
| yield management | object | The yield management configuration that has been applied for the publisher. This can be configured by the publisher for specific search instances. | Optional | |
| include_bids_below_price_floor | bool | Would you like to include bids below the configured price floor in the auction? | Optional | |
| attributes | object | An object of key-value pairs. These will vary based on use case or specific publisher that these are enacted on - the above are just examples. | Optional |
Response
The winning ads endpoint responds with a click tracking URL, the ID of the winning bidder(s), an impression tracking URL which should be called when the ad impression occurs, the tracking string for both the click tracking and impression tracking URLs and other data (as configured). It is very important that the click and impression calls are built dynamically using the tracking data provided in this response.
The click_tracking_url and impression_tracking_url values are templates with literal placeholders, not ready-to-call URLs. The click URL has the form https://{host}/event-collection/beacon?action=click&trackingData={trackingData}&rank={rank}&clientName=..&beaconIssued=... The impression URL adds &ts={ts} and &type=viewed|loaded. Before calling either one, substitute {trackingData} (from the tracking_data value in the response), {rank} and, for impressions, {ts}. The host in these URLs is the Host of your winning ads request, so call the public {clientname}.koddi.io host or rewrite the host. beaconIssued is an RFC3339 timestamp with offset.
Sample ResponseThis is a sample - the actual parameters in the call in your instance of Koddi Ads may vary. Please work with your Koddi team on specifics.
{
"errors": [],
"sponsored_listings": [
{
"click_tracking_url": "koddi.io",
"bidder": "100000006",
"advertiser_name": "Campbell's Soup",
"impression_tracking_url": "koddi.io",
"tracking_data": "encoded_string",
"cpm": 29,
"bid": 31,
"cpc": 0,
"details": "",
"details_headline": "",
"rate": 0,
"bucket_id": null,
"regulations": {},
"tracking_guid": "GUID",
"advertiser_metadata": {
"advertiser_type": "Marketplace"
},
"assets": {
"creative_url": "koddi.io",
"creative_destination": "koddi.io",
"creative_name": "Creative Name",
"creative_cta": "Buy Now"
}
}
]
}The winning ads call will return a 400 only for the validated cases: client_name, client_tracking_id (maximum 100 characters), experience_name, site_id, bidders/categories/include_all_categories, bidder targeting and the asset key.
Otherwise, the call will return a 200 that either contains ads, or will be blank (meaning there is no active campaign for the criteria in the call). A blank 200 (empty errors and sponsored_listings) is also returned when the client_name, experience_name or site mapping is unknown, when the auction times out, for PWA holdout, and when the request body cannot be read.
If any additional error codes are returned, please work with your Koddi team to resolve them.

