GTM Clarity Docs

API Auth

Authenticate API requests and understand keys, scopes, permissions, rate limits, idempotency, and rotation.

Use https://app.gtmclarity.ai/api/v1 as the API base URL. The dedicated host https://api.gtmclarity.ai/v1 is coming.

Send the bearer token

API keys start with gtmc_, followed by 32 random bytes encoded as base64url. GTM Clarity stores each key as a SHA-256 hash and keeps a 12-character display prefix for identification.

Send the key in the Authorization header:

curl https://app.gtmclarity.ai/api/v1/customers \
  -H 'Authorization: Bearer gtmc_your_key_here'

Choose a tier and scope

Access has two axes: tier controls allowed verbs, and scope controls which customers the key can access.

AxisValueMeaning
TierreadRead endpoints only.
TierwriteIncludes read, plus write endpoints.
TieradminIncludes read and write, plus administrative endpoints.
ScopeagencyEvery customer in your org.
ScopecustomerOne bound customerId.
Scopeplatform_adminInternal-only. Cannot be minted via the API.

Endpoint permissions

Endpoint groupMethodRequired tier
customersGET / listread
customersPOSTwrite
customersPATCHwrite
customersDELETEadmin
conversationsGETread
messagesGETread
identitiesGETread
widget-configGETread
widget-configPATCHwrite
webhook-endpointsGETread
webhook-endpointsPOSTwrite
webhook-endpointsPATCHwrite
webhook-endpointsDELETEadmin
webhook-endpoints/rotate-secretPOSTwrite
webhook-endpoints/deliveriesGETread
conversionsGETread
resolutionsGETread
usageGETread, org-level agency keys only
usage/timeseriesGETread, org-level agency keys only
keysGETadmin
keysPOSTadmin
keys/[id]DELETEadmin
keys/[id]/rotatePOSTadmin

Handle errors

Errors use this envelope:

{
  "error": {
    "type": "authentication_error",
    "code": "unauthorized",
    "message": "Missing, malformed, invalid, or expired API key",
    "request_id": "<uuid>"
  }
}

The type value is one of:

  • invalid_request_error
  • authentication_error
  • permission_error
  • rate_limit_error
  • idempotency_error
  • not_found_error
  • api_error

Every response carries X-Request-Id. 401 responses also carry WWW-Authenticate: Bearer.

Respect rate limits

Rate limits use a per-minute fixed window per key:

TierLimit
read600/min
write120/min
admin60/min

Every response includes:

  • X-RateLimit-Limit
  • X-RateLimit-Remaining
  • X-RateLimit-Reset, as Unix seconds

429 responses also include Retry-After, in seconds.

Use idempotency for customer creation

Send Idempotency-Key on POST /api/v1/customers when creating customers from a retrying job or CI flow:

curl https://app.gtmclarity.ai/api/v1/customers \
  -X POST \
  -H 'Authorization: Bearer gtmc_your_key_here' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: customer-create-acme-2026-07-19' \
  -d '{
    "name": "Acme"
  }'

The replay window is 24 hours. A replay of the same key and same body carries Idempotent-Replay: true. Reusing the same key with a different body returns 409 with idempotency_error and key_reused.

Secret-returning POSTs deliberately do not support idempotency, because a replay would re-leak a secret. This includes keys, key rotation, webhook endpoint creation, and webhook secret rotation.

Rotate a key

Rotate key material with an admin key:

curl https://app.gtmclarity.ai/api/v1/keys/12/rotate \
  -X POST \
  -H 'Authorization: Bearer gtmc_admin_key_here'

Rotation keeps the same key row, immediately kills the old plaintext key, and returns the new plaintext key once.

On this page