Backend API
Privacy Boost serves a small HTTP API for your own backend. Use it to read the private balances of users who signed in through your app, and to check whether a shield or unshield they submitted has settled. It authenticates with your app’s client credentials. There is no SDK for it; call it with any HTTP client.Base URL
Each network has its own server. Send requests to theserverUrl of the network you want from Supported Networks, for example https://optimism.privacyboost.io for OP Mainnet. Balances belong to that server’s chain, and balance responses include its chainId.
Authentication
The API takes the client ID and client secret of an app set up for theapi_secret auth method. The Privacy Boost team issues them when it configures your app; see App Setup and API Secret.
Send the pair with HTTP Basic authentication: the client ID is the username and the client secret is the password. The server doesn’t accept credentials in the URL or the request body.
401 UNAUTHORIZED with a WWW-Authenticate: Basic header. So does a revoked or expired credential, a suspended app, or an app whose api_secret method is turned off. A revoked credential can keep working for up to a minute after revocation.
Every response carries Cache-Control: no-store.
Get One User’s Balances
POST /api/v1/server/balances returns the available balances of one user of your app. The body is a single JSON object with one field, and any other field is rejected.
The balance is what the user can spend now: confirmed plus preconfirmed notes.
If the wallet isn’t a user of your app, or has no privacy account registered on this chain, the server answers
404 NOT_FOUND. Both cases get the same response, so the endpoint never shows whether a wallet uses some other app. Only wallets that signed in through your app are visible.
List Your Users’ Balances
GET /api/v1/server/balances pages through every user of your app, in the order they first signed in, with each user’s balances.
Any other query parameter, or either of these given twice or empty, returns
400 INVALID_PARAMETER.
Keep passing
nextCursor back as cursor until a response has none. The cursor is opaque and works only with your app’s credentials on the same network. It expires 24 hours after the first page of the run, so a full listing has to finish within that window. An expired or altered cursor returns 400 INVALID_PARAMETER; start again without one.
The set of users is fixed when the first page is read. Users who sign in after that show up in your next run. Balances are read as each page is served, so a full listing isn’t a snapshot of a single moment.
Track a Shield or Unshield
GET /api/v1/server/requests/{requestId} returns the status of a shield or unshield that one of your users submitted. Your client gets the ID from the SDK and passes it to your backend.
Poll until the status is no longer
pending. Every other status is final unless an L2 reorg drops the block that settled it. The response carries no error text for a failed request.
An unknown shield ID returns 404 SHIELD_NOT_FOUND and an unknown unshield ID returns 404 TRANSFER_NOT_FOUND. Private transfers and other request types share the ID space with unshields, and their IDs get the same 404 TRANSFER_NOT_FOUND. An ID that is neither a number nor a UUID returns 400 INVALID_PARAMETER.
Errors
Errors come back in this JSON shape:code. details.request_id matches the X-Request-ID response header; include it when you report a problem to the Privacy Boost team.
retryable is true for 429 and 503. Retry those after a delay, and fix the request before retrying a 4xx.
Rate Limits
Every route counts against the server’s per-IP read limit. The limit is checked before the credential, so failed authentication attempts use it up too. Status lookups also count against a second limit, shared by every request made with your app’s credentials. A request over either limit gets429 RATE_LIMITED with a Retry-After header and details.retry_after_ms. Wait at least that long before you retry.
Next Steps
- API Secret covers getting, rotating, and storing client credentials
- Transaction Lifecycle explains the states a request moves through
- Supported Networks lists each network’s server URL