Search for a command to run...
v1
Generate flexible, ad-hoc reports across your data.
Permissions: Requires read access to the relevant site (all-sites-readonly, read:{site_id} or manage:{site_id}).
Generate an aggregation. This is an incredibly flexible report that allows you to group on any fields you wish, and filter them at your leisure.
entitystringrequiredpageview and event.pageviewevententity_idstringRequired when entity is "pageview"entity is pageview, this is the id of the site you want to aggregate on. When entity is event, you may instead pass the event's tracking code here.site_id + entity_name instead of an event tracking code.site_idstringRequired when entity is "event" and entity_id is omittedid of the site the event belongs to.entity_namestringRequired when entity is "event" and entity_id is omittedpurchase.aggregatesstringrequiredvisits, uniques, pageviews, avg_duration and bounce_rate. The difference between "visits" and "uniques" is that visits are unique site visits whilst uniques are unique page visits.conversions, unique_conversions and value (value is returned in cents).date_groupingstringoptionalhour, day, month or year. Note: hour grouping is only supported for date ranges of up to 7 days.hourdaymonthyearfield_groupingstringoptionalhostname,pathname). Supported values: hostname, pathname, referrer_hostname, referrer_pathname, referrer_source, browser, country_code, city, state, region, device_type, operating_system, utm_campaign, utm_content, utm_medium, utm_source, utm_term, keyword and ref.sort_bystringoptionalfield:asc|desc. You can use any field present in aggregates or field_grouping. When using date_grouping, you can also sort by timestamp:asc or timestamp:desc.pageviews:descdate_fromstringoptional2022-04-01 15:31:00). Should match the timezone you're reporting in. Defaults to the entity's first recorded data.date_tostringoptional2022-04-01 15:31:00). Should match the timezone you're reporting in. Default: now.timezonestringoptionaldeprecatedlimitintegeroptionalpathname), you should set a limit to keep responses fast.filtersarrayoptionalvalue must be a string.Filters are supplied as a JSON array. Each filter is an object with a property, an operator and a string value. You can add as many filters as you like; see the examples in the code panel.
We support the following operators:
is — exact matchis not — everything except an exact matchis like — contains the term (supports wildcards *)is not like — does not contain the termmatching — matches a regular expression (regex) patternnot matching — does not match a regex patternOperator availability depends on the field. Text-style fields support all six operators; categorical fields support only is and is not:
domain, hostname, pathname, referrer_hostname, referrer_pathname, referrer_source, ref, utm_campaign, utm_source, utm_medium, utm_content, utm_termis / is not only: device_type, operating_system, browser, country_code, city, state, regionNote: domain can be filtered on but not grouped by, while keyword can be grouped by but not filtered on.
With matching / not matching you can build sophisticated filters:
^/(about|contact|pricing)$ — match only /about, /contact and /pricing^/(about|contact|pricing) — match paths starting with those^/blog/\d{4}/\d{2}/ — match blog URLs like /blog/2025/07/my-post^/products/[^/]+/$ — match product category pagesReturns an array of objects. The properties of each object vary based on the aggregates and groupings you've asked for. All numeric values are returned as strings.
curl "https://api.usefathom.com/v1/aggregations?entity=pageview&aggregates=pageviews" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"[
{
"browser": "Chrome",
"device_type": "Desktop",
"pageviews": "30000"
},
{
"browser": "Chrome",
"device_type": "Mobile",
"pageviews": "28000"
},
{
"browser": "Chrome",
"device_type": "Tablet",
"pageviews": "24000"
},
{
"browser": "Firefox",
"device_type": "Desktop",
"pageviews": "12000"
},
{
"browser": "Firefox",
"device_type": "Tablet",
"pageviews": "5000"
},
{
"browser": "Firefox",
"device_type": "Mobile",
"pageviews": "300"
}
][
{
"property": "pathname",
"operator": "is",
"value": "/about"
}
][
{
"property": "pathname",
"operator": "is not",
"value": "/register"
},
{
"property": "pathname",
"operator": "is not",
"value": "/login"
}
][
{
"property": "country_code",
"operator": "is",
"value": "GB"
}
][
{
"property": "pathname",
"operator": "is not",
"value": "/register"
},
{
"property": "device_type",
"operator": "is not",
"value": "Desktop"
}
]Permissions: Requires read access to the site (all-sites-readonly, read:{site_id} or manage:{site_id}).
Returns the total number of current visitors on a site. The detailed view also returns the top 150 pages and top 150 referrers.
site_idstringrequiredid of the site.CDBUGSdetailedbooleanoptionaltrue for a detailed breakdown of pages and referrers. Otherwise you'll only get a count.falseThe current visitor count, with an optional detailed breakdown.
curl "https://api.usefathom.com/v1/current_visitors?site_id=CDBUGS" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"{
"total": 14
}{
"total": 144,
"content": [
{
"hostname": "bugsbunny.com",
"pathname": "/spacejam",
"total": 100
},
{
"hostname": "bugsbunny.com",
"pathname": "/blog/being-a-wabbit",
"total": 44
}
],
"referrers": [
{
"referrer_hostname": "https://usefathom.com",
"referrer_pathname": "/why-we-love-bugs-bunny",
"total": 50
},
{
"referrer_hostname": "https://daffyduck.com",
"referrer_pathname": "/blog/i-am-sick-of-his-antics",
"total": 32
}
]
}