Safefy uses OAuth2 Client Credentials for authentication. You must obtain a JWT token before making any other request.Documentation Index
Fetch the complete documentation index at: https://docs.safefypay.com.br/llms.txt
Use this file to discover all available pages before exploring further.
Credential permissions (module-level read/write, including cashouts) are detailed in Credential permissions.
How it works
Getting the token
Using the token
Include the token in theAuthorization header for all requests:
Rate limiting
Token generation is limited to 10 requests per hour per credential pair (publicKey + secretKey). If you exceed this limit, the API returns 429 Too Many Requests with the error code auth_rate_limit_exceeded.
Token caching
Implement token caching to avoid unnecessary requests and stay well within the rate limit:Security best practices
Never expose the secretKey
Keep the secretKey only on the backend. Never include it in frontend code or public repositories.
Use environment variables
Store credentials in environment variables or secret managers (AWS Secrets Manager, Vault, etc).
Refresh before expiration
Implement logic to refresh the token before the 3600 seconds expire.
Restrict allowed IPs
In the Safefy dashboard, restrict credential usage to your server IPs.
Common errors
| Code | Error | Solution |
|---|---|---|
| 401 | Invalid credentials | Check publicKey and secretKey |
| 403 | Unauthorized IP | Add the IP in the credential settings |
| 429 | Rate limit exceeded | Wait for the time indicated in Retry-After |
Test authentication
Try the authentication endpoint in the playground.