Error Response Format
All errors follow a consistent JSON format:HTTP Status Codes
| Code | Meaning | Action |
|---|---|---|
200 | Success | Process the response |
201 | Created | Resource created successfully |
400 | Bad Request | Fix the request body/params |
401 | Unauthorized | Check your API key or token |
403 | Forbidden | Event type not allowed or insufficient scope |
404 | Not Found | Resource doesn’t exist |
429 | Rate Limited | Back off and retry after delay |
500 | Server Error | Retry with exponential backoff |
Rate Limiting
Limits
| Endpoint Group | Limit |
|---|---|
Partner events (/api/partner/*) | 30 requests/min per IP |
General API (/api/rewards/*) | 100 requests/min per IP |
Handling 429 Responses
Common Errors
Partner Events
| Error | Cause | Fix |
|---|---|---|
Missing X-API-Key header | No API key in request | Add X-API-Key header |
Invalid API key | Key doesn’t match any active partner | Check key, ensure partner is active |
Event type not allowed | Event type not in partner’s allowlist | Contact MG Digital to add the event type |
user_id and event_type are required | Missing required fields | Include both fields in request body |
Cashback
| Error | Cause | Fix |
|---|---|---|
Insufficient points | User doesn’t have enough points | Show balance to user before attempting |
Maximum X cashback redemptions per day exceeded | Daily limit hit | Wait until tomorrow |
Daily cashback limit would be exceeded | Amount exceeds daily GHS cap | Reduce points amount |
Please wait X minutes | Cooldown period active | Wait the specified time |
Best Practices
Validate before sending
Check user balance client-side before attempting redemptions to avoid unnecessary API calls.
Use idempotency keys
Always include
reference_id in event metadata to prevent double-awarding on retries.
