For Agencies

Everything an agency needs to run headless analytics for its clients — authenticate with an agency key, query per-client data, activate audiences, and build dashboards.

Overview

This view collects the surfaces you use to manage headless data on behalf of your clients. You operate across every location linked to your agency with a single agency key (ak_), scope each call to one client with a location_id, and hand out read-only or browser-safe keys where you need them.

https://mythic-analytics.gulp.workers.dev

Your credentials

CredentialHeaderScopeGive it to
Agency key (ak_)Authorization: Bearer ak_...Read-write across all your linked locationsYour server-side integrations only
Location secret (sk_)Authorization: Bearer sk_...Read-only, one locationA client, or a read-only dashboard
Scoped key (mcp_)Authorization: Bearer mcp_...Exactly the scopes you grant — one location or agency-wide, read or write per familyAn integration or AI agent that needs one capability; also the MCP credential
Publishable key (pk_)x-mythic-key: pk_...Event ingestionA client's website (browser-safe)

The agency key, location secrets and scoped keys are server-side credentials — never expose them in browser JavaScript, public repos, or logs. Only the publishable key (pk_) is safe client-side.

Scope a call to one client

An agency key spans every location you manage, so each request must name the client you mean. Pass it as a location_id query parameter or an X-Location-Id header.

curl "https://mythic-analytics.gulp.workers.dev/client/v1/data/events/summary?location_id=acme-retail" \
  -H "Authorization: Bearer ak_example000000000000000000000000"
{
  "success": true,
  "data": [
    { "event_type": "pageview",       "total_events": 842190, "unique_users": 331204, "unique_sessions": 402887 },
    { "event_type": "$autocapture",   "total_events": 512044, "unique_users": 288120, "unique_sessions": 350991 },
    { "event_type": "form_submitted", "total_events": 18422,  "unique_users": 15903,  "unique_sessions": 16110 }
  ],
  "rows": 3
}

Omit location_id on agency-wide routes that don't target a single client. When a route needs a location and none is supplied, the API returns 400 location_required. A location secret (sk_) never needs location_id — it resolves its own location.

What you can do

Was this page helpful?