Skip to main content

API keys — which key goes where

Monoverse uses two credentials. One is a public identifier (safe to ship in a page or an app binary); one is a server-only secret. This page is the single map.

CredentialReal formatPublic?Lives inAuthorizesGet it from
Site publishable keypk_ + 32 url-safe charsYes — origin- and app-id-lockedYour site's HTML / JS bundle and your app binaryWidget session minting on allow-listed origins; mobile session-token minting for the app ids added to it (Mode B); also pair-by-key to bootstrap a producerCabinet → Integrations; app ids under your site → Mobile apps
Ingest shared secretbase64 of 32 random bytes (shared_secret_b64)No — server onlyYour backend, encrypted at restHMAC-signing of every ingest request; Mode A mobile token mintingReturned once by pair-by-key

One more string you will meet in the flow — not a long-lived credential you store:

  • Session token — a short-lived JWT the widget and SDKs mint for themselves from a publishable key (or that your server mints in Mode A). You never copy or store it.

The real key formats​

A real web key looks like pk_4T8mQzXcV1nY7wKfB2rL9pDhJ6sGaU0e — the prefix pk_ followed by 32 url-safe random characters. There is no live / test segment: if you see pk_live_… anywhere, that is an old placeholder, not a different key type. Copy the key from the cabinet exactly as issued. Older mobile keys start with vb_pk_ and keep working.

The docs use pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx / pk_… as placeholders — always substitute your own key.

The cabinet shows the ingest secret as sk_…

The cabinet references your ingest secret by a display id starting with sk_ so it can be identified without being revealed. The actual credential your producer signs with is the base64 shared_secret_b64 value returned once at pairing — the sk_… display id is not the secret and cannot sign anything.

Pairing a backend​

A backend turns your pk_ into the shared secret once, and proves on the way that it runs on the key's own domain. The SDKs do it for you in ensurePaired(), ensure_paired() and php artisan monoverse:pair; the steps below are the wire contract, for a producer you write yourself.

  1. The backend receives the pk_ — from its configuration: the key the cabinet shows beside your site.
  2. It holds a nonce and asks to pair — it draws 32 to 128 random URL-safe characters, keeps them for at most 600 s, and sends them with the key to POST /api/v1/ingest/pair-by-key, with X-Monoverse-Protocol-Version: 2 and the body below. The nonce goes to no one but Monoverse.
  3. Monoverse fetches the challenge — before it answers, it calls GET https://<your domain>/monoverse/pair-challenge?challenge=<c> over HTTPS, on the key's domain and then on its www. host: at most 4 fetches, no redirect followed, at most 4096 bytes read.
  4. The backend answers with the proof — 200 with {"proof": "<hex HMAC-SHA256 of c, keyed with the nonce>"} and Cache-Control: no-store, or 404 with code no_pairing_in_progress when no nonce is live. A proof that does not match refuses the pairing with 403 domain_unproven.
  5. The secret is returned once — the answer to step 2 carries tenant_id, shared_secret_b64, ingest_url, protocol_version and account. Store the decoded secret encrypted; no call shows it again.
FieldRule
public_keyyour pk_
pair_noncethe nonce from step 2
site_urlthe shop's origin; its host must be the key's domain, else 403 domain_mismatch
provider_idoptional: the SDK's registered id, such as laravel, node, python or woocommerce; any other gets 400 unknown_provider
plugin_version, callbacks, stackoptional: the SDK's version, the callback paths it serves, at most 6 ids of the stack it runs

The WordPress plugin answers the same challenge at /?rest_route=/monoverse-sync/v1/pair-challenge. Until 2027-04-30 the server also tries the challenge routes the SDKs answered before 1.0, which Renamed packages lists. Every other refusal is listed in Errors & retries.

Placement rules​

  • pk_ is an identifier, not a secret (like a Stripe pk_). The security boundary is the origin allow-list (web) or the app_id allowlist + connection status (mobile) — never the secrecy of the key. Details: Tenant isolation and Auth & API keys (mobile).
  • The ingest shared secret must never reach a browser or an app binary. All first-party producer SDKs store it encrypted at rest (AES-256-GCM) and redact it from logs. If it leaks, unpair and re-pair to rotate.
  • One tenant, all surfaces. Both credentials resolve to the same tenant server-side; the client never sends a tenant_id. Cross-tenant access is structurally impossible from a client.

Which one do I need right now?​