Access the Microsoft Clarity Data Export API with managed authentication. Read a project's dashboard metrics for the last 24, 48, or 72 hours, broken down by up to three dimensions. The API is read-only and allows only about 10 calls per project per day, so ask for every dimension the question needs in one call and reuse the result. All access runs through the Maton gateway and the maton CLI.
Permissions
Suggested read access
In the Console, Read limits the connection to these 1 read-only endpoints, plus deny rules for any write endpoint a broader rule would otherwise match. Endpoints Maton has found to return credentials, start jobs, or spend credits are left out; a few reads that can change state or return a secret depending on their parameters stay in, and their descriptions say how. It is a suggestion: the saved rules are exactly the ones you see, and you can change them with Custom. See Access policy.
Reference
Project Live Insights
Get Project Live Insights
maton api '/microsoft-clarity/export-data/api/v1/project-live-insights?numOfDays={numOfDays}&dimension1={dimension1}'Returns the project's dashboard metrics for the last 24, 48, or 72 hours, optionally broken down by up to three dimensions.
| Parameter | Required | Values |
|---|---|---|
numOfDays | Yes | 1, 2, or 3: the last 24, 48, or 72 hours, counted back from the time of the call. Older data is not available through the API. |
dimension1 | No | First breakdown dimension (see below). |
dimension2 | No | Second breakdown dimension. |
dimension3 | No | Third breakdown dimension. |
Dimensions: Browser, Device, Country/Region, OS, Source, Medium, Campaign, Channel, URL. Use the names exactly as listed, URL-encoded (Country/Region is Country%2FRegion).
Example (the last 24 hours, no breakdown):
maton api '/microsoft-clarity/export-data/api/v1/project-live-insights?numOfDays=1'Example (the last 72 hours, broken down by device and traffic source in one call):
maton api '/microsoft-clarity/export-data/api/v1/project-live-insights?numOfDays=3&dimension1=Device&dimension2=Source'Response (trimmed, from Microsoft's documentation for dimension1=OS):
[
{
"metricName": "Traffic",
"information": [
{
"totalSessionCount": "9554",
"totalBotSessionCount": "8369",
"distantUserCount": "189733",
"PagesPerSessionPercentage": 1.0931,
"OS": "Other"
},
{
"totalSessionCount": "291942",
"totalBotSessionCount": "31076",
"distantUserCount": "212836",
"PagesPerSessionPercentage": 2.2609,
"OS": "Android"
}
]
}
]The response is an array with one entry per metric; information holds one row per combination of the requested dimension values, each row carrying the dimension values as keys alongside the metric's figures. Counts are returned as strings. Metrics include Traffic, EngagementTime, ScrollDepth, DeadClickCount, RageClickCount, ExcessiveScroll, QuickbackClick, ScriptErrorCount, and ErrorClickCount. An undimensioned request also returns breakdown metrics such as Browser, Device, and OS (and, per Microsoft's docs, country/region, popular pages, page titles, and referrer URLs); a dimensioned request returns only the core metrics, split by the dimensions. An empty information array means no sessions matched in the window, which is common for low-traffic projects with several dimensions.
Notes
- Daily quota: about 10 requests per project per day; a
429(Exceeded daily limit) means the quota is spent until the next day, so retrying does not help. - Window: only the last 1 to 3 days (
numOfDays), in UTC. There is no date-range parameter and no historical export. - Response size: at most 1,000 rows per response, with no pagination. Adding dimensions multiplies rows, so a three-dimension request on a busy project (for example with
URL) can be truncated; drop a dimension if the breakdown needs to be complete. - Read-only: the Data Export API has no write endpoints. Session recordings, heatmaps, and project settings are not available through it.
- Errors:
400(invalid parameters, for example a misspelled dimension ornumOfDaysout of range),401(missing, invalid, or expired token),403(token not authorized, including a revoked or replaced token),429(daily limit). - Tokens are generated by a project admin under the Clarity project's Settings → Data Export → Generate new API token. Replacing or deleting that token in Clarity breaks the connection; reauthorize it with a new token.