Create a coupon

Create a coupon.

SecuritySecretApiKey or JWT
Request
Request Body schema: application/json

Coupon resource.

required
object (Discount)
amount
required
number <double> > 0

Discount amount.

currency
required
string = 3 characters

ISO 4217 alphabetic currency code.

type
string

Discount type.

context
string (DiscountContext)
Default: "items"

The context in which the discount applies.

Enum: Description
items

items (less discounts)

shipping

shipping (less discounts)

items-and-shipping

items and shipping (less discounts)

issuedTime
required
string <date-time>

Coupon's issued time (start time).

Array of objects (CouponRestriction)

Coupon restrictions.

Array
type
required
string

Coupon's restriction type.

quantity
required
integer

Restriction quantity.

description
string

Your coupon description. When it is not empty this is used for invoice discount item description, otherwise the item's description uses coupon's ID like 'Coupon "COUPON-ID"'.

expiredTime
string <date-time>

Coupon's expire time (end time).

Responses
201

Coupon was created.

Response Headers
Location
string <uri>

The location of the related resource.

Example: "https://api.rebilly.com/example"
Response Schema: application/json
required
object (Discount)
amount
required
number <double> > 0

Discount amount.

currency
required
string = 3 characters

ISO 4217 alphabetic currency code.

type
string

Discount type.

context
string (DiscountContext)
Default: "items"

The context in which the discount applies.

Enum: Description
items

items (less discounts)

shipping

shipping (less discounts)

items-and-shipping

items and shipping (less discounts)

issuedTime
required
string <date-time>

Coupon's issued time (start time).

id
string <= 50 characters

Coupon's ID a.k.a redemption code.

Array of objects (CouponRestriction)

Coupon restrictions.

Array
type
required
string

Coupon's restriction type.

quantity
required
integer

Restriction quantity.

redemptionsCount
integer >= 0

Coupon's redemptions count.

status
string

If coupon enabled.

Enum: "draft" "issued" "expired"
description
string

Your coupon description. When it is not empty this is used for invoice discount item description, otherwise the item's description uses coupon's ID like 'Coupon "COUPON-ID"'.

expiredTime
string <date-time>

Coupon's expire time (end time).

createdTime
string <date-time>

Coupon created time.

updatedTime
string <date-time>

Read-only timestamp updates when the resource is updated.

Array of objects (Self) non-empty

The links related to resource.

Array (non-empty)
href
required
string

The link URL.

rel
required
string

The link type.

Value: "self"
401

Unauthorized access, invalid credentials were used.

403

Access forbidden.

422

Invalid data was sent.

post/coupons
Request samples
application/json
{
  • "discount": {
    },
  • "restrictions": [
    ],
  • "description": "string",
  • "issuedTime": "2019-08-24T14:15:22Z",
  • "expiredTime": "2019-08-24T14:15:22Z"
}
Response samples
application/json
{
  • "id": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "discount": {
    },
  • "restrictions": [
    ],
  • "redemptionsCount": 0,
  • "status": "draft",
  • "description": "string",
  • "issuedTime": "2019-08-24T14:15:22Z",
  • "expiredTime": "2019-08-24T14:15:22Z",
  • "createdTime": "2019-08-24T14:15:22Z",
  • "updatedTime": "2019-08-24T14:15:22Z",
  • "_links": [
    ]
}