Query API
The one endpoint behind every chart, for your own reports.
Every chart in the dashboard comes from one endpoint. Call it to build your own reports or to pull numbers into another tool.
{id} is the site ID shown in the site's settings, such as ult_fxpitz4w7h, or the site's domain. Every API key can read, so any key of the organization works.
Request
metricsstring[]What to count, one to eight of
visitors,visits,pageviews,views_per_visit,bounce_rate,visit_durationin seconds, andevents.dimensionsstring[]One dimension to split the numbers by, such as
["page"], from the Dimensions list below. Leave it out for totals. On Foresight, a second one turns the split into a pivot, as Pivots below shows.filtersobject[]Up to 10 filters, and a row must match all of them. Each one is
{"dimension": "country", "op": "is", "values": ["US", "CA"]}, whereopisisoris_notandvaluesholds 1 to 20 values.segmentstringThe key of a saved segment, such as
mobile, on Insight and Foresight. Its filters join the ones infilters, with up to 10 of each. An unknown key answers404withULT-1370, and Glance getsULT-1203.date_rangeobject{"preset": "30d"}withrealtime,today,7d,30d,90dor12mo, or{"from": "2026-10-01", "to": "2026-10-07"}. Dates are in the site's time zone and include both ends.realtimecovers the last five minutes and gives totals only.comparestringpreviousfor the period just before, oryearfor the same dates a year earlier.intervalstringhour,day,weekormonthturns the answer into a time series. A query is a series or a split by dimension, not both.order_byobject[]For a split, one of the requested metrics, such as
[{"field": "visitors", "direction": "desc"}]. By default rows follow the first metric, highest first.limitnumberThe most rows a split returns, from 1 to 500. The default is 10.
curl -X POST https://api.ultanimus.com/v1/sites/YOUR_SITE_ID/query \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"metrics":["visitors","pageviews"],"dimensions":["page"],"date_range":{"preset":"30d"},"compare":"previous","limit":3}'Response
The answer is columnar: one array per column, in the order columns lists them, so each array maps straight onto a chart series.
{
"status_code": 200,
"data": {
"date_range": { "from": "2026-09-18T00:00:00-04:00", "to": "2026-10-17T08:07:00-04:00", "timezone": "America/New_York" },
"compare_range": { "from": "2026-08-19T00:00:00-04:00", "to": "2026-09-17T08:07:00-04:00", "timezone": "America/New_York" },
"columns": ["page", "visitors", "pageviews"],
"data": {
"page": ["/", "/pricing", "/docs"],
"visitors": [1840, 920, 610],
"pageviews": [2310, 1104, 1490]
},
"previous": { "visitors": [1620, 980, 540], "pageviews": [2050, 1170, 1302] },
"totals": { "visitors": 3120, "pageviews": 6020 },
"previous_totals": { "visitors": 2900, "pageviews": 5600 },
"more": 42
},
"message": "OK"
}totalscount the whole range, not the sum of the rows, so a visitor who saw two pages counts once.moreis the number of rows the limit left out.previouslines up withdatarow by row: the same pages in a split, the same position in a series.- A time series has a
datecolumn holding the start of each bucket. Every bucket is there, with zeros where nothing happened. sampledappears when the range holds more than 5 million events. The numbers then come from that fraction of visitors, such as0.1, and counts are scaled back up. Rates and durations come from the same visitors and need no scaling.
Dimensions
| Dimension | Splits by |
|---|---|
page | Page path, counting the pageviews of that page |
entry, exit | The first and the last page of a visit |
hostname | The host the page was on |
source, referrer, channel | Where the visit came from |
utm_source, utm_medium, utm_campaign, utm_content, utm_term | The campaign tags the visit arrived with |
event, goal | Custom event name |
prop | The names of the properties events carry |
prop:<name> | The values of one property, such as prop:plan. A name takes 1 to 64 bytes |
country, region, city | Location. A split by city adds a country column |
device, browser, browser_version, os, os_version, language | The visitor's device and settings |
screen | Screen width group: 0 for phones, then 768, 1024, 1440 and 1920 |
A filter on event, goal or a property keeps the whole visits that include a matching event, so you can see which pages people saw on the visits where they signed up. Bounce rate and visit duration describe whole visits, so they cannot be split by page, hostname, event, goal or a property.
Events and their properties
- Filters on an event name and on its properties describe one event.
event is signupwithprop:plan is prokeeps the visits that sent a pro signup, not visits with a signup and some other event on plan pro. - With an
isfilter onevent,goalor a property, theeventsmetric counts only the matching events.eventswithevent is signupis the number of signups, whilevisitorsstill counts the people who sent one. - A split by
eventunder a property filter lists only the events that carry that value. - A split by
proporprop:<name>reads the properties of the events youreventfilter names, so a property of another event on the same visit stays out. proponly splits. To filter, name the property, as inprop:plan.
This asks for the plans people picked when they signed up:
curl -X POST https://api.ultanimus.com/v1/sites/YOUR_SITE_ID/query \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"metrics":["events","visitors"],"dimensions":["prop:plan"],"filters":[{"dimension":"event","op":"is","values":["signup"]}],"date_range":{"preset":"30d"}}'Pivots
On the Foresight plan, a second dimension splits each row into columns, such as ["source", "device"]. The second dimension must hold for the whole visit, so every metric can count it: channel, source, referrer, the UTM tags, entry page, country, region, city, language, device, browser, OS, their versions or screen. Other plans get ULT-1203.
The rows answer exactly as a split by the first dimension. A split object adds the columns and the cells:
"split": {
"columns": ["device", "visitors"],
"data": { "device": ["desktop", "mobile"], "visitors": [2210, 980] },
"more": 1,
"cells": { "visitors": [[1420, 410], [610, 300]] }
}- The columns are the 10 values with the most of the first count you asked for (visitors, visits, pageviews or events), whichever way the rows are sorted. With no count, they follow
order_by.moreis how many values that left out. cells[metric][row][column]is the value of that row in that column, in the order ofdata. A pair nobody had is0.- With
compare, the split haspreviousfor its columns andprevious_cellsfor its cells.
Journeys
On Insight and Foresight, journey asks for the paths of visits instead of counts, as the Journeys page shows them. Send it with date_range and filters only. Glance gets ULT-1203.
{ "journey": { "start": "/pricing" }, "date_range": { "preset": "30d" } }- An empty object,
{}, follows visits from their entry pages.startfollows them from the first time they opened a page, andendworks back from one. Send one of the two at most. A path starts with/and matches one page exactly. data.journey.stepsholds 5 steps at most, each with up to 5 pages and anothernode for the rest. A node haspage,visitsandexits, the visits with no page after it, or withendnone before it.othernodes also carrypages, the number of pages they fold.data.journey.linkslists{ "step": 0, "from": 1, "to": 0, "visits": 210 }: visits from pagefromof stepstepto pagetoof the step after it.totals.visitscounts the visits in the first step. Above a million events in the range,sampledgives the fraction of visitors read.
Retention
On Insight and Foresight, retention asks how many signed-in people come back after their first visit, as the Retention page shows it. Send it with date_range, filters, segment and interval only. Glance gets ULT-1203.
{ "retention": { "event": "purchase" }, "interval": "week", "date_range": { "preset": "90d" } }- An empty object,
{}, counts any visit as coming back.eventcounts only the periods where a person sent that event, andgoaltakes a goal's key. Send one of the two at most. intervalisday,weekormonth, and the range must hold between 2 and 31 of them. Leave it out for the shortest one that fits. The answer'sintervalsays which one it used.data.retention.cohortsholds one cohort per period, oldest first. A cohort hasstart,people, andreturned, wherereturned[k]counts the people who came backkperiods later, soreturned[0]equalspeople.data.retention.average[k]is the share who came backkperiods later, over the cohorts whose periodkhas ended.data.retention.partialistruewhile the range's last period is still running.- Only people with a user ID count, and
totals.peopleadds up every cohort. Above 5 million events in the range,sampledgives the fraction of people read.
Sessions
On Insight and Foresight, sessions lists visits one by one, newest first, as the Sessions page shows them. Send it with date_range, filters, segment and limit only. Glance gets ULT-1203.
{ "sessions": {}, "date_range": { "preset": "7d" }, "limit": 50 }data.sessions.sessionslists up tolimitvisits that began in the range, 50 by default and 100 at most. A visit hasid,startandendas UTC times,durationin seconds,pageviews,events,entry,exit,source,channel,referrer,campaign,country,region,city,device,browserandos.- When more visits are left,
data.sessions.nextholds a cursor. Send it back as{ "sessions": { "before": "<next>" } }with the same range and filters for the next page. The last page has nonext. - Filters keep or drop whole visits, so a page filter lists the visits that opened the page with every page they opened.
session answers one visit's events. Send the id and start of a visit from the list, and nothing else.
{ "session": { "id": "8410337165307419223", "start": "2026-11-02T09:24:35.902Z" } }data.sessionhas the same fields as a visit in the list, plustimeline, the visit's events in order, each withat,name,hostname,pathandprops.- A visit with more than 1,000 events returns its first 1,000 and sets
moretotrue. - A visit with no events at that start answers
404withULT-1112.
People
On Insight and Foresight, people lists the people your site signs in, the most recently seen first, as the People page shows them. Send it with date_range, filters, segment and limit only. Glance gets ULT-1203.
{ "people": {}, "date_range": { "preset": "30d" }, "limit": 50 }data.people.peoplelists up tolimitpeople active in the range, 50 by default and 100 at most. A person hasid(16 hex digits),first_seenandlast_seenas UTC times within the range,visits,pageviews,events, and thecountry,deviceandbrowserof their latest browser event.- When more people are left,
data.people.nextholds a cursor. Send it back as{ "people": { "before": "<next>" } }with the same range and filters for the next page.
person answers one person. Send the id from the list, or user with the user ID your site passes to the tracker, and date_range. The user ID is hashed the way the tracker does and never stored.
{ "person": { "user": "u_8f2k1x" }, "date_range": { "preset": "30d" } }data.personhas the fields of a person in the list, plussessions, their latest 50 visits shaped like the visits insessions,more_sessions, andevent_names,pages,countries,devicesandbrowsers, each a list ofvalue,count,visits,firstandlast.goalslists the site's goals they reached withkey,name,countandvisits.- A person with no event in the range answers zeros and empty lists.
How a query runs
- Answers are cached for a minute, or for an hour once the range ended more than an hour ago.
- A query stops after 10 seconds and answers
504withULT-9001. Ask for a shorter range or fewer filters. - Each key can run 240 queries a minute. Past that the answer is
429withULT-1902and aRetry-Afterheader in seconds. - For every event as its own row instead of counts, use the raw export.