Import Hi Energy AI data into Google Sheets
These guides show marketers, publishers, and analysts how to call the Hi Energy AI REST API
from Google Apps Script with UrlFetchApp, authenticate using
X-Api-Key, paginate results, flatten JSON responses, and write rows into Google Sheets.
Each resource page includes copy-paste code you can drop into Code.gs.
Resource guides
Transactions
Sales and commissions via GET /api/v1/transactions.
Open Transactions Apps Script guideAuthentication for Apps Script
Prefer the X-Api-Key header with your personal API key. The samples read the key from
Script properties (HIENERGY_API_KEY) so secrets stay out of cell values and shared comments.
headers: {
'X-Api-Key': PropertiesService.getScriptProperties().getProperty('HIENERGY_API_KEY'),
'Accept': 'application/json'
}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.