Create a Coupon
Header parameters
Brand-URLstringRequiredExample:
The brand URL of the request. This is used to identify the brand.
YOUR_BRAND_URL
Auth-KeystringRequiredExample:
This is used to authenticate the request. If the request is not authenticated, the server will return a 401 Unauthorized response.
YOUR_AUTH_KEY
Body
This class is used to provide a data transfer object for the coupon which is used for command requests.
namestring · min: 1Required
The name of the coupon.
codestring · min: 1Required
The code of the coupon.
percentagenumber · double | nullableOptional
The percentage of the coupon.
quantityinteger · int32 | nullableOptional
The quantity of the coupon.
startDatestring · date-timeRequired
The start date and end date of the coupon.
endDatestring · date-timeRequired
The end date of the coupon.
autoApplyToPricebooleanOptional
Is the coupon auto apply to price. If true, the coupon will be applied to the price automatically. By default, the value is false.
descriptionstring | nullableOptional
The description of the coupon.
tagsstring | nullableOptional
The tags of the coupon.
statusstring · enumOptionalPossible values:
testModebooleanOptional
The test mode of the coupon. By default, the value is false.
Responses
201
The request was successful.
application/json
401
The user is not authorized to access the requested resource. The request is missing the required Auth-Key header.
application/json
403
The user's access was denied.
application/json
429
The user has exceeded the rate limit.
application/json
post
POST /api/v1/coupons HTTP/1.1
Host: protocol.jframework.io
Brand-URL: text
Auth-Key: text
Content-Type: application/json
Accept: */*
Content-Length: 230
{
"name": "text",
"code": "text",
"percentage": 1,
"quantity": 1,
"startDate": "2025-06-24T12:19:05.415Z",
"endDate": "2025-06-24T12:19:05.415Z",
"autoApplyToPrice": true,
"description": "text",
"tags": "text",
"status": "1 - Active",
"testMode": true
}
{
"success": true,
"statusCode": 201,
"message": "The request was successful.",
"data": {
"id": "sApKpllz4sAplsmzha",
"code": "COUPON1",
"name": "Coupon 1",
"description": "This is a coupon",
"tags": "tag1, tag2",
"percentage": 10,
"quantity": 100,
"startDate": "2025-06-23T13:56:00.4277236+07:00",
"endDate": "2025-07-23T13:56:00.4277241+07:00",
"autoApplyToPrice": true,
"status": "Active",
"testMode": false,
"modifiedDate": "2025-06-23T13:56:00.4277253+07:00"
},
"errors": []
}
Last updated
Was this helpful?