BchainPayBchainPay

Authentication


title: "Authentication" description: "Authenticate every BchainPay API request with a bearer token. Rotate keys without downtime." section: "Get started" order: 3 updated: "2026-04-18" sourcePath: "content/docs/authentication.mdx"

BchainPay uses bearer API keys. Send your secret key in the Authorization header on every request. There are no signed requests at the API edge — webhooks are signed in the other direction (see Verify a webhook).

curl https://api.bchainpay.com/v1/pockets \
  -H "Authorization: Bearer $BCHAINPAY_API_KEY"

Key types

PrefixEnvironmentScope
sk_live_…ProductionFull read/write on the live merchant.
sk_sb_…SandboxFull read/write on the sandbox merchant.
pk_live_…ProductionPublic, client-side. Read-only.

Rotating keys

  1. Create a new secret key in the dashboard.
  2. Deploy it to your servers alongside the old one.
  3. Cut traffic over to the new key.
  4. Revoke the old key from the dashboard.

Revocations take effect within 5 seconds globally.

Errors

StatusCodeMeaning
401invalid_api_keyKey is missing, malformed, or revoked.
403forbidden_scopeKey lacks the required permissions.
429rate_limitedPer-key rate limit exceeded. Back off.
Last updated Edit on GitHub