Skip to content

Getting Started

Create an API key and make your first GoodMetrics REST API request.

This guide gets you started with the GoodMetrics REST API. For custom or generic MCP client connections, see the MCP Server reference.

REST API requests use https://data.goodmetrics.io/{gmID}/events.

Replace {gmID} with the public GoodMetrics site identifier from the site you want to query.

Create API keys in the GoodMetrics dashboard. Keys are shown once when created, so store the value securely before leaving the page.

API keys must be active and unexpired. Bearer-token access is read-only.

Send the key in the Authorization: Bearer YOUR_API_KEY header.

Realtime endpoints use the current live window automatically.

Terminal window
curl "https://data.goodmetrics.io/{gmID}/events/realtime/visitors" \
-H "Authorization: Bearer YOUR_API_KEY"

A successful realtime response includes meta and data:

{
"meta": {
"start": 1772476740000,
"end": 1772476800000
},
"data": [
{
"activeSessions": 14
}
]
}

Reporting endpoints use flat query parameters for the date range, sorting, pagination, and filters.

Terminal window
curl "https://data.goodmetrics.io/{gmID}/events/audience/countries?start=1771872000&end=1772476799&page=1&limit=10&sort_by=uniqueVisitors&dir=desc&country_is=Canada" \
-H "Authorization: Bearer YOUR_API_KEY"