List Discounts
curl --request GET \
--url https://api.launchmystore.io/api/v1/discounts.json \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.launchmystore.io/api/v1/discounts.json"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.launchmystore.io/api/v1/discounts.json', 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.launchmystore.io/api/v1/discounts.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/api/v1/discounts.json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.launchmystore.io/api/v1/discounts.json")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/discounts.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": 123,
"state": "<string>",
"message": "<string>",
"data.discounts": [
{
"couponId": "<string>",
"code": "<string>",
"type": "<string>",
"status": "<string>",
"discountPercentage": 123,
"discountAmount": 123,
"minOrderTotal": 123,
"totalCoupons": 123,
"usedCount": 123,
"usesPerCustomer": 123,
"applyOnProducts": [
{}
],
"startDate": "<string>",
"endDate": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
],
"data.total": 123,
"data.page": 123,
"data.limit": 123
}Discounts
List Discounts
Retrieve a list of discount codes
GET
/
api
/
v1
/
discounts.json
List Discounts
curl --request GET \
--url https://api.launchmystore.io/api/v1/discounts.json \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.launchmystore.io/api/v1/discounts.json"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.launchmystore.io/api/v1/discounts.json', 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.launchmystore.io/api/v1/discounts.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/api/v1/discounts.json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.launchmystore.io/api/v1/discounts.json")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/discounts.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": 123,
"state": "<string>",
"message": "<string>",
"data.discounts": [
{
"couponId": "<string>",
"code": "<string>",
"type": "<string>",
"status": "<string>",
"discountPercentage": 123,
"discountAmount": 123,
"minOrderTotal": 123,
"totalCoupons": 123,
"usedCount": 123,
"usesPerCustomer": 123,
"applyOnProducts": [
{}
],
"startDate": "<string>",
"endDate": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
],
"data.total": 123,
"data.page": 123,
"data.limit": 123
}List Discounts
Returns a paginated list of discount codes in the store.Request
curl -X GET "https://api.launchmystore.io/api/v1/discounts.json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Parameters
active (enabled and within its dates), scheduled (starts in the
future), expired (end date passed) or disabled (switched off).Response
Returns the standard response envelope. Thedata object contains the
discount rows plus flat pagination counters.
Array of discount objects
Show Discount Object
Show Discount Object
Example Response
{
"status": 200,
"state": "success",
"message": null,
"data": {
"discounts": [
{
"couponId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"code": "SUMMER20",
"type": "Percentage",
"status": "Active",
"discountPercentage": 20,
"discountAmount": null,
"minOrderTotal": 50,
"totalCoupons": 500,
"usedCount": 145,
"usesPerCustomer": 1,
"applyOnProducts": [],
"startDate": "2024-06-01T00:00:00Z",
"endDate": "2024-08-31T23:59:59Z",
"createdAt": "2024-05-15T10:00:00Z",
"updatedAt": "2024-07-01T14:30:00Z"
},
{
"couponId": "a912c0de-1f44-4c0a-9b2e-2f1d77c3e110",
"code": "FREESHIP",
"type": "FreeShipping",
"status": "Active",
"discountPercentage": null,
"discountAmount": null,
"minOrderTotal": 75,
"totalCoupons": 0,
"usedCount": 89,
"usesPerCustomer": null,
"applyOnProducts": [],
"startDate": "2024-01-01T00:00:00Z",
"endDate": null,
"createdAt": "2024-01-01T08:00:00Z",
"updatedAt": "2024-01-01T08:00:00Z"
}
],
"total": 15,
"page": 1,
"limit": 50
},
"pagination": null
}
Error Response
Errors return the same envelope with anerror state and the message under
message:
{
"status": 500,
"state": "error",
"message": "Something went wrong"
}