API Integration
Getting Started
Obtaining an API Key
- Navigate to the API Integration page in your account settings
- Generate a new API key for your project
Authentication
API Key Types
Reward provides two types of API keys:
Key Type | Prefix | Usage |
---|---|---|
Sandbox Keys | sk_test_ | Safe for integration testing |
Production Keys | sk_live_ | Used for real data and transactions |
Authenticating Requests
Include your secret key in the Authorization
header for all API requests:
Authorization: Bearer sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
🔒 Security Best Practices
- Keep your API keys confidential
- Never expose keys in client-side code
- Use environment variables to manage keys
- Rotate keys periodically
Request and Response Handling
HTTP Status Codes
The Reward API uses standard HTTP status codes to indicate the success or failure of a request:
Code Range | Meaning | Action |
---|---|---|
200-299 | Success | Request completed successfully |
400-499 | Client Error | Review your request parameters |
500-599 | Server Error | Retry request or contact support |
Common Error Responses
If there is an error, you will receive a 4xx or 5xx response code along with an error message in the response body:
{
"error": {
"code": "missing_field",
"message": "Missing required field: `user_id`"
}
}