GET https://api.infrhq.com/partner_project/advert/retrieve (opens in a new tab)
The retrieve advert API is the only api that you will need to integrate. All impression, clicks and conversions will be tracked automatically.
Parameters
api_key: Your API Key
backdrop: The context of the environment. For example, a user's music preferences and recent searches on a music streaming platform.
system_message (optional): special instructions for the ad generation system, such as language preferences (e.g., "The website is in Spanish, write the ad in Spanish.").
attributes (optional):
Attributes to store for metrics (e.g., {'user_id': '1234'})
.
Currently, only accepts string keys & (bool, int, float, string) values.
Response
A unique identifier for the advert.
An object containing the advert's information.
Metadata related to the advert.
Code Sample
let base_url = 'https://api.infrhq.com/partner_project/advert/retrieve';
let api_key = 'YOUR_PUBLIC_API_KEY'; // Replace with your API Key (infr_pk_...)
let backdrop = 'indie_rock, _electronic_music, _live_concerts, _local_music_events, _new_album_releases';
let system_message = 'The website is in Spanish, write the ad in Spanish.';
let attributes = JSON.stringify({'user_id': 1234, 'user_name': 'John Doe', "cohort_payable":true});
fetch(`${base_url}?api_key=${api_key}&backdrop=${backdrop}&system_message=${system_message}&attributes=${attributes}`)
.then(response => response.json())
.then(data => console.log(data));
{
"_id": "advert_zndhaahhwzw24wek",
"info": {
"description": "Enjoy the comfort and convenience of the Ford F-150 and take on any challenge the road throws your way. With a range of cab styles, cargo capacity, and a state-of-the-art inbuilt widescreen TV, you’ll be able to drive in luxurious style. Upgrade your ride and conquer the roads with the Ford F-150 today!",
"image": "https://res.cloudinary.com/dcwz20wdd/image/upload/v1680681074/2023-f-150-rattler-01-1648495659.jpg_fvw2in.jpg",
"link": "https://api.infrhq.com/c/earfxzqfiquj",
"title": "Conquer the Road with the Ford F-150!"
},
"meta": {
"date_created": 1680680698
}
}