### Example Tracking Link Source: https://www.ayetstudios.com/openapi/publisher-doc An example of a tracking link used by a user, demonstrating how custom parameters are passed. ```text https://www.ayetstudios.com/s2s/pub/53270/1/1?external_identifier=your-user-id-1&custom_1=your-custom-click-id ``` -------------------------------- ### Example Final Postback to Server Source: https://www.ayetstudios.com/openapi/publisher-doc This example illustrates the final postback sent to a server after a user completes an offer, including populated parameters. ```text https://www.your-ad-server.com/postback?event_value=2.33&event_name=payment-made-custom-task&placement_identifier=my_api_placement&adslot_id=18&sub_id=your-user-id-1&your_parameter=your-custom-click-id ``` -------------------------------- ### Example Callback URL Configuration Source: https://www.ayetstudios.com/openapi/publisher-doc This example shows how to configure a callback URL in the publisher dashboard, including placeholders for dynamic data. ```text https://www.your-ad-server.com/postback?event_value={event_value}&event_name={event_name}&placement_identifier={placement_identifier}&adslot_id={adslot_id}&sub_id={external_identifier}&your_parameter={custom_1} ``` -------------------------------- ### Surveywall API SDK Example Source: https://www.ayetstudios.com/openapi/publisher-doc An example of how to integrate the Surveywall API into a website using the provided JavaScript SDK. This example demonstrates client-side usage and how to configure the SDK for displaying surveys. ```html Surveywall SDK Example ``` -------------------------------- ### Example Callback URL Configuration Source: https://www.ayetstudios.com/openapi/publisher-doc This example shows how to configure a callback URL in the AyetStudios dashboard. It includes placeholders for dynamic data like payout, placement identifier, adslot ID, external identifier, and custom parameters, which will be substituted when a conversion occurs. ```url https://www.your-ad-server.com/postback?payout_usd={payout_usd}&placement_identifier={placement_identifier}&adslot_id={adslot_id}&sub_id={external_identifier}&your_parameter={custom_1} ``` -------------------------------- ### Example Tracking Link and Final Postback Source: https://www.ayetstudios.com/openapi/publisher-doc Demonstrates a user's tracking link and the resulting postback sent to your server upon conversion. The final postback includes all relevant conversion details, such as payout, identifiers, and custom parameters, plus a chargeback indicator. ```url https://www.ayetstudios.com/s2s/pub/53270/1/1?external_identifier=your-user-id-1&custom_1=your-custom-click-id ``` ```url https://www.your-ad-server.com/postback?payout_usd=0.51&placement_identifier=my_api_placement&adslot_id=18&sub_id=your-user-id-1&your_parameter=your-custom-click-id&is_chargeback=0-or-1 ``` -------------------------------- ### GET /offers/offerwall_api/{adslot} Source: https://www.ayetstudios.com/openapi/publisher-doc Retrieves a list of offers for the offerwall based on the provided adslot and query parameters. ```APIDOC ## GET /offers/offerwall_api/{adslot} ### Description Retrieves a list of offers for the offerwall based on the provided adslot and query parameters. ### Method GET ### Endpoint `https://www.ayetstudios.com/offers/offerwall_api/{adslot}` ### Parameters #### Path Parameters - **adslot** (string) - Required - The ID of the adslot. #### Query Parameters - **external_identifier** (string) - Required - Example: `external_identifier=id of user` - **device_make** (string) - Optional - Example: `device_make=Samsung` - **device_model** (string) - Optional - Example: `device_model=GALAXY S10` - **os** (string) - Optional - Enum: "android", "ios", "desktop" - Example: `os=android` - **os_version** (string) - Optional - Example: `os_version=10.1.0` - **browser** (string) - Optional - Example: `browser=Chrome` - **browser_version** (string) - Optional - Example: `browser_version=88.0.4324.96` - **user_agent** (string) - Optional - Example: `user_agent=Mozilla/5.0 ...` - **client_hints** (string) - Optional - Example: `client_hints={...}` - **ip** (string) - Optional - Example: `ip=203.0.113.1` - **gaid** (string) - Optional - Example: `gaid=97987bca-ae59-4c7d-94ba-ee4f19ab8c21` - **idfa** (string) - Optional - Example: `idfa=6D92078A-8246-4BA4-AE5B-76104861E7DC` - **custom_1** (string) - Optional - Custom parameter. - **custom_2** (string) - Optional - Custom parameter. - **custom_3** (string) - Optional - Custom parameter. - **custom_4** (string) - Optional - Custom parameter. - **custom_5** (string) - Optional - Custom parameter. - **request_live_networks** (boolean) - Optional - Default: `false` - **num_offers** (integer) - Optional - Number of offers to return. - **offer_sorting** (string) - Optional - Enum: "payout", "conversion_rate", "epc", "ecpm" - Specify the key for sorting. - **minimum_payout** (number) - Optional - Minimum payout of offers to return. - **include_cpe** (boolean) - Optional - Default: `false` - Example: `include_cpe=true` - **include_mobile_offers** (boolean) - Optional - Default: `false` - Example: `include_mobile_offers=true` - **language** (string) - Optional - Example: `language=en` - **age** (integer) - Optional - Example: `age=45` - **gender** (string) - Optional - Enum: "male", "female", "non_binary" - Example: `gender=female` ### Request Example ```javascript async function fetchData() { let adslotId = 1234; let externalIdentifier = 'YOUR_VALUE'; let userAgent = navigator.userAgent; let clientHints = ''; if (navigator.userAgentData) { try { clientHints = await navigator.userAgentData.getHighEntropyValues(['architecture', 'bitness', 'brands', 'mobile', 'model', 'platform', 'platformVersion', 'uaFullVersion', 'fullVersionList', 'wow64']); clientHints = encodeURIComponent(JSON.stringify(clientHints)); } catch (e) { console.log(e); } } let requestUrl = 'https://www.ayetstudios.com/offers/offerwall_api/' + adslotId + '?external_identifier=' + externalIdentifier + '&user_agent=' + encodeURIComponent(userAgent) + '&client_hints=' + clientHints; fetch(requestUrl) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.log('There was a problem with the fetch operation:', error.message); }); } fetchData(); ``` ### Response #### Success Response (200) - **offers** (array) - An array of offer objects. - **pagination** (object) - Pagination details. #### Response Example (Response structure depends on the offers returned. Please refer to the API for specific details.) ``` -------------------------------- ### GET /websites/ayetstudios_openapi Source: https://www.ayetstudios.com/openapi/publisher-doc Retrieves a list of offers from Ayet Studios with various filtering and sorting options. This endpoint is useful for integrating offer data into other applications or platforms. ```APIDOC ## GET /websites/ayetstudios_openapi ### Description Retrieves a list of offers from Ayet Studios. This endpoint allows fetching offer details, including conversion instructions, platform information, and tracking links. ### Method GET ### Endpoint `/websites/ayetstudios_openapi` ### Parameters #### Query Parameters - **platform** (string) - Optional - Filters offers by platform (e.g., 'android', 'ios'). - **category** (string) - Optional - Filters offers by category (e.g., 'incent', 'games'). - **country** (string) - Optional - Filters offers by country code (e.g., 'US', 'GB'). - **search** (string) - Optional - Searches offers by name or description. ### Request Example ```json { "example": "GET /websites/ayetstudios_openapi?platform=android&category=games" } ``` ### Response #### Success Response (200) - **offers** (array) - An array of offer objects. - **id** (integer) - Unique identifier for the offer. - **store_id** (string) - The store identifier for the offer. - **landing_page** (string) - The landing page URL for the offer. - **icon** (string) - URL of the offer's icon. - **name** (string) - Name of the offer. - **description** (string) - Description of the offer. - **tags** (object) - Contains tags related to the offer (e.g., 'tab', 'tasks', 'categories'). - **icon_large** (string) - URL of the large version of the offer's icon. - **video_url** (string) - URL of the offer's video. - **video_url_vp9** (string) - URL of the offer's VP9 video. - **platform** (string) - The primary platform for the offer. - **platforms** (array) - List of supported platforms. - **devices** (array) - List of supported devices. - **category** (string) - Category of the offer. - **conversion_type** (string) - Type of conversion for the offer (e.g., 'cpe'). - **conversion_time** (integer) - Time in seconds for conversion. - **max_conversion_time** (integer) - Maximum allowed time in seconds for conversion. - **conversion_instructions** (string) - General instructions for conversion. - **conversion_instructions_short** (string) - Short version of conversion instructions. - **conversion_instructions_long** (string) - Long version of conversion instructions. - **countries** (array) - List of supported countries. - **payout_usd** (number) - Payout amount in USD. - **currency_amount** (integer) - Payout amount in the offer's currency. - **epc** (string) - Earnings Per Click value. - **daily_cap** (integer) - Daily cap for the offer. - **tracking_link** (string) - Tracking link for the offer. - **impression_url** (string) - Impression tracking URL. - **created** (string) - Date and time when the offer was created. - **start_date** (string) - Start date for the offer. - **end_date** (string) - End date for the offer. - **offer_owner** (integer) - Identifier for the offer owner. - **score** (integer) - Score associated with the offer. - **devices_whitelist** (array) - List of whitelisted devices. - **devices_blacklist** (array) - List of blacklisted devices. - **offer_complexity** (string) - Complexity level of the offer. - **payment_required** (boolean) - Indicates if payment is required for the offer. - **i18n** (object) - Internationalization object containing localized instructions. - **tasks** (array) - List of tasks associated with the offer. #### Response Example ```json { "offers": [ { "id": 218820, "store_id": "", "landing_page": "https://play.google.com/store/apps/details?id=com.codigames.idle.barber.shop.empire.tycoon", "icon": "https://play-lh.googleusercontent.com/zQL7-oG8X5AUKOM9XdOLlySr0zt9iQMYrhbhmT9PFVp7EnHI0DcJAPB9-8qwNkS3Y7w=w140", "name": "Idle Barber Shop Tycoon - Business Management Game", "description": "", "tags": { "tab": "apps", "tasks": [ "install" ], "categories": [ "games_racing", "games" ] }, "icon_large": "", "video_url": "", "video_url_vp9": "", "platform": "android", "platforms": [ "android" ], "devices": [], "category": "incent", "conversion_type": "cpe", "conversion_time": 300, "max_conversion_time": 17340, "conversion_instructions": "Complete multiple tasks to get your rewards. {multiple_rewards}", "conversion_instructions_short": "Complete multiple tasks to get your rewards.", "conversion_instructions_long": "{multiple_rewards}", "countries": [], "payout_usd": 0.506, "currency_amount": 506, "epc": "new", "daily_cap": 1000000, "tracking_link": "https://www.ayetstudios.com/s2s/pub/218819/1595/2772/3142?external_identifier={external_identifier}", "impression_url": "https://www.ayetstudios.com/offers/shown/218819;92;0;e4f323bdf5d01e92d8632f647d905cc42f9bef8c/img.gif?external_identifier={external_identifier}", "created": "2021-06-09 09:17:47", "start_date": "2021-06-09 00:00:00", "end_date": "2026-06-09 00:00:00", "offer_owner": 0, "score": 0, "devices_whitelist": [], "devices_blacklist": [], "offer_complexity": "0", "payment_required": false, "i18n": { "en": { "conversion_instructions_short": "Complete multiple tasks to get your rewards.", "conversion_instructions_long": "{multiple_rewards}" }, "de": { "conversion_instructions_short": "Schließe mehrere Aktionen ab, um deine Belohnungen zu erhalten.", "conversion_instructions_long": "Schließe mehrere Aktionen ab, um deine Belohnungen zu erhalten." } }, "tasks": [ { "name": "Install the app", "uuid": "dff19bdd-3667-31f1-ac97-7523455a215d", "event_name": "triggered_001", "payout": 0.056 } ] } ] } ``` ``` -------------------------------- ### Fetch Survey Data using JavaScript and Fetch API Source: https://www.ayetstudios.com/openapi/publisher-doc This JavaScript example demonstrates how to fetch survey data from the Ayet Studios API. It constructs a URL with parameters like ad slot ID, external identifier, language, user agent, and client hints. The `fetch` API is used to make the request, and the response is parsed as JSON. It then iterates over the surveys to log their properties. ```javascript /* // Minimal working example: const adslotId = 'adslot_id'; // Replace with your adslot ID const externalIdentifier = 'your_external_identifier'; // Replace with your external identifier // Get user agent and client hints const userAgent = navigator.userAgent; let clientHints = ''; const language = navigator.languages.join(','); if (navigator.userAgentData) { navigator.userAgentData .getHighEntropyValues([ 'architecture', 'bitness', 'brands', 'mobile', 'model', 'platform', 'platformVersion', 'uaFullVersion', 'fullVersionList', 'wow64' ]) .then(hints => { clientHints = encodeURIComponent(JSON.stringify(hints)); fetchSurveys(); }) .catch(error => { console.error('Error fetching client hints:', error); fetchSurveys(); // Proceed without client hints }); } else { fetchSurveys(); // Proceed without client hints } function fetchSurveys() { const url = 'https://www.ayetstudios.com/surveys/surveywall_api/' + adslotId + '?external_identifier=' + externalIdentifier + '&language=' + language + '&user_agent=' + encodeURIComponent(userAgent) + '&client_hints=' + clientHints; fetch(url) .then(response => response.json()) .then(data => { data.surveys.forEach(survey => { console.log('Survey Properties:', { category: survey.category, loi: survey.loi, missing_qualifications: survey.missing_qualifications, is_new: survey.is_new, cpi: survey.cpi, url: survey.url, category_icon_svg: survey.category_icon_svg, category_icon_gif: survey.category_icon_gif }); }); }) .catch(error => { console.error('Error fetching or logging surveys:', error); }); }*/ ``` -------------------------------- ### GET /offers/get/{adslot} Source: https://www.ayetstudios.com/openapi/publisher-doc Retrieves a list of currently running campaigns available for a specific adslot. This endpoint can be filtered by country, platform, and conversion type. ```APIDOC ## GET /offers/get/{adslot} ### Description Returns a list of currently running campaigns on our platform which suit your adslot configuration. Can be filtered by additional parameters. **Note:** To pass custom parameters from clicks to conversion callbacks, the `tracking_link` parameter in offer objects can be extended with `&custom_1=...` to `&custom_5=...` Those five parameters can be accessed in the publisher dashboard and from conversion callbacks using the `{custom_1} - {custom_5}` macros in the resulting callback URL. Tracking links can also be extended with `&age={numeric_age}` and `&gender={gender}` to collect demographic data. The `age` parameter accepts a numeric age in years. The `gender` parameter accepts values: `male`, `female`, or `non_binary`. The `external_identifier` parameter found as placeholder in tracking links is important for persistent user identification and also allows access to the users reward status. Publishers who are unable to provide a stable `external_identifier` for their users can use the `{DYNAMIC_USER}` macro and let ayeT-Studios handle the identification. **Since this has implications on traffic quality and offer exposure, please contact your account manager before implementing this.** ### Method GET ### Endpoint https://www.ayetstudios.com/offers/get/{adslot} ### Parameters #### Path Parameters - **adslot** (string) - Required - The adslot ID. #### Query Parameters - **apiKey** (string) - Required - Static API key that is available under adslot details in your dashboard. - **countries[]** (array of strings) - Optional - Array of ISO 2 country codes. Example: `countries[]=US`. - **platform[]** (array of strings) - Optional - Items Enum: "android", "ios", "desktop". - **conversion_type[]** (array of strings) - Optional - Items Enum: "cpi", "cpa", "cpe", "cpl". ### Request Example ```php "https://www.ayetstudios.com/offers/get/3142?apiKey=xxxx&countries%5B%5D=DE&platform%5B%5D=ios&conversion_type%5B%5D=cpi", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ?> ``` ### Response #### Success Response (200) OK. The response will be a JSON object containing a list of offers. #### Response Example ```json { "offers": [ { "name": "Daily Bonus", "uuid": "dff19bdd-3667-31f1-ac97-7523455a215a", "event_name": "daily_bonus", "payout_base": 100, "payout": 100, "multi_limit": 1, "currency": "Coins", "completed": false, "status": "available", "remaining_time": null }, { "name": "Team Up", "uuid": "dff19bdd-3667-31f1-ac97-7523455a215a", "event_name": "team_up", "payout_base": 281, "payout": 281, "multi_limit": 1, "currency": "Coins", "completed": false, "bonus_task": false, "status": "available", "remaining_time": null }, { "name": "Regular Player", "uuid": "dff19bdd-3667-31f1-ac97-7523455a216e", "event_name": "reg_ev_455", "payout_base": 22, "payout": 22, "multi_limit": 10, "currency": "Coins", "completed": false, "percentage": 0, "bonus_task": false, "status": "available", "remaining_time": null } ], "cpe_total_rewards_currency_name": "Coins", "cpe_progressbar_percentage": "5", "payout": 697, "payout_base": 697, "payout_name": "697 Coins", "button_text": "+697", "rating": "4.5", "screenshots": [ "https://lh3.googleusercontent.com/screen1.png", "https://lh3.googleusercontent.com/screen2.png" ], "has_installation_callback": true } ``` ``` -------------------------------- ### JSON Response Sample for Currency Sale Source: https://www.ayetstudios.com/openapi/publisher-doc This is an example of a successful JSON response (status code 200) from the Publisher Reporting API, showcasing a currency sale scenario. It includes details about filters, survey wall configuration, and available surveys. ```json { "status": "success", "filters": { "targeting": "desktop", "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36", "client_hints": "{\"architecture\":\"x86\",\"bitness\":\"64\",\"brands\":[{\"brand\":\"Not A(Brand\",\"version\":\"8\"},{\"brand\":\"Chromium\",\"version\":\"132\"},{\"brand\":\"Google Chrome\",\"version\":\"132\"}],\"fullVersionList\":[{\"brand\":\"Not A(Brand\",\"version\":\"8.0.0.0\"},{\"brand\":\"Chromium\",\"version\":\"132.0.6834.83\"},{\"brand\":\"Google Chrome\",\"version\":\"132.0.6834.83\"}],\"mobile\":false,\"model\":\"\",\"platform\":\"Linux\",\"platformVersion\":\"6.8.0\",\"uaFullVersion\":\"132.0.6834.83\",\"wow64\":false}", "ip": "127.0.0.1", "language": [ "de", "en" ], "num_surveys": 20, "survey_sorting": "cr", "minimum_payout": 0 }, "surveywall": { "name": "surveywall test", "currency_name_singular": "Coin", "currency_name_plural": "Coins", "currency_sale": false, "currency_sale_multiplier": 1, "currency_sale_end": null }, "profiler": { "missing_profiler": false, "missing_profiler_qualifications": 0 }, "surveys": [ { "id": 6232459, "cpi": 32.21, "loi": 17, "category": "miscellaneous", "remaining_completes": 2, "is_new": false, "url": "https://example.com", "missing_qualifications": 0, "category_icon_svg": "https://cdn.ayet.io/sw-icons/Other.svg", "category_icon_gif": "https://cdn.ayet.io/sw-icons/Other.gif" }, { "id": 6232614, "loi": 16, "category": "technology", "remaining_completes": 2, "is_new": false, "cpi": 54.25, "url": "https://example.com", "missing_qualifications": 1, "category_icon_svg": "https://cdn.ayet.io/sw-icons/Technology.svg", "category_icon_gif": "https://cdn.ayet.io/sw-icons/Technology.gif" } ] } ``` -------------------------------- ### PHP Request Sample for Publisher Reporting API Source: https://www.ayetstudios.com/openapi/publisher-doc This PHP code snippet demonstrates how to make a GET request to the Publisher Reporting API. It utilizes cURL to send parameters such as startDate, endDate, and apiKey, and handles the response or any cURL errors. ```php "https://www.ayetstudios.com/api2/publisher/reporting?startDate=2020-05-05&endDate=2020-05-6&apiKey=xxxx&placements[]=5", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:". $err; } else { echo $response; } ?> ``` -------------------------------- ### Get Publisher Ads Txt API Response Sample Source: https://www.ayetstudios.com/openapi/publisher-doc This is a sample response from the get_ads_txt API, which returns the content of the ads.txt file as plain text. It typically includes domain information, seller account details, and transaction types, formatted according to the ads.txt specification. ```text # AYET-STUDIOS ayetstudios.com, AYETSTUDIOS, DIRECT ayetstudios.com, PL-22, DIRECT ``` -------------------------------- ### Fetch Campaigns via Static API (PHP) Source: https://www.ayetstudios.com/openapi/publisher-doc This PHP code snippet demonstrates how to make a GET request to the Static API to retrieve available campaigns. It utilizes cURL to set request options, including the API endpoint, query parameters (adslot, apiKey, countries, platform, conversion_type), and handles the response or any cURL errors. The apiKey is specific to each adslot and can be found in the adslot details. ```php "https://www.ayetstudios.com/offers/get/3142?apiKey=xxxx&countries%5B%5D=DE&platform%5B%5D=ios&conversion_type%5B%5D=cpi", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ?> ``` -------------------------------- ### Set Publisher Currency Conversion Rate API Request Sample Source: https://www.ayetstudios.com/openapi/publisher-doc This PHP code snippet demonstrates how to make a GET request to the set_conversion_rate API endpoint. It includes setting cURL options for the URL, return transfer, encoding, redirects, timeout, and HTTP version. The request requires an apiKey, adslotId, and rate as query parameters. Error handling is included for the cURL request. ```php "https://www.ayetstudios.com/api2/publisher/placements/set_conversion_rate?apiKey=xxx&adslotId=xx&rate=25000", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ?> ``` -------------------------------- ### Initialize Ayet Surveys SDK with HTML and JavaScript Source: https://www.ayetstudios.com/openapi/publisher-doc This snippet shows how to include the Ayet Surveys SDK in an HTML page and initialize it using JavaScript. It demonstrates setting up theme options, ad slot ID, and an external identifier. The SDK is loaded from a CDN, and initialization is done via the `AyetSurveys.initialize` function. ```html Ayet Surveys Integration
``` -------------------------------- ### Get Publisher Ads Txt API Request Sample Source: https://www.ayetstudios.com/openapi/publisher-doc This PHP code snippet demonstrates how to make a GET request to the get_ads_txt API endpoint using cURL. It requires a placementId and a hash as query parameters. The code configures cURL options for the request, executes it, and prints the response or any cURL errors. The response is expected to be plain text, containing the ads.txt content. ```php "https://www.ayetstudios.com/api2/publisher/placements/get_ads_txt?placementId=22&hash=0abd827e81729b681b85022ca8dd14d1914e215c", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ?> ``` -------------------------------- ### GET /surveys/surveywall_api/{adslot} Source: https://www.ayetstudios.com/openapi/publisher-doc Retrieves a list of available surveys for a given ad slot, with options for filtering, sorting, and targeting. ```APIDOC ## GET /surveys/surveywall_api/{adslot} ### Description Retrieves a list of available surveys for a given ad slot. This endpoint supports various parameters for filtering, sorting, and targeting users based on their demographics and device information. ### Method GET ### Endpoint /surveys/surveywall_api/{adslot} ### Parameters #### Path Parameters - **adslot** (string) - Required - The unique identifier for the ad slot. #### Query Parameters - **external_identifier** (string) - Required - The unique identifier for the user. - **targeting** (string) - Optional - The device type for targeting. Accepts: "desktop", "android_phone", "android_tablet", "ios_phone", "ios_tablet". Defaults to auto-detection via user agent if not provided. - **ip** (string) - Optional - The IP address of the user (if called server-side). - **num_surveys** (integer) - Optional - The number of surveys to return. Defaults to 20. - **survey_sorting** (string) - Optional - Specifies the key for sorting surveys. Accepts: "loi" (Length Of Interview), "payout", "cr" (Conversion Rate), "eepm" (Estimated Earnings per Minute), "cph" (Completes per Hour). Defaults to the ad slot's configured sorting method. - **minimum_payout** (number) - Optional - The minimum payout for surveys to be returned. Defaults to the ad slot's configured minimum payout. - **custom_1** (string) - Optional - Custom parameter for conversion callbacks. - **custom_2** (string) - Optional - Custom parameter for conversion callbacks. - **custom_3** (string) - Optional - Custom parameter for conversion callbacks. - **custom_4** (string) - Optional - Custom parameter for conversion callbacks. - **custom_5** (string) - Optional - Custom parameter for conversion callbacks. - **language** (string) - Optional - A comma-separated list of user's browser/device languages (ISO 639-1 codes) or Accept-Language header value. - **user_agent** (string) - Optional - The user agent string of the user's browser. - **client_hints** (string) - Optional - Client hints of the user's browser, if available. Format: JSON string. - **q{questionId}** (string) - Optional - Profiling question answers. Format: `q{survey_profilers.id}={answer}`. Multiple answers separated by commas. Requires the `hash` parameter for validation. - **hash** (string) - Required (if `q{questionId}` is used) - HMAC-SHA256 hash for validating profiling question parameters. ### Request Example ```json { "example": "GET https://www.ayetstudios.com/surveys/surveywall_api/YOUR_ADSLOT?external_identifier=USER123&targeting=ios_phone&num_surveys=10&language=en-US,en;q=0.8&q123=answer1&hash=YOUR_HASH_VALUE" } ``` ### Response #### Success Response (200) OK. Returns a list of survey objects matching the criteria. #### Response Example ```json { "example": "[Survey Object 1, Survey Object 2, ...]" } ``` #### Error Response (401) Unauthorized. Profiling data was appended to the URL, but the hash signature doesn't match. Please refer to the API documentation for correct hash calculation. ``` -------------------------------- ### Fetch Offers with Client Hints (Javascript) Source: https://www.ayetstudios.com/openapi/publisher-doc This Javascript function demonstrates how to fetch offers from the Ayet Studios offerwall API. It includes capturing user agent and client hints for a more accurate request. The function handles potential errors during the fetch operation and logs the response or error to the console. ```javascript async function fetchData() { let adslotId = 1234; let externalIdentifier = 'YOUR_VALUE'; let userAgent = navigator.userAgent; let clientHints = ''; if (navigator.userAgentData) { try { clientHints = await navigator.userAgentData.getHighEntropyValues(['architecture', 'bitness', 'brands', 'mobile', 'model', 'platform', 'platformVersion', 'uaFullVersion', 'fullVersionList', 'wow64']); clientHints = encodeURIComponent(JSON.stringify(clientHints)); } catch (e) { console.log(e); } } let requestUrl = 'https://www.ayetstudios.com/offers/offerwall_api/' + adslotId + '?external_identifier=' + externalIdentifier + '&user_agent=' + encodeURIComponent(userAgent) + '&client_hints=' + clientHints; fetch(requestUrl) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.log('There was a problem with the fetch operation:', error.message); }); } fetchData(); ``` -------------------------------- ### Publisher Get Ads Txt API Source: https://www.ayetstudios.com/openapi/publisher-doc Allows publishers to retrieve the current (raw) ads.txt file for a given placement ID. ```APIDOC ## GET /api2/publisher/placements/get_ads_txt ### Description Allows publishers to retrieve the current (raw) ads.txt file for a given placement ID. ### Method GET ### Endpoint https://www.ayetstudios.com/api2/publisher/placements/get_ads_txt ### Parameters #### Query Parameters - **placementId** (integer) - Required - Placement ID - **hash** (string) - Required - Hash for privacy reasons (can be retrieved in the ads txt tab in the placement settings modal) ### Request Example ```php "https://www.ayetstudios.com/api2/publisher/placements/get_ads_txt?placementId=22&hash=0abd827e81729b681b85022ca8dd14d1914e215c", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ?> ``` ### Response #### Success Response (200) OK - Returns the content of the ads.txt file. #### Response Example ```text # AYET-STUDIOS ayetstudios.com, AYETSTUDIOS, DIRECT ayetstudios.com, PL-22, DIRECT ``` #### Error Responses - **400** Bad Request - **401** Unauthorized ``` -------------------------------- ### HMAC Security Hash Verification Steps (Conceptual) Source: https://www.ayetstudios.com/openapi/publisher-doc Outlines the conceptual steps to verify the HMAC security hash sent in the X-Ayetstudios-Security-Hash header. This process ensures the integrity of the postback data. ```text 1. Get all request parameters. 2. Order the request parameters alphabetically. 3. Build and compare the HMAC hash using the ordered request parameter string and your API key. ``` -------------------------------- ### Optional Callbacks Overview Source: https://www.ayetstudios.com/openapi/publisher-doc This section details the optional callbacks feature, its configuration, and how to handle incoming postbacks. ```APIDOC ## Optional Callbacks ### Description Available on request, this feature is optional. If enabled, any event configured in the 'Campaign Event Value Configuration' but NOT present in the 'CPE Task List' will be forwarded immediately to a separate event callback URL. All events transmitted by optional callbacks are not payable to publishers. In your publisher dashboard, you can configure the Event Callback URL for each of your placements. **Important:** Your server must always reply with an HTTP 200 status code to our postbacks. Otherwise, we will resend the postback 12 times over a span of one hour before giving up. ### Example Callback URL Configuration: Let's assume this is your configured postback URL (in our dashboard under _Placements - > Settings_): ``` https://www.your-ad-server.com/postback?event_value={event_value}&event_name={event_name}&placement_identifier={placement_identifier}&adslot_id={adslot_id}&sub_id={external_identifier}&your_parameter={custom_1} ``` Your user used this tracking link and completed an offer: ``` https://www.ayetstudios.com/s2s/pub/53270/1/1?external_identifier=your-user-id-1&custom_1=your-custom-click-id ``` The final postback to your server will look like this: ``` https://www.your-ad-server.com/postback?event_value=2.33&event_name=payment-made-custom-task&placement_identifier=my_api_placement&adslot_id=18&sub_id=your-user-id-1&your_parameter=your-custom-click-id ``` ### Postback Verification with HMAC Security Hash (optional): Our server will always add a custom header, **X-Ayetstudios-Security-Hash**, containing a SHA256 HMAC hash of the request parameters and your publisher API key. Your API key can be found in your dashboard at ayetstudios.com under settings. To verify the hash, perform the following steps: (1) Get all request parameters (2) Order the request parameters alphabetically (3) Build and compare the HMAC hash using the ordered request parameter string and your API key. ### Available Macros for Postback URLs: | Placeholder | Type | Description | |---|---|---| | {transaction_id} | string | Unique transaction id - use for duplicate checks. | | {external_identifier} | string | Offerwall API: The external_identifier parameter passed when requesting the offers; Static API: The value of the sub_id parameter appended to the original tracking link. | | {user_id} | int | Our internal ID for this offerwall user. | | {placement_identifier} | string | The placement_identifier for which the conversion occurred. | | {adslot_id} | int | The ID of the adslot for which the conversion occurred. | | {sub_id} | string | The ID of the placement for which the conversion occurred[PL-1...n]. | | {ip} | string | Converting device's IP address if known, 0.0.0.0 otherwise. | | {offer_id} | int | Offer ID of the converting offer. | | {offer_name} | string | Name / title of the converting offer. | | {device_uuid} | string | ayeT-Studios internal device identifier. | | {device_make} | string | Device manufacturer. | | {device_model} | string | Device model. | | {advertising_id} | string | Device advertising id (GAID/IDFA) if known, otherwise empty. | | {sha1_android_id} | string | Device sha1 hashed android id if known, otherwise empty. | | {sha1_imei} | string | Device sha1 hashed imei if known, otherwise empty. | | {event_name} | string | Internal event name of the conversion. | | {event_value} | float | The value associated with the event (non-billable). | | {task_uuid} | string | Shows the persistent task UUID for that event. | | {callback_ts} | integer | Timestamp at which the user triggered the event/callback. | | {click_date} | string | A string representing the date and time (in 'Y-m-d H:i:s' format) at which the user clicked on the offer. | | {custom_1} | string | Custom parameter to pass variables to the conversion callbacks. Can be appended to Static API / Offerwall API tracking links or the web offerwall entry URL. | | {custom_2} | string | Custom parameter to pass variables to the conversion callbacks. Can be appended to Static API / Offerwall API tracking links or the web offerwall entry URL. | | {custom_3} | string | Custom parameter to pass variables to the conversion callbacks. Can be appended to Static API / Offerwall API tracking links or the web offerwall entry URL. | | {custom_4} | string | Custom parameter to pass variables to the conversion callbacks. Can be appended to Static API / Offerwall API tracking links or the web offerwall entry URL. | | {custom_5} | string | Custom parameter to pass variables to the conversion callbacks. Can be appended to Static API / Offerwall API tracking links or the web offerwall entry URL. | ```