Skip to content

Create a discount code

POST
/api/v1/scent/discount-codes
curl --request POST \
--url https://api-omni.linra.net/api/v1/scent/discount-codes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "code": "example", "discountType": "Percent", "value": 1, "validFrom": "2026-04-15T12:00:00Z", "validTo": "2026-04-15T12:00:00Z", "totalUsageCap": 1, "perCustomerCap": 1, "productScope": "All", "scopedVariantIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "minOrderValue": 1 }'

The code string is IMMUTABLE once created — there is no rename operation. To retire a typo’d or campaign-ended code, deactivate it (PATCH .../{id} with isActive: false) and create a new one instead.

Media typeapplication/json
object
code
required

The code string your end customer enters. Immutable once created.

string
<= 64 characters
discountType
required

A percentage (0,100] off, or a flat SAR amount off.

string
Allowed values: Percent FixedAmount
value
required

Percentage (0,100] for Percent, or a flat SAR amount for FixedAmount.

number format: decimal
validFrom

Null means open-ended (no start restriction).

string format: date-time
nullable
validTo

Null means the code never expires.

string format: date-time
nullable
totalUsageCap

Null means unlimited total redemptions.

integer
nullable
perCustomerCap

Null means no per-customer limit. The only other accepted value is 1 (at most one redemption per customer, ever) — any other positive value is rejected.

integer
nullable
productScope

Applies to your whole catalog, or to an explicit variant list (see scopedVariantIds).

string
Allowed values: All VariantList
scopedVariantIds

Required (non-empty) when productScope is VariantList; omit otherwise. Every id must be one of your existing, active variants.

Array<string>
nullable
minOrderValue

Null means no minimum.

number format: decimal
nullable

The created code.

Media typeapplication/json
object
state
required
string
payload
required
details
object
payload
required
object
id
string format: uuid
partnerId
string format: uuid
code
string
discountType

A percentage (0,100] off, or a flat SAR amount off.

string
Allowed values: Percent FixedAmount
value
number format: decimal
validFrom
string format: date-time
nullable
validTo
string format: date-time
nullable
isActive
boolean
totalUsageCap
integer
nullable
perCustomerCap
integer
nullable
productScope

Applies to your whole catalog, or to an explicit variant list (see scopedVariantIds).

string
Allowed values: All VariantList
scopedVariantIds
Array<string>
minOrderValue
number format: decimal
nullable
usageCount

Running total of successful redemptions.

integer
createdAt
string format: date-time
nullable
lastModifiedAt
string format: date-time
nullable
Example
{
"state": "SUCCESS",
"payload": {
"discountType": "Percent",
"productScope": "All"
}
}

Request validation failed.

Media typeapplication/json

The envelope every /api/v1 ERROR response uses. state carries the machine-readable error code (see the Errors guide).

object
state
required
string
payload
required

Always null on an error response.

object
details
object
Example
{
"state": "NOT_FOUND_ORDER",
"payload": null
}

A code with this string (case-insensitive) already exists for your account.

Media typeapplication/json

The envelope every /api/v1 ERROR response uses. state carries the machine-readable error code (see the Errors guide).

object
state
required
string
payload
required

Always null on an error response.

object
details
object
Examples
Exampleduplicate
{
"state": "CONFLICT_DISCOUNT_CODE_DUPLICATE",
"payload": null,
"details": {
"code": "SAVE10"
}
}

Too many requests — see the Rate limits guide. Retry after the Retry-After header (seconds).

Media typeapplication/json

The envelope every /api/v1 ERROR response uses. state carries the machine-readable error code (see the Errors guide).

object
state
required
string
payload
required

Always null on an error response.

object
details
object
Example
{
"state": "NOT_FOUND_ORDER",
"payload": null
}
Retry-After
integer

Seconds to wait before retrying.