Validate Coupon
const url = 'https://api.ultimateteam.ai/api/v1/coupons/validate?code=example';const options = {method: 'GET', headers: {'X-API-Key': '<X-API-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.ultimateteam.ai/api/v1/coupons/validate?code=example' \ --header 'X-API-Key: <X-API-Key>'Preview a coupon without redeeming it.
Always answers HTTP 200: an unknown, expired or exhausted code is a normal outcome of typing in a form, not a server error, and returning the same status for every outcome keeps the endpoint from doubling as a code oracle.
Args: code: The coupon code to preview (any case). session: Database session. _rate_limit: Per-IP rate-limit guard (injected).
Returns:
{valid, code?, plan_grant?, discount_type?, discount_value?, bonus_credits?, description?, error?}.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters”Coupon code
Coupon code
Responses
Section titled “ Responses ”Successful Response
GET /api/v1/coupons/validate response body (public, read-only).
Deliberately narrow: it echoes only what the signup form needs to
render a badge. It never exposes max_redemptions,
times_redeemed, or created_by — an unauthenticated caller
should not be able to enumerate coupon economics by probing codes.
object
Examplegenerated
{ "bonus_credits": 1, "code": "example", "description": "example", "discount_type": "example", "discount_value": 1, "error": "example", "error_code": "example", "plan_grant": "example", "valid": true}Validation Error
object
object
object
Examplegenerated
{ "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ]}