curl --request POST \
--url https://api.salesive.com/api/v1/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "SUMMER20",
"type": "percentage",
"discount": 20,
"usageLimit": 100,
"usagePerUser": 1,
"minimumOrderAmount": 5000,
"startDate": "2026-06-01T00:00:00.000Z",
"endDate": "2026-08-31T23:59:59.000Z",
"active": true
}
'import requests
url = "https://api.salesive.com/api/v1/coupons"
payload = {
"code": "SUMMER20",
"type": "percentage",
"discount": 20,
"usageLimit": 100,
"usagePerUser": 1,
"minimumOrderAmount": 5000,
"startDate": "2026-06-01T00:00:00.000Z",
"endDate": "2026-08-31T23:59:59.000Z",
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: 'SUMMER20',
type: 'percentage',
discount: 20,
usageLimit: 100,
usagePerUser: 1,
minimumOrderAmount: 5000,
startDate: '2026-06-01T00:00:00.000Z',
endDate: '2026-08-31T23:59:59.000Z',
active: true
})
};
fetch('https://api.salesive.com/api/v1/coupons', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.salesive.com/api/v1/coupons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => 'SUMMER20',
'type' => 'percentage',
'discount' => 20,
'usageLimit' => 100,
'usagePerUser' => 1,
'minimumOrderAmount' => 5000,
'startDate' => '2026-06-01T00:00:00.000Z',
'endDate' => '2026-08-31T23:59:59.000Z',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.salesive.com/api/v1/coupons"
payload := strings.NewReader("{\n \"code\": \"SUMMER20\",\n \"type\": \"percentage\",\n \"discount\": 20,\n \"usageLimit\": 100,\n \"usagePerUser\": 1,\n \"minimumOrderAmount\": 5000,\n \"startDate\": \"2026-06-01T00:00:00.000Z\",\n \"endDate\": \"2026-08-31T23:59:59.000Z\",\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.salesive.com/api/v1/coupons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"SUMMER20\",\n \"type\": \"percentage\",\n \"discount\": 20,\n \"usageLimit\": 100,\n \"usagePerUser\": 1,\n \"minimumOrderAmount\": 5000,\n \"startDate\": \"2026-06-01T00:00:00.000Z\",\n \"endDate\": \"2026-08-31T23:59:59.000Z\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesive.com/api/v1/coupons")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"SUMMER20\",\n \"type\": \"percentage\",\n \"discount\": 20,\n \"usageLimit\": 100,\n \"usagePerUser\": 1,\n \"minimumOrderAmount\": 5000,\n \"startDate\": \"2026-06-01T00:00:00.000Z\",\n \"endDate\": \"2026-08-31T23:59:59.000Z\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"status": 201,
"success": true,
"message": "Coupon created successfully",
"data": {
"_id": "66b1f2a9c4d5e6f7a8b9c0d1",
"code": "SUMMER20",
"user": "66a0e1b2c3d4e5f6a7b8c9d0",
"shop": "66a0d1c2b3a4958677564738",
"type": "percentage",
"discount": 20,
"usageLimit": 100,
"usageCount": 0,
"usagePerUser": 1,
"minimumOrderAmount": 5000,
"startDate": "2026-06-01T00:00:00.000Z",
"endDate": "2026-08-31T23:59:59.000Z",
"active": true,
"createdAt": "2026-06-28T12:00:00.000Z",
"updatedAt": "2026-06-28T12:00:00.000Z"
}
}{
"status": 401,
"success": false,
"message": "Authentication required",
"data": null
}{
"status": 403,
"success": false,
"message": "Insufficient scope",
"data": null
}Create a coupon
Create a new discount coupon for the store. Requires the WRITE_DISCOUNTS scope.
curl --request POST \
--url https://api.salesive.com/api/v1/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "SUMMER20",
"type": "percentage",
"discount": 20,
"usageLimit": 100,
"usagePerUser": 1,
"minimumOrderAmount": 5000,
"startDate": "2026-06-01T00:00:00.000Z",
"endDate": "2026-08-31T23:59:59.000Z",
"active": true
}
'import requests
url = "https://api.salesive.com/api/v1/coupons"
payload = {
"code": "SUMMER20",
"type": "percentage",
"discount": 20,
"usageLimit": 100,
"usagePerUser": 1,
"minimumOrderAmount": 5000,
"startDate": "2026-06-01T00:00:00.000Z",
"endDate": "2026-08-31T23:59:59.000Z",
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: 'SUMMER20',
type: 'percentage',
discount: 20,
usageLimit: 100,
usagePerUser: 1,
minimumOrderAmount: 5000,
startDate: '2026-06-01T00:00:00.000Z',
endDate: '2026-08-31T23:59:59.000Z',
active: true
})
};
fetch('https://api.salesive.com/api/v1/coupons', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.salesive.com/api/v1/coupons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => 'SUMMER20',
'type' => 'percentage',
'discount' => 20,
'usageLimit' => 100,
'usagePerUser' => 1,
'minimumOrderAmount' => 5000,
'startDate' => '2026-06-01T00:00:00.000Z',
'endDate' => '2026-08-31T23:59:59.000Z',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.salesive.com/api/v1/coupons"
payload := strings.NewReader("{\n \"code\": \"SUMMER20\",\n \"type\": \"percentage\",\n \"discount\": 20,\n \"usageLimit\": 100,\n \"usagePerUser\": 1,\n \"minimumOrderAmount\": 5000,\n \"startDate\": \"2026-06-01T00:00:00.000Z\",\n \"endDate\": \"2026-08-31T23:59:59.000Z\",\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.salesive.com/api/v1/coupons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"SUMMER20\",\n \"type\": \"percentage\",\n \"discount\": 20,\n \"usageLimit\": 100,\n \"usagePerUser\": 1,\n \"minimumOrderAmount\": 5000,\n \"startDate\": \"2026-06-01T00:00:00.000Z\",\n \"endDate\": \"2026-08-31T23:59:59.000Z\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesive.com/api/v1/coupons")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"SUMMER20\",\n \"type\": \"percentage\",\n \"discount\": 20,\n \"usageLimit\": 100,\n \"usagePerUser\": 1,\n \"minimumOrderAmount\": 5000,\n \"startDate\": \"2026-06-01T00:00:00.000Z\",\n \"endDate\": \"2026-08-31T23:59:59.000Z\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"status": 201,
"success": true,
"message": "Coupon created successfully",
"data": {
"_id": "66b1f2a9c4d5e6f7a8b9c0d1",
"code": "SUMMER20",
"user": "66a0e1b2c3d4e5f6a7b8c9d0",
"shop": "66a0d1c2b3a4958677564738",
"type": "percentage",
"discount": 20,
"usageLimit": 100,
"usageCount": 0,
"usagePerUser": 1,
"minimumOrderAmount": 5000,
"startDate": "2026-06-01T00:00:00.000Z",
"endDate": "2026-08-31T23:59:59.000Z",
"active": true,
"createdAt": "2026-06-28T12:00:00.000Z",
"updatedAt": "2026-06-28T12:00:00.000Z"
}
}{
"status": 401,
"success": false,
"message": "Authentication required",
"data": null
}{
"status": 403,
"success": false,
"message": "Insufficient scope",
"data": null
}Authorizations
Installed-app access token (prefix app_), issued by the OAuth install flow. The store is bound to the token server-side — never send a shop id.
Body
Fields accepted when creating a coupon.
Coupon code (alphanumeric only). Stored uppercase; must be unique within the store.
Discount type: fixed or percentage.
fixed, percentage Discount amount. For percentage this is a percent value; for fixed it is an amount. Must be greater than 0.
Date the coupon becomes valid (ISO 8601).
Date the coupon expires (ISO 8601). Must be on or after startDate.
Maximum total redemptions across all customers. Minimum 1. Defaults to 1.
x >= 1Maximum redemptions per customer. Minimum 1. Defaults to 1.
x >= 1Minimum order subtotal required to apply the coupon. Cannot be negative. Defaults to 0.
x >= 0Whether the coupon is active. Defaults to true.
Response
The created coupon.
Standard Salesive response envelope. The operation-specific payload is carried in data.
Was this page helpful?

