Skip to content

Create Coupon

POST
/api/v1/admin/coupons
curl --request POST \
--url https://api.ultimateteam.ai/api/v1/admin/coupons \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--data '{ "active": true, "bonus_credits": 0, "code": "example", "description": "example", "discount_type": "percent", "discount_value": 1, "duration": "once", "duration_months": 1, "expires_at": "2026-04-15T12:00:00Z", "max_redemptions": 1, "plan_grant": "starter" }'

Create a coupon.

The code is normalized to UPPERCASE by the request schema, so the UNIQUE constraint sees the same form every redemption path looks up.

Args: body: Validated coupon definition. user: The authenticated platform operator (injected). session: Database session.

Returns: The created coupon.

Raises: HTTPException 409: A coupon with this code already exists.

Media typeapplication/json
CreateCouponRequest

POST /api/v1/admin/coupons request body.

object
active
Active
boolean
default: true
bonus_credits
Bonus Credits

Extra credits granted on top of the plan allowance.

integer
0
code
required
Code

Coupon code. Normalized to UPPERCASE before storage.

string
>= 3 characters <= 50 characters
description
Any of:
string
<= 2000 characters
discount_type
Discount Type

‘percent’ (0..100) or ‘fixed_amount’ (cents off).

string
default: percent
Allowed values: percent fixed_amount
discount_value
required
Discount Value

0..100 when discount_type is ‘percent’, else cents.

integer
duration
Duration

Stripe-compatible discount duration.

string
default: once
Allowed values: once forever repeating
duration_months
Any of:
integer
>= 1
expires_at
Any of:
string format: date-time
max_redemptions
Any of:
integer
>= 1
plan_grant
Any of:
string
Allowed values: starter professional business

Successful Response

Media typeapplication/json
CouponOut

The canonical coupon JSON shape returned by every coupon endpoint.

object
active
required
Active
boolean
bonus_credits
required
Bonus Credits
integer
code
required
Code
string
created_at
required
Created At
string format: date-time
created_by
required
Any of:
string
description
required
Any of:
string
discount_type
required
Discount Type
string
discount_value
required
Discount Value
integer
duration
required
Duration
string
duration_months
required
Any of:
integer
expires_at
required
Any of:
string format: date-time
id
required
Id
string format: uuid
max_redemptions
required
Any of:
integer
plan_grant
required
Any of:
string
times_redeemed
required
Times Redeemed
integer
Examplegenerated
{
"active": true,
"bonus_credits": 1,
"code": "example",
"created_at": "2026-04-15T12:00:00Z",
"created_by": "example",
"description": "example",
"discount_type": "example",
"discount_value": 1,
"duration": "example",
"duration_months": 1,
"expires_at": "2026-04-15T12:00:00Z",
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"max_redemptions": 1,
"plan_grant": "example",
"times_redeemed": 1
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}