Authentication
Log in with a one-time code, get a token per environment, rotate it, and keep it on your server.
Log in with a code
There are no API keys to request: you log in with the phone number registered on your partner account.
/loginsends a 6-digit code by SMS or WhatsApp. Any usual number format works (05…,+966…)./enterexchanges the code for anaccessToken.
loginType picks the environment: prod for real money and real eSIMs, test for the sandbox.
One token per environment
Each partner has two separate accounts with their own balance, orders, webhooks and token. The base URL is the same; the token decides where a request goes.
| Live | Sandbox | |
|---|---|---|
| Log in with | loginType: "prod" | loginType: "test" |
| Money | Real, topped up by card / mada / Apple Pay | Test, set with /sandbox/balance |
| eSIMs | Real, installable | Simulated, with their own ICCIDs |
| Webhooks | environment: "production" | environment: "sandbox" |
Store both, labelled. Most integrations read the token from an environment variable per deployment.
Rotating a token
/accesstoken/refresh issues a new token and invalidates the old one immediately. Rotate when someone who had access leaves, when a token may have leaked, or on a schedule.
AUTH_UNAUTHORIZED the moment you rotate. Deploy the new token everywhere right after, or rotate from the partner dashboard during a quiet hour.Keep tokens on your server
A token can spend your balance. Treat it like a password:
- Keep it on your server. Never put it in a mobile app, a browser bundle or a public repo: anything shipped to a device can be extracted.
- Your apps call your backend; your backend calls Burj.
- Keep it in a secret manager or environment variable, not in code. Don't log it.
- Use the sandbox token for development and CI, and the live token only in production.
- If it leaks, rotate it at once.