Skip to content

Authentication

Authenticate your requests with your API key in the Authorization header. Use a private key for sensitive operations, a public key for the rest.

The API uses key-based (token) authentication. You pass your key in the Authorization header of each request. Wajub accepts the key directly, without the Bearer prefix. Private keys (sk...) grant access to all operations; public keys (pk...) are limited to non-sensitive operations (payment initialization, reading public resources); restricted keys (rk...) grant access to only the specific resources you scope them to.

GEThttps://api.wajub.com/balance

The three-key model

Authorizationheaderrequired
Your API key. Use a private key (`sk...` / `sk_test...`) for server-side operations (transfers, refunds, balance reads), a public key (`pk...` / `pk_test...`) for client-side operations (payment initialization, reading public resources), or a restricted key (`rk...` / `rk_test...`) scoped to only the resources it was granted.

Three key types

Secret keys are unrestricted and must never leave your server. Public keys are safe to expose client-side but limited to non-sensitive operations. Restricted keys let you issue a key scoped to a subset of resources (e.g. payment.read only) for a specific integration or third party — create and scope them from Developers → API Keys.

Official server SDKs

Wajub ships official server SDKs for Node.js, Python, PHP, Go, Ruby, Java, and C#. See SDKs & Libraries.

curl https://api.wajub.com/balance \
-H "Authorization: sk_test.2a7c5e91b0d34f68"

Authentication errors

401 Unauthorized
{
"code": 401,
"status": "Unauthorized",
"message": "Invalid API credentials"
}

A key that was valid but has since expired returns the same 401 with "message": "Invalid or revoked API credentials" instead.

  • 401 — key missing, malformed, expired or revoked.
  • 403 — the key doesn't have the required permission for the requested operation, the request came from an IP address not on that key's allow-list ("message": "IP address not allowed for this API key"), or a private key was used from a browser (see below).

Best practices

  • Store keys in environment variables, never in the repository.
  • Use separate keys per environment (test vs production).
  • Rotate your keys periodically and after any team member departs.

Was this page helpful?