Authentication

Every request to the Stridge API carries a key in the Authorization header. You use two kinds: a secret key that stays on your server, and a publishable key your checkout uses in the browser.

Secret keys and publishable keys compared
PropertySecret keyPublishable key
Held bySecret key
Your server
Publishable key
The browser
Starts withSecret key
sk_live_ acts in live, with real moneysk_sbx_ acts in your sandbox, on simulated chains
Publishable key
pk_live_ for livepk_sbx_ for your sandbox
Sent asAuthorization: Bearer <key> to https://api.stridge.com/v2, for both
How manySecret key
Created in the dashboard, each for one environment
Publishable key
Exactly one per environment
SecrecySecret key
Secret. A live key's secret is shown only once, when you create it
Publishable key
Public by design: it identifies the environment and nothing more
ReachesSecret key
The operations whose permission it holds. 59 operations take a secret key.
Publishable key
3 reference-data reads on its own, and deposit addresses only inside a session for one of your customers

Sending a request

Put the key after Bearer in the Authorization header:

An authenticated request
curl "https://api.stridge.com/v2/deposits" \
  -H "Authorization: Bearer $STRIDGE_SECRET_KEY"

A request that fails authentication is refused:

  • 401: no key was sent, the key is not recognised, or the operation does not accept this kind of key.
  • 403: the key is valid but does not hold the operation's permission.

Every refusal returns the standard error object. When a key is refused lists each code.

Secret keys

A secret key is your server's credential, and it decides which environment each request acts in. Create one in the Stridge dashboard for the environment you want:

  • A sk_live_ key acts in your live environment, with real money.
  • A sk_sbx_ key acts in your sandbox, on simulated chains.

Both call the same base URL, https://api.stridge.com/v2. Nothing else in the request selects the environment. If you also send X-Stridge-Environment, the request fails with 400 header_invalid (environment header not accepted). Every object you read back carries livemode, so a payload on its own still tells you which environment it came from. See Environments.

Treat every secret key like a password. A live key's secret is shown only once, when you create it, so store it then. You can reveal a sandbox key's secret again in the dashboard.

Live keys only

A key acts only in its own environment, and a few operations are available to live keys alone. Calling one with a sandbox key returns 404 operation_not_served (this operation is served to live keys only).

OperationPermission
List webhook endpointsGET/webhook-endpointswebhook.readwebhook.read
Create a webhook endpointPOST/webhook-endpointswebhook.writewebhook.write
Get a webhook endpointGET/webhook-endpoints/{endpoint_id}webhook.readwebhook.read
Update a webhook endpointPATCH/webhook-endpoints/{endpoint_id}webhook.writewebhook.write
Delete a webhook endpointDELETE/webhook-endpoints/{endpoint_id}webhook.writewebhook.write
Rotate a webhook endpoint's signing secretPOST/webhook-endpoints/{endpoint_id}/rotate-secretwebhook.writewebhook.write

Permissions

Permissions limit what each key can do, so a leaked key can do only what you gave it. A key holds the permissions you chose when you created it, such as deposit.read, payout.create or webhook.read. Each operation needs one permission, named on its page beside its credential. Permissions describes them all.

A call from a key without the operation's permission returns 403 permission_denied. The error's message names the missing permission for whoever reads the log, for example insufficient permissions: the api key does not hold payout.create.

Some permissions come without being named:

  • Every key reads the reference data: networks, prices, deposit quotes and the assets deposit addresses accept. A sandbox key also reads the sandbox's simulations and runs the test helpers that simulate deposits.
  • payout.create also lets the key quote a payout, because a payout can name the quote it was priced at.

Others are held only when you name them:

  • uda.write changes a deposit address. Only a key created with it holds it; uda.create does not include it.
  • webhook.read and webhook.write go on live keys only, because only live keys reach the operations that need them. webhook.deliver, which pings and re-enables an endpoint, works on a key of either environment.

Give each key only the permissions its service needs. A key that only reads deposits and settlements cannot move money, even if it leaks.

Publishable keys

A publishable key lets your checkout read what it needs straight from the browser, without exposing a secret. Each environment has exactly one, starting pk_live_ or pk_sbx_. It is public by design: it identifies the environment and nothing more.

