Automate reports — daily e-mails and pulling data over the API
Get yesterday's numbers without opening the console — schedule a saved report by e-mail, or pull it over the analytics REST API from a script and forward it to a chat or a spreadsheet, with the quota, time-zone and month-end caveats.
What it is and why
Two ways to get numbers out of Epom on a schedule without opening the console: let Epom e-mail a saved report, or have your own script pull it over the analytics API and send it wherever you need — a chat, a spreadsheet, a billing system. E-mail is for people; the API is for scripts.
Example. A network manager saves a General report grouped by site with the Yesterday range and schedules it every weekday at 08:00 network time as XLSX to three publisher managers. Each morning they open one file with yesterday’s impressions, revenue and eCPM per site; a cron job on the finance server pulls the same report as CSV at 00:10 and appends it to a spreadsheet, so nobody downloads anything by hand.
Typical scenarios
| You want | Set | Where |
|---|---|---|
| Yesterday’s revenue per site, every weekday morning | Saved report, range Yesterday, days Mon–Fri, hour 08:00, format XLSX, recipients added | Saved reports → clock icon |
| A month-end report that arrives every month | Range Last month, day 1 of the month, hour 06:00, PDF | same dialog — never day 29–31 (skipped in short months) |
| Last week’s campaign numbers on Monday | Range Last 7 days, day Monday, 09:00, CSV | same dialog |
| Yesterday by campaign and day into a spreadsheet, no human | GET …/rest-api/analytics/JSON.do?range=YESTERDAY&groupBy=CAMPAIGN&groupRange=DAY&jsonKeys=id with an API key from a cron job at 00:10 network time | your scheduler |
| A daily message in a chat | The same call, turned into text by your script and posted with the messenger’s own API | your scheduler |
Step by step
Option 1 — a daily e-mail (no code)
-
Account → Analytics, build the report: type, Yesterday as the date range, group-by and columns (Run a report).
-
Save it as a template.
-
In Saved reports, click the clock icon. Pick Days of the week or Days of the month (leave the month list at No restrictions for a weekly schedule), an Hour on the network’s clock — the field label names the zone, default 8:00 — and a File format (CSV, XLSX, PDF, HTML or JSON; default PDF), then click Add. The right side shows the resulting schedule.

