Skip to content

Authentication

Authenticate REST API requests with API keys.

GoodMetrics REST API requests use dashboard-issued API keys.

Create an API key in the GoodMetrics dashboard. The secret key is shown once when created, so store it securely before leaving the page.

Bearer API keys must:

  • Be active and not revoked.
  • Be unexpired, if an expiry was configured.
  • Belong to a user with access to the requested site.

Send the key with each REST API request:

Authorization: Bearer YOUR_API_KEY

REST API analytics requests use the public site GMID route: https://data.goodmetrics.io/{gmID}/events/{resource}. Realtime requests can be made without query parameters. Reporting requests use flat query parameters such as start, end, country_is, sort_by, and dir.

The API resolves {gmID} to the internal site and checks the requesting key owner’s organization and site permissions.

Example authenticated request:

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

MCP clients use OAuth sign-in and consent instead of API keys. Connect an OAuth-capable MCP client to:

https://data.goodmetrics.io/mcp

The client discovers the GoodMetrics authorization service automatically and opens a browser. Sign in to GoodMetrics, review the requested analytics:read permission, and approve access. See the MCP Server reference for protocol and OAuth details.

REST API key requests support GET analytics requests only. MCP uses POST for JSON-RPC tool calls, but every exposed tool is read-only.

Neither interface creates, updates, or deletes dashboard resources.

InterfaceProblemCommon fix
REST APIAPI key is missing, invalid, revoked, expired, or lacks site access.Check the bearer header, key status, and user permissions.
MCPAuthorization was denied, expired, revoked, or completed with the wrong account.Reconnect the server and approve access with the intended GoodMetrics account.
EitherRate limit exceeded.Retry later and reduce request frequency.

Keep REST API keys server-side whenever possible. If a key is exposed, revoke it in the dashboard and create a replacement.

For MCP, review the client name and analytics:read permission before approving access. Revoke the connection when you no longer use that client.