Skip to content

Redeem a coupon code for a profile

Redeems a coupon within the key’s project for a given profile. Idempotent per (profileId, couponId) unless an explicit idempotencyKey is supplied. Returns the granted benefits from the coupon pool.

Auth: X-API-Key with scope coupon:redeem (x-required-scope: coupon:redeem). projectId in the body must match the key’s project.

Rate limit: 30 req/min per (projectId, IP) — over → 429.

Media typeapplication/json
object
projectId
required

Must match the API key’s project.

string
code
required

Coupon code to redeem.

string
profileId
required

User/profile redeeming the coupon.

string
idempotencyKey

Optional. Defaults to <profileId>:<couponId> when omitted.

string
context

Optional free-form redemption context.

object
key
additional properties
any
Example
json
{
"projectId": "prj_123",
"code": "SAVE10",
"profileId": "uid_456",
"idempotencyKey": "order-789"
}

Redemption accepted (pending settlement).

Media typeapplication/json
object
redemptionId
required
string
status
required
string
benefits
required

Benefits defined on the coupon pool (empty object if none).

object
key
additional properties
any

Invalid JSON or missing required fields.

Media typeapplication/json
object
error
required

Human-readable error message.

string
retryAfter

Seconds to wait before retrying (present on 429/503).

integer
message
string
affectedIndices
Array<integer>
Examples
json
{
"error": "invalid_json"
}

Missing/invalid API key.

Media typeapplication/json
object
error
required

Human-readable error message.

string
retryAfter

Seconds to wait before retrying (present on 429/503).

integer
message
string
affectedIndices
Array<integer>
Examplegenerated
json
{
"error": "example",
"retryAfter": 1,
"message": "example",
"affectedIndices": [
1
]
}

API key lacks the coupon:redeem scope.

Media typeapplication/json
object
error
required

Human-readable error message.

string
retryAfter

Seconds to wait before retrying (present on 429/503).

integer
message
string
affectedIndices
Array<integer>
Examplegenerated
json
{
"error": "example",
"retryAfter": 1,
"message": "example",
"affectedIndices": [
1
]
}

Coupon not found, or cross-tenant (same shape to prevent enumeration).

Media typeapplication/json
object
error
required

Human-readable error message.

string
retryAfter

Seconds to wait before retrying (present on 429/503).

integer
message
string
affectedIndices
Array<integer>
Example
json
{
"error": "not_found"
}

Coupon not redeemable.

Media typeapplication/json
object
error
required

Human-readable error message.

string
retryAfter

Seconds to wait before retrying (present on 429/503).

integer
message
string
affectedIndices
Array<integer>
Examples
json
{
"error": "already_redeemed"
}

Rate limit exceeded (30/min per project+IP).

Media typeapplication/json
object
error
required

Human-readable error message.

string
retryAfter

Seconds to wait before retrying (present on 429/503).

integer
message
string
affectedIndices
Array<integer>
Example
json
{
"error": "rate_limited"
}