Skip to main content
ManaLens has three kinds of key and one kind of token:
  • 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.
No credential both sends events and reads data.

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 the X-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 Origin header (a browser) must come from the project domain, one of its subdomains, or an allowed origin. Other origins get 403.
  • 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.
Anyone who has the key can send web and app events with any context. Do not use these events for data that must be trusted, such as billing. Use a signed revenue integration for payments.

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.
Never put the secret key in a page, a game build or an app build. A request with an Origin header and a secret key gets 403 SECRET_KEY_FROM_BROWSER.
See server events.

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 with 0 to 8 characters.
  • Regular expression: ua_(pk|sk|api)_[0-9A-Za-z]{51}.
Older keys have no checksum and keep working: publishable keys that start with 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 with ua_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:write or profiles:write acts 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.
Never put an API key in browser, mobile or game code. Keep it in a server-side secret store or in your MCP client’s local config.

OAuth

MCP clients that support OAuth (such as Claude and ChatGPT) can connect without a key. An owner or admin signs in, chooses one project and the scopes, and the client gets an access token for one hour and a refresh token for 30 days. See MCP OAuth.

Dashboard API

The dashboard uses a private API with your sign-in session. It is not a public API and can change without notice. Do not call it from your own code.