Get Discount
curl --request GET \
--url https://api.launchmystore.io/api/v1/discounts/{id}.json \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.launchmystore.io/api/v1/discounts/{id}.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/{id}.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/{id}.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/{id}.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/{id}.json")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/discounts/{id}.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": {
"couponId": "<string>",
"code": "<string>",
"type": "<string>",
"status": "<string>",
"discountPercentage": 123,
"discountAmount": 123,
"maxDiscount": 123,
"minOrderCondition": "<string>",
"minOrderValue": 123,
"minOrderQuantity": 123,
"minOrderTotal": 123,
"usesPerCustomer": 123,
"usesPerOrder": 123,
"totalCoupons": 123,
"usedCount": 123,
"discountProvided": 123,
"applyOnProducts": [
{}
],
"showCoupon": true,
"onlinePayments": true,
"validForNewCustomers": true,
"autoApply": true,
"buyQuantity": 123,
"getQuantity": 123,
"freeShippingCondition": "<string>",
"freeShippingAmount": 123,
"freebie": [
{}
],
"startDate": "<string>",
"endDate": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}Discounts
Get Discount
Retrieve a single discount code
GET
/
api
/
v1
/
discounts
/
{id}
.json
Get Discount
curl --request GET \
--url https://api.launchmystore.io/api/v1/discounts/{id}.json \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.launchmystore.io/api/v1/discounts/{id}.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/{id}.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/{id}.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/{id}.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/{id}.json")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/discounts/{id}.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": {
"couponId": "<string>",
"code": "<string>",
"type": "<string>",
"status": "<string>",
"discountPercentage": 123,
"discountAmount": 123,
"maxDiscount": 123,
"minOrderCondition": "<string>",
"minOrderValue": 123,
"minOrderQuantity": 123,
"minOrderTotal": 123,
"usesPerCustomer": 123,
"usesPerOrder": 123,
"totalCoupons": 123,
"usedCount": 123,
"discountProvided": 123,
"applyOnProducts": [
{}
],
"showCoupon": true,
"onlinePayments": true,
"validForNewCustomers": true,
"autoApply": true,
"buyQuantity": 123,
"getQuantity": 123,
"freeShippingCondition": "<string>",
"freeShippingAmount": 123,
"freebie": [
{}
],
"startDate": "<string>",
"endDate": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}Get Discount
Returns a single discount code by its ID.Request
curl -X GET "https://api.launchmystore.io/api/v1/discounts/d290f1ee-6c54-4b01-90e6-d701748f0851.json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const response = await fetch('https://api.launchmystore.io/api/v1/discounts/d290f1ee-6c54-4b01-90e6-d701748f0851.json', {
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
});
Path Parameters
Response
Returns the standard response envelope with the discount underdata.discount.
Wrapper containing the
discountShow Discount Object
Show Discount Object
Example Response
{
"status": 200,
"state": "success",
"message": null,
"data": {
"discount": {
"couponId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"code": "SUMMER20",
"type": "Percentage",
"status": "Active",
"discountPercentage": 20,
"discountAmount": null,
"maxDiscount": 50,
"minOrderCondition": "orderValue",
"minOrderValue": 50,
"minOrderQuantity": null,
"minOrderTotal": 50,
"usesPerCustomer": 1,
"usesPerOrder": null,
"totalCoupons": 500,
"usedCount": 145,
"discountProvided": 1450,
"applyOnProducts": [],
"showCoupon": true,
"onlinePayments": false,
"validForNewCustomers": false,
"autoApply": false,
"buyQuantity": null,
"getQuantity": null,
"freeShippingCondition": null,
"freeShippingAmount": 0,
"freebie": [],
"startDate": "2024-06-01",
"endDate": "2024-08-31",
"storeId": "store_abc123",
"createdAt": "2024-05-15T10:00:00.000Z",
"updatedAt": "2024-05-15T10:00:00.000Z"
}
}
}
Errors
On failure the same envelope is returned withstate: "error" and a message:
{
"status": 404,
"state": "error",
"message": "Discount not found"
}
| Status | Condition |
|---|---|
401 | Invalid or missing access token |
403 | App doesn’t have read_discounts scope |
404 | Discount with the specified ID does not exist |