Skip to main content
POST
/
v1
/
coupons
Create a coupon
curl --request POST \
  --url https://api.yorlet.com/v1/coupons \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "amount_off": 123,
  "applies_to": {
    "invoice_item_types": [
      "rent"
    ]
  },
  "currency": "<string>",
  "duration": "repeating",
  "duration_in_months": 2,
  "max_redemptions": 2,
  "metadata": {},
  "percent_off": 50.5,
  "redeem_by": 123
}
'
{
  "id": "<string>",
  "created": 123,
  "object": "coupon",
  "amount_off": 123,
  "applies_to": {
    "invoice_item_types": [
      "<string>"
    ]
  },
  "currency": "<string>",
  "duration": "<string>",
  "duration_in_months": 123,
  "max_redemptions": 123,
  "metadata": {},
  "name": "<string>",
  "percent_off": 123,
  "redeem_by": 123,
  "valid": true,
  "account": "<string>",
  "deleted": false,
  "times_redeemed": 0
}

Authorizations

Authorization
string
header
required

API Key authentication. Use "Bearer YOUR_API_KEY".

Body

application/json
name
string
required
amount_off
number
applies_to
object
currency
string
duration
enum<string>
Available options:
repeating,
once,
forever
duration_in_months
number
Required range: x >= 1
max_redemptions
number
Required range: x >= 1
metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

percent_off
number
Required range: 1 <= x <= 100
redeem_by
integer

Must be a Unix timestamp in UTC time.

Response

200 - application/json

Create a coupon

id
string
required

Unique identifier for the object.

created
number
required

Time at which the object was created. Measured in seconds since the Unix epoch.

object
enum<string>
required
Available options:
coupon
amount_off
number | null
required
applies_to
object
required
currency
string
required
duration
string | null
required
duration_in_months
number | null
required
max_redemptions
number | null
required
metadata
object
required
name
string | null
required
percent_off
number | null
required
redeem_by
number | null
required
valid
boolean
required
account
string

The account that the object belongs to. Only returned if the request is made with a valid Yorlet-Context header.

deleted
boolean
default:false

Only returned if the object has been deleted.

times_redeemed
number
default:0