Success responses
200: Success. See the API reference for the response format of each endpoint.
Error responses
All non-200 responses should be treated as an error and either retried, or the request fixed and then retried. This section details the different potential non-200 responses. To assist with your programmatic error handling and troubleshooting, all error response bodies are returned in the following JSON format:code— an enum-style error code that represents the problem and will not change.name— a human-readable error name.message— request-specific information about the error.status— an integer that matches the HTTP status code returned.
Example
Error response codes
400 — Malformed request
400 — Malformed request
Error due to a malformed request body such as broken JSON or missing required element. Requires fixing up the request body.
402 — Credit card charge failure
402 — Credit card charge failure
The request was correct, but the card was not charged.
422 — Invalid parameters
422 — Invalid parameters
The request is formatted correctly, but one or more parameters in the body or URL are not valid. An example would be trying to create an order with a reward value outside of the allowed range for that brand. Ensure the request parameters are valid.
429 — Too many requests
429 — Too many requests
The Giftbit API uses adaptive rate limiting that allows burstiness and should generally not interfere with valid usage patterns. If you receive a
429 response, your code should automatically retry the request with a backoff delay.You can simulate rate limiting in the Testbed environment — without actually producing a high request rate — by passing a SIMULATE-RATELIMIT header with a value of true on any request. If you feel you are being frequently rate limited during valid usage, please contact support.5xx — Unexpected error
5xx — Unexpected error
An unexpected error on the Giftbit side. Retry the request, and if failures persist, contact support. Note that the response body format in the
5xx case may not match the common error response format described above.Handling timeouts
If you receive a network timeout or other unexpected response (such as a5xx) when creating an order or an embedded reward, resend the POST request to /campaign, /direct_links, or /embedded using the same supplied id.
The supplied
id is idempotent — Giftbit will only ever create one order with a given supplied id. The supplied id must always be unique across different requests.5xx), with clear logging or alerts to allow for investigation.