api
Native Ad Server API
Build native ads into your web page or app
dvr
Sponsored Listings API
Let sellers promote their product at the top of the list
grid_view
Promoted Content API
Add promoted content based on search queries or keywords
desktop_windows
Digital-Out-Of-Home (DOOH) API
Reach out of home audiences on screens or billboards
campaign
Internal Promotions API
Offer users vouchers or promo codes at the right time
api
Decision API
Returns a JSON response with ads
api
Management API
Manage campaigns and inventory
api
Reports API
Custom reports and data shipping
monitor_heart
API Status
Live network infrastructure status
AdFlight.io Logo
AdFlight.io
Ad Server APIs for Developers
topic Getting Started
Authentication
Error Handling
api Decision API
Ad Request
Ad Response
Logging Events
api Management API
Channels
Zones
Advertisers
Campaigns
Creatives
api Reporting API
Reports

Ad Request

Endpoint

post
/v2/decision

Parameters

placements
object, required
The placements object contains the zone ID for which you make an ad request.
targeting
object
An object holding targeting information to fine-tune delivery to users matching your audience.
user
object
Firt-party data about the user, like the user agent and geolocation data. Especially useful if you make server-side requests.
deduplication
object
Deduplication makes sure the same ad is not selected more than once if you request multiple ads.
exclude_ids
object
You can manually exclude advertisers, campaigns or ads from being served.

Placements Object

zone_id
int, required
The ID of the zone for which you want to request and ad. Find the Zone ID in your AdFlight portal or fetch a list via the Management API.
identifier
string, required
An identifier for the DIV or element in which you'll display the ad.
ad_requests
int, required
The number of ads you like to request for the zone. Should be >=1.

Targeting Object

keywords
object
A list of keywords used for targeting. This should be an array of strings.

User Object

user_agent
string
The user-agent string of the person requesting the ad.
language
string
The accept-language string of the person requesting the ad.
device
string
Can be either desktop, tablet or mobile. Used for targeting.
page_url
string
The URL on which the ad will be served. Used for reporting.

Deduplication Object

level
string
At which level you want to deduplicate ads. Can be either advertiser, campaign or creative.

Exclude Object

advertisers
array
An array of advertiser IDs which have to be excluded during decisioning.
campaigns
array
An array of campaign IDs which have to be excluded during decisioning.
creatives
array
An array of creative IDs which have to be excluded during decisioning.
Example Request
{
     "placements": [{
         "identifier": "div1",
         "zone_id": "537477984",
         "ad_requests": 2
    },
     {
         "identifier": "div2",
         "zone_id": "984574737",
         "ad_requests": 1
    }],
     "targeting": {
         "keywords": ["cars",
        "audi"],
        
    },
     "user": {
         "ua": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)",
         "language": "",
         "device": "desktop",
         "geo": {
             "country": "US",
             "region": "",
             "latitude": 40.730610,
             "longitude": -73.935242
        },
         "page_url": "https://www.mypage.com"
    },
     "deduplication": {
         "level": "campaign"
    },
     "exclude_ids": {
         "advertisers": [938923838,
        4329980182],
         "campaigns": [],
         "creatives": []
    }
format_quoteThese plug & play ad serving APIs have cut down developement cost tremendously. Absolutely a huge time saver for anyone who wants to build a custom ad server in a short time.
Hayden Elson
starstarstarstarstar
Developer at Galactic Media