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).3. Generate a bearer token
Call Generate Bearer Token with your API key in theapi-key header and your public key in the body.
Response
expiresAt is a Unix timestamp in seconds.
4. Authenticate your requests
Send the token in theAuthorization header on every other endpoint.
5. Handle token expiry
Your integration should:- Store the
expiresAtvalue alongside the token. - Refresh the token before that timestamp is reached.
- Re-call the Bearer Token endpoint to mint a replacement when the current token nears expiry.
Example: a self-refreshing token cache
Example: a self-refreshing token cache
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.