On its own, it reads the reference data a checkout shows. Each of these operations also accepts a secret key, so your server calls them the same way:

Operation
Quote a deposit's routeGET/uda/quote
List what deposit addresses acceptGET/uda/supported-assets
Price one symbol, strictlyGET/prices/{asset_symbol}

A publishable key works within tighter rules than a secret key:

  • It may send only the parameters its operation declares for a browser. Any other parameter fails with 400 parameter_unknown.
  • It gets back only the response fields declared for a browser. Other fields are left out.
  • It has its own rate budget, separate from your secret keys'.
  • Listing and creating deposit addresses accept it only inside a session for one of your customers. Send that session's credential in X-Stridge-Client-Secret as well. Without it, the request fails with 401 client_secret_required.
  • Every other operation refuses it with 401 publishable_key_not_accepted.

When a key is refused

Each refusal names its cause in error.code, so your code can tell a missing key from a missing permission. Errors describes every code.

AuthRequest
Statuserror.codeCause
401authentication_requiredNo key was sent (missing authentication token).
401token_invalidThe key is not recognised (invalid api key, invalid publishable key), or it is revoked, expired, or rolled and past its overlap (api key is not active). A secret key that reaches the other environment gets it too (sandbox api key reached the live api). Send the key unchanged to the same base URL: its prefix decides the environment.
401api_key_not_acceptedThe operation does not take a key, or the key was sent in X-API-Key. Send it as Authorization: Bearer. A key created with only the scopes of the /v1 API holds no /v2 permission and gets this code too.
401publishable_key_not_acceptedA publishable key was sent to an operation a browser does not call.
401secret_key_in_browserA secret key was sent to an operation a browser calls, with a browser Origin or alongside X-Stridge-Client-Secret. Treat the key as exposed and roll it.
400header_invalidThe request sent X-Stridge-Environment with a secret key.
403permission_deniedThe key does not hold the permission the operation needs.
404operation_not_servedA sandbox key called an operation available to live keys only.
404environment_not_sandboxA live key called a sandbox-only operation, such as a test helper.
409environment_resettingThe key's sandbox is being reset. Retry once the reset finishes.
409environment_provisioningThe key's sandbox is still being set up. This clears on its own, so retry shortly.

Operations a secret key calls

A secret key can call 59 operations, each gated by one permission. The table counts them by permission. Follow a permission to its entry on Permissions to see every operation it opens.

Operations a secret key calls, counted by the permission each needs
AreaPermission and the operations it opens
Deposit addresses
uda.read8 operationsrouting_policy.read2 operationsuda.create1 operationuda.write1 operationuda.settlement_retry1 operation
Deposits and transactions
deposit.read3 operationstransaction.read2 operations
Payouts
payout.read2 operationspayout.create4 operationspayout.quote1 operationpayout.reject1 operation
Vaults and treasuries
balance.read1 operationtreasury.read3 operationsvault.read4 operationsgas_station.read2 operations
Webhooks and events
webhook.read2 operationsevent.read2 operationswebhook.write4 operationswebhook.deliver3 operations
Reference data
reference.read6 operations
Sandbox
simulation.read3 operationssandbox.simulate3 operations

Keeping your key safe

A secret key can do everything its permissions allow, so where you keep it matters as much as what it holds.

Warning

Never ship a secret key in a browser bundle, a mobile app or any client a user can inspect. Call Stridge from your server and keep the key there.

  • Server-side only. Make Stridge calls from your backend. Use the publishable key for what a browser does.
  • Least privilege. Give each service its own key, with only the permissions it needs.
  • Sandbox for development. Give local and CI environments a sandbox key. The base URL stays the same.
  • Roll on exposure. If a key leaks, roll it or revoke it in the dashboard.
  • The Try it console keeps your key in your browser. The console on each operation page stores your key in your browser's localStorage and sends it straight to the Stridge API, never to the docs site's servers. Use a sandbox key there, and a live key only for the operations available to live keys alone.

In the Try it console, the quote, supported-asset and price reads use your publishable key. The API refuses a secret key sent to them from a browser (401 secret_key_in_browser). Listing and creating deposit addresses can be tried from your server only.