Usage
The gateway exposes three endpoints that map directly to the Relay Server SDK methods. You can use any HTTP client in any language.
Step 1 — Create a Relay session
Call this endpoint before rendering the widget. The response includes a session access token to pass to your frontend, along with a relay-token and relay-secret that you must store securely on your server — never expose these to the client.
Recommended: Encrypt your claim payload
We recommend generating an asymmetric key pair so that the claim payload is encrypted and only decryptable by your server.
Store relay-token and relay-secret securely on your server. Return relay-session-access-token to your frontend to initialize the widget. See Widget usage.
Step 2 — Issue a Privacy Pass
A Privacy Pass is the billing unit for Relay — it is billed on creation and is what gets redeemed to fetch the claim result. Since issuance uses your API key, Persona knows your platform identity at this point for billing purposes. Redemption remains fully anonymous — Persona does not know who redeems the claim. Each Privacy Pass can only be redeemed once, so we recommend storing privacy-pass-token on your end and mapping it to the corresponding relay.
This endpoint requires a relay to exist — the challenge is obtained through the relay’s endpoint — but can be called at any point after relay creation and before redemption. Issuing immediately after creating the relay, before the widget completes, is recommended: it makes it harder for Persona to correlate your platform identity to a relay via timing. One Privacy Pass must exist before you can redeem any relay.
This step requires your Persona API key — you can find it in the Persona Dashboard under API Keys.
Step 3 — Redeem and retrieve the claim
The Privacy Pass is redeemed only on a successful claim. Since each pass can only be redeemed once, retrying a successful request with the same already-spent token — for example, after a network drop — would normally result in a double-spend error. Idempotency is handled automatically by the gateway.
claim-payload is passed through as-is from Persona. If you provided an encryption-key-pem in Step 1, decrypt it with your private key before parsing. Otherwise it is a plaintext JSON string — see Parsing the claim payload.

