Authentication
Every request is authenticated with a bearer API key. No request without one will be accepted.
API keys
Create keys in the dashboard under API keys. A key
looks like rsk_ab12cd_xxxxxxxx. Only a hash is stored on our side, so the full key is
shown once at creation, copy it then.
Making an authenticated request
Pass the key in the Authorization header as a bearer token.
curl https://api.sms.pesarails.com/v1/balance \
-H "Authorization: Bearer YOUR_API_KEY"Caution
Treat your API key like a password. Keep it in a server-side environment variable, never in frontend code or a public repository. If a key leaks, revoke it in the dashboard and issue a new one.
Errors
A missing or invalid key returns 401 Unauthorized.
{
"error": "Invalid API key"
}| Status | Meaning |
|---|---|
| 401 | Missing, malformed or revoked API key |
| 402 | Authenticated, but out of credit |
| 429 | Too many requests, slow down |
See Errors & status codes for the full list.