Overview
Hyparrow has two authentication methods:| Method | Header | When to use |
|---|---|---|
| API Key | X-API-Key + X-API-Secret | Server-side integrations, programmatic API calls |
| JWT | Authorization: Bearer <token> | Dashboard sessions, user-facing flows |
API key authentication
Pass both headers on every request:API key format
API keys begin withpk_ and API secrets begin with sk_:
Error responses for API key auth
401 — Missing credentials
Both
X-API-Key and X-API-Secret must be present.401 — Invalid credentials
The key was not found or the secret does not match.
403 — Key not active
The key exists but has been suspended or revoked.
403 — Key expired
The key has passed its
expiresAt date.403 — IP not allowed
Your server’s IP address is not on the key’s allowlist.
JWT authentication
A JWT is returned from bothPOST /api/v1/auth/login and POST /api/v1/auth/verify-email. Pass it as a Bearer token:
JWT claims
The JWT payload contains:| Claim | Type | Description |
|---|---|---|
userId | UUID | Your user ID |
email | string | Your email address |
role | string | Your account role |
exp | Unix timestamp | Expiry — 24 hours from issue |
iat | Unix timestamp | Issued at |
JWT expiry
Tokens expire after 24 hours. Re-authenticate viaPOST /api/v1/auth/login to get a fresh token.
Error responses for JWT auth
401 — No token
401 — Invalid or expired token
403 — Email not verified
The account exists but the email address has not been confirmed.
Which method to use
Use API key auth for:- Your backend server calling Hyparrow (bill payments, transfers, customer creation, transactions)
- Any automated or scheduled process
- Creating and managing API keys (the key management endpoints only accept JWT)
- Managing your user profile, onboarding, and wallet setup
Some endpoints accept both methods. When you authenticate with an API key, the associated user account is resolved automatically, so you do not need to pass a separate user identifier.
Security best practices
- Never expose your API secret in client-side code (browsers, mobile apps). Always call Hyparrow from your server.
- Store
HYPARROW_API_KEYandHYPARROW_API_SECRETas environment variables, not hardcoded in source files. - Enable IP whitelisting on your API key so only your server’s IP addresses can use it. See API Keys for setup.
- Rotate your API key periodically by revoking the old one and creating a new one.
- If you suspect a key has been compromised, revoke it immediately via
DELETE /api/v1/api-keys/:id.