-
Add recipients under Report recipients — type an address, click Add. Add your own address if you want a copy; the owner is not added automatically.
The schedule is checked once an hour; the report runs with its saved range relative to the run day, so Yesterday always means the day before the e-mail. Every option: Save, reuse and schedule reports.
Option 2 — pull yesterday’s data from a script
The analytics API runs the same reports as the console.
-
Check your quota once:
GET /rest-api/network/settings.doreturnsanalyticsApiwithdailyRequestLimit,requestsUsedTodayandrecordsPerRequestLimit. -
Build the report in the console first, so you know which
groupBy,rangeandstatisticTypegive the rows you want — or save it and read itsparamsfromGET /rest-api/saved-reports/{id}.do; they use exactly the API’s parameter names. -
Put one of the calls below in a scheduled job (cron, a CI scheduler, a cloud function), timed after midnight in the network’s time zone. The daily request quota starts over at that midnight too.
Signed URL, CSV, yesterday grouped by site and country:
TS=$(date +%s000) # Unix time in milliseconds HASH=$(printf '%s%s' "$(printf '%s' "$PASSWORD" | md5sum | cut -d' ' -f1)" "$TS" | md5sum | cut -d' ' -f1) curl -o yesterday.csv \ "https://<your-network-domain>/rest-api/analytics/CSV/$LOGIN/$HASH/$TS.do?range=YESTERDAY&groupBy=SITE&groupBy=COUNTRY"API key, JSON, yesterday by campaign with one row per day:
curl -H "X-Api-Key: $APIKEY" "https://<your-network-domain>/rest-api/analytics/JSON.do?range=YESTERDAY&groupBy=CAMPAIGN&groupRange=DAY&jsonKeys=id"jsonKeys=idnames each JSON field by its column id (impressions,sumGross) instead of the column’s display name in your interface language, so the script reads the same keys whoever runs it and no two columns share one — see JSON output. -
Check the HTTP status before using the body:
200is a report;400,401,403and429keep a JSON body withsuccess:falseand the reason.
Useful parameters (full list in Analytics reports via API):
| Parameter | For |
|---|---|
range=YESTERDAY, LAST_7_DAYS, LAST_MONTH … or CUSTOM with customFrom / customTo | The period |
groupBy (repeatable) | Rows per site, campaign, country … |
groupRange=DAY / HOUR | One row per day / hour |
statisticType | Leave out for the General report; HADOOP for Advanced |
limit, offset | Paging; without limit you get up to your network’s records-per-request limit |
Forward it to a chat, a sheet or a bot
Epom does not post to messengers itself. Turn the JSON or CSV into a message and send it with the
destination’s own API — Telegram’s sendMessage / sendDocument, a Slack incoming webhook, a
Google Sheets append. The analytics call is the only Epom part.
Caveats and exceptions
Who can do this. Anyone who can run reports. For e-mail you need at least one recipient on the saved report and outbound mail configured by Epom for your network. For the API you need your login and password (for the signed URL) or an API key; calling with an API key needs the API Key Access permission on your role — no stock role has it, so ask your network administrator. Both schemes are in the API overview.
“Yesterday” is the network’s yesterday. For General it is the day before in the network’s time zone — UTC unless your network has been set to another zone; for Advanced it is the report’s own time zone. A script run at 00:05 network time gets a complete yesterday from General; late-arriving data can still move it slightly for a few hours. See Which time zone do reports use?.
Quota. Each user has a daily number of report requests; once used up, calls answer 429
until the next day. GET /rest-api/network/settings.do shows dailyRequestLimit and
requestsUsedToday under analyticsApi. A limit above the records-per-request limit is a
400 — page with offset instead. Pull one report grouped by the dimension you need, not one call
per campaign.
Advanced reports have a short memory. They only cover the window of days the event logs are kept for; daily jobs over long periods belong on the General report.
No recipients, no mail. A scheduled report with no recipients is rendered on time and sent to nobody. The owner is not added automatically.
Day 29, 30 or 31 is skipped in short months. To get a month-end report every month, schedule day 1 with a Last month range instead.
Inactive accounts pause the schedule. Nothing is sent while the account that owns the saved report — or its parent account — is inactive. The schedule stays in place and resumes when the account is re-activated.
The e-mailed file is cut at the row limit. Each format (CSV, XLSX, PDF, HTML, JSON) has its
own limit on your network. If the file looks truncated, group more coarsely or pull it over the API
with limit and offset.
The e-mail runs as the owner. With the owner’s permissions, in the owner’s interface language and with the columns saved in the report — whoever the recipients are.
Deactivated logins stop scripts. A signed (login / hash / timestamp) call from a deactivated
account is refused with 401, like every other REST call — a script under a departed colleague’s
login stops working the day the account is switched off. Use a dedicated reporting user.
Roles. Network manager, publisher and advertiser are identical: both the e-mail and the API
return only the entities and columns your role may see in the console; shared inventory and
campaigns show the names your share allows. Saved reports are private to each login — a colleague
cannot schedule yours; add them as a recipient instead. On a custom role an API key needs API Key
Access, and a report type or column the role lacks answers 403 naming the missing reporting
permission.
Not working?
| Symptom | Check | Where |
|---|---|---|
| The e-mail never arrives | Recipients on the saved report (none = sent to nobody); the owner account and its parent are active; spam folder | Saved reports → clock icon → Report recipients; Admin → Users |
| It arrived yesterday but not today | Scheduled on day 29–31 and this month is shorter; or the account was deactivated | the schedule summary in the dialog |
| It arrives at the wrong hour | The hour is on the network’s clock, named in the Hour (…) label, not yours | the dialog’s Hour field |
| The file stops mid-way | The format’s row limit on your network | group more coarsely, or page over the API |
| The file has columns or entities you did not expect | It runs as the owner of the saved report | the owner’s role and shares |
401 from a script | Wrong hash or timestamp, API key not accepted, or the login is deactivated | the API overview; Admin → Users |
403 naming a permission | The role lacks that report type / column / range | User roles |
429 | Daily request quota used up, or as many reports already running as the network allows | GET /rest-api/network/settings.do → analyticsApi |
400 “Limit value can’t be more than max limit” | limit above recordsPerRequestLimit | use offset paging |
| Yesterday’s numbers are incomplete at 00:05 | Late-arriving data; the network’s zone is not yours | run later, check the zone (time zones) |
| JSON keys change with the user’s language | Missing jsonKeys=id | the request URL |
| The script worked for a colleague who left | Their login was switched off | a dedicated reporting user |
Reference
| Item | Value |
|---|---|
| Schedule check | once an hour; the run uses the saved range relative to the run day |
| Days | days of the week, or days of the month 1–31 (No restrictions = every day of the month) |
| Hour | 0:00–23:00 on the network’s clock, default 8:00 |
| Formats | CSV, XLSX, PDF, HTML, JSON (default PDF) |
| Signed call | GET /rest-api/analytics/{CSV|JSON|…}/{login}/{hash}/{timestamp}.do |
| API-key call | GET /rest-api/analytics/{format}.do with X-Api-Key, Authorization: Bearer, or apiKey= |
| Saved report definition | GET /rest-api/saved-reports/{id}.do → params |
| Quota | GET /rest-api/network/settings.do → analyticsApi.dailyRequestLimit, requestsUsedToday, recordsPerRequestLimit |
| Statuses | 200 report; 400 validation; 401 authentication; 403 missing reporting permission; 429 daily limit or too many concurrent reports |