Skip to contentSkip to Content
GuidesAuthentication

Authentication

Exchange your API key and secret for an access token, then send it with every request.

POST/business/auth

Base URLs

EnvironmentBase URL
Sandboxhttps://api.test.wakapay.io
Productionhttps://api.wakapay.io

Sandbox moves no real money. Production needs KYB approval.

Body

apiKeystringrequired

Your API key.

apiSecretstringrequired

Your API secret. Keep it on your server, never in an app or browser.

cURL
curl -X POST "https://api.test.wakapay.io/business/auth" \ -H "Content-Type: application/json" \ -d '{ "apiKey": "YOUR_API_KEY", "apiSecret": "YOUR_API_SECRET" }'
200OK
{ "accessToken": "eyJhbGciOiJIUzI1NiIs...", "expiresIn": 3600 }
cURL: Using the token
curl "https://api.test.wakapay.io/business/balance" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
401Wrong credentials
{ "code": 0, "error": "invalid credentials" }

Managing the token

TopicWhat to do
LifetimeexpiresIn seconds: 3600, one hour
ReuseCache it in memory; don’t request a token per call
RenewAbout 60 seconds before it expires
On a 401Get a new token and retry the call once
Rate limit/business/auth is limited per IP: 1,000 requests a minute

Sandbox and production have separate credentials. Never use production credentials against the sandbox.

Errors

StatusMessage
400apiKey and apiSecret required or invalid payload
401invalid credentials. Wrong or revoked key or secret
401token is malformed or missing value in request header on other calls