Skip to main content
Zerocash uses two credentials to identify and authenticate your integration, which you exchange for a short-lived bearer token. That token authorises every other endpoint.

1. Understand the credentials

Public key

Identifies your application. It forms part of the authentication process but is safe to expose, including in client-side code.

API key

Your secret. It is used together with the public key to mint a bearer token. Never ship it in client-side code or commit it to a repository.

2. Obtain your keys

1

Log in to your dashboard

Go to app.zerocash.tech and sign in.
2

Open API Keys

In the sidebar, find API Keys under the Developers section.
3

Copy both keys

You will see your public key and your API key (for example ZC_yyyyyyyyyyyyyyyyyyyyyyyy).
Store the API key in an environment variable or a secrets manager — not inline in your source. Anyone holding it can move money on your account.

3. Generate a bearer token

Call Generate Bearer Token with your API key in the api-key header and your public key in the body.
A successful call returns the token and its expiry:
Response
expiresAt is a Unix timestamp in seconds.

4. Authenticate your requests

Send the token in the Authorization header on every other endpoint.

5. Handle token expiry

Bearer tokens are valid until the expiresAt timestamp returned when they were issued. Do not hard-code a fixed token lifetime — read expiresAt and refresh against it.
Your integration should:
  1. Store the expiresAt value alongside the token.
  2. Refresh the token before that timestamp is reached.
  3. Re-call the Bearer Token endpoint to mint a replacement when the current token nears expiry.
A practical pattern is to cache the token in memory and treat it as stale a minute or two early, so an in-flight request never lands with a just-expired token.

Best practices

Keep the API key server-side

Mint tokens from your backend. Never call the token endpoint from a browser or mobile client where the API key would be exposed.

Refresh proactively

Generate a new token before the current one expires so traffic is never interrupted by a 401.

Centralise token management

Put refresh logic in one place rather than in each call site, so expiry is handled consistently.

Handle auth failures explicitly

Treat 401 as “mint a new token and retry once”, and surface repeated failures rather than looping.