Overview
6.1 Overview
RedeemSG uses conventional HTTP response codes to indicate the success or failure of an API request.
Codes in the 2xx
range indicate success. Codes in the 4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a redemption cannot be made, etc.). Codes in the 5xx
range indicate an error with RedeemSG’s servers.
The response body can include a code
, with a short string indicating the error encountered
Sample response in redeeming a used voucher:
HTTP Status Code Summary
200 - OK
Everything worked as expected.
400 - Bad Request
The request was unacceptable, often due to a missing required parameter or an unexpected format.
401 - Unauthorized
No valid credentials provided.
402 - Request Failed
The parameters were valid but the request failed. 402 is not a clearly defined HTTP code, but in certain APIs is used when a resource’s state is concerned. (eg. voucher already redeemed, voucher voided, admin already removed).
403 - Forbidden
Your credentials doesn’t have permissions to perform the request.
404 - Not Found
The requested resource doesn’t exist.
409 - Conflict
The request conflicts with another request (eg. same idempotent key).
429 - Too Many Requests
Too many requests. We recommend an exponential backoff.
500 - Server Error
Something went wrong on RedeemSG’s end
503 - Server Error
Something went wrong on RedeemSG’s end, caused by an external service
Error Types
api_error
API errors indicate a issue with RedeemSG’s servers,
external_error
External errors indicate an issue due to an external service utilized by RedeemSG, which prevented RedeemSG from completing the request (Eg. Singpass, Twilio, etc.).
idempotency_error
Idempotency errors occur when an Idempotency-Key
is re-used on a request that does not match the first request's API endpoint and parameters or when the first request is still processing.
invalid_request_error
Invalid request errors arise when your request has invalid parameters.
Last updated