- The publishable key sends website and game events.
- The secret key sends server events from your backend.
- An API key reads and manages: the REST API with scopes (for example profile properties) and the MCP server.
- An OAuth access token reads reports through the MCP server.
Publishable key
The publishable key (called the write key in Segment) identifies one project. It is safe to ship in a page or a game build: every page that loads the SDK contains it. It sends website (web) and game (app) events. It cannot send server events, and it cannot read data.
New projects get a key that starts with ua_pk_. Older projects keep their ua_... key, and it keeps working.
Get the publishable key
Open your project, go to Settings > General > Credentials, and copy the Publishable key.Send it
Send it in theX-Publishable-Key header. The SDKs do this for you: the web SDK option is publishableKey (snippet attribute data-publishable-key), the Godot option is publishable_key, and the Unity option is PublishableKey.
The old names still work as aliases: the X-Write-Key header, the web SDK option writeKey, the snippet attribute data-write-key and the Godot option write_key. Do not send both X-Publishable-Key and X-Write-Key in one request: the collector returns 401.
Extra checks on the publishable key
Because the key is public, the collector also checks where a request comes from:- A request with an
Originheader (a browser) must come from the project domain, one of its subdomains, or an allowed origin. Other origins get403. - A web event’s page URL must be on the project domain, a subdomain, or a host in the project’s allowed origins.
- A request without an
Origin(a native game) is accepted with the key alone.
Rotate the publishable key
Owners and admins with a verified MFA session can rotate the key in project Settings > General > Credentials. The old key stops working at once. Update every site and game build that sends events. The key is public by design and only sends events, so a copied key lets someone send events, not read data. The per-project ingest limit applies to every key.Secret key
The secret key sends server events (channel: 'server') to POST /v0/events from your backend. It starts with ua_sk_. A project has at most one.
- Owners and admins with a verified MFA session create, rotate and revoke it in Settings > General > Credentials.
- It is shown once. ManaLens stores only a SHA-256 hash and a short display prefix.
- When you rotate it, the old key stops working at once.
- Each change is in the audit log:
project.secret_key_created,project.secret_key_rotated,project.secret_key_revoked.
Which key goes where
Key format
New keys have a prefix, a random body and a checksum, like GitHub and Supabase tokens. A secret scanner can match them, and a mistyped key fails before any database lookup.- Prefixes:
ua_pk_(publishable key),ua_sk_(secret key),ua_api_(API key). - Base62 alphabet:
0-9A-Za-z. The body holds more than 256 random bits. - Checksum: the CRC32 (IEEE, as in zlib) of
<prefix><body>, written in base62 and padded on the left with0to 8 characters. - Regular expression:
ua_(pk|sk|api)_[0-9A-Za-z]{51}.
ua_ and API keys that start with ua_mcp_.
API keys
An API key reads and manages one project: the REST API and the MCP server. New keys start withua_api_. Older keys that start with ua_mcp_ keep working. Each key has scopes:
Owners and admins with a verified MFA session create keys in Settings, then Integrations, under API keys. Scopes are required: you choose at least one scope for each key, and a key has no other access. The key is shown once. See Create an API key.
- Keys are stored only as SHA-256 hashes.
- A key with
query:read,dashboards:writeorprofiles:writeacts for the person who created it. It stops working when that person leaves the workspace. When that person’s role goes below editor, the key keeps only its read scopes. - Click Revoke to disable a key at once.
- An API key cannot send events.