Authentication
Exchange your API key and secret for an access token, then send it with every request.
POST
/business/authBase URLs
| Environment | Base URL |
|---|---|
| Sandbox | https://api.test.wakapay.io |
| Production | https://api.wakapay.io |
Sandbox moves no real money. Production needs KYB approval.
Body
apiKeystringrequiredYour API key.
apiSecretstringrequiredYour 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
| Topic | What to do |
|---|---|
| Lifetime | expiresIn seconds: 3600, one hour |
| Reuse | Cache it in memory; don’t request a token per call |
| Renew | About 60 seconds before it expires |
| On a 401 | Get 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
| Status | Message |
|---|---|
| 400 | apiKey and apiSecret required or invalid payload |
| 401 | invalid credentials. Wrong or revoked key or secret |
| 401 | token is malformed or missing value in request header on other calls |