Advertisers → Google Sheets overview
Import advertiser and affiliate program records into Google Sheets with Google Apps Script. Filter by name, network, country, or status, paginate results, and write a clean Advertisers tab using paste-ready code.
Endpoint:
GET /api/v1/advertisers
Advertiser list responses use JSON:API data arrays. Edit QUERY, NETWORK_SLUG, COUNTRY, and STATUS at the top of the importer before running.
Setup in Google Sheets
- Open a Google Sheet → Extensions → Apps Script.
-
Get your personal API key from
API key docs.
Prefer the
X-Api-Keyheader (these samples already do). -
In Apps Script, open Project Settings → Script properties
and add
HIENERGY_API_KEYwith your key value. - Paste the shared client library, then the resource import script below.
- Click Save, reload the Sheet, and run the import from the Hi Energy AI menu (or Run in the editor).
-
On first run, authorize the script when Google prompts for
UrlFetchApp/ external request permission.
2. Advertisers import script
Paste this below the shared client, save the project, then run the import function (or use the Hi Energy AI custom menu after reloading the sheet).
/**
* Import advertisers / affiliate programs into Google Sheets.
* Requires the shared Hi Energy client helpers in this Apps Script project.
*
* Tip: set QUERY / NETWORK_SLUG / COUNTRY below before running.
*/
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Hi Energy AI')
.addItem('Import advertisers', 'importHiEnergyAdvertisers')
.addToUi();
}
function importHiEnergyAdvertisers() {
var QUERY = ''; // e.g. 'nike'
var NETWORK_SLUG = ''; // e.g. 'awin', 'cj', 'impact' (use network for exact network name)
var COUNTRY = ''; // e.g. 'US'
var STATUS = 'approved'; // leave blank for all statuses you can see
var page = 1;
var perPage = 100;
var allRows = [];
var maxPages = 20;
while (page <= maxPages) {
var payload = hiEnergyApiGet_('/api/v1/advertisers', {
q: QUERY,
network_slug: NETWORK_SLUG,
country: COUNTRY,
status: STATUS,
page: page,
per_page: perPage
});
var records = extractJsonApiCollection_(payload, ['data']);
if (!records.length) break;
records.forEach(function(item) {
allRows.push(flattenJsonApiItem_(item));
});
if (records.length < perPage) break;
page += 1;
}
var count = writeObjectsToSheet_('Advertisers', allRows, true);
SpreadsheetApp.getActiveSpreadsheet().toast('Imported ' + count + ' advertisers', 'Hi Energy AI', 5);
}Useful query parameters
| Parameter | Purpose |
|---|---|
q / name |
Search advertisers by program or brand name. |
domain / url |
Find programs by website domain. |
network |
Exact network name filter (case-insensitive). |
network_slug |
Network slug filter such as awin, cj, or impact (preferred for short codes). |
country |
Geo filter for advertiser / market targeting. |
status |
Affiliation status: not_applied, applied, approved, rejected, stopped, or unknown. |
vertical |
Industry / vertical category filter. |
page / per_page |
Offset pagination used by the sample importer. |
FAQ
Yes. These Apps Script samples call GET /api/v1/advertisers with your API key and write flattened JSON:API attributes into an Advertisers sheet.
Edit NETWORK_SLUG and COUNTRY in importHiEnergyAdvertisers before running. NETWORK_SLUG maps to the advertisers API network_slug parameter (for example awin or impact). Use the network parameter instead when you have an exact network name.
Yes. The sheet importer uses the live REST endpoint documented on the Advertisers API page, scoped to your account permissions.
Yes. Set domain or url filters in the importer (or use the q / name search) to find affiliate programs by website. Combine with network, country, status, or vertical as needed.
Yes. The sample walks page / per_page until a short page is returned so large network inventories still land in the Advertisers tab.
Yes. This page publishes TechArticle, HowTo, FAQPage, BreadcrumbList, WebSite SearchAction, and related endpoint ItemList structured data for answer engines.