Update Discount
curl --request PUT \
--url https://api.launchmystore.io/api/v1/discounts/{id}.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"type": "<string>",
"value": 123,
"applies_to": "<string>",
"product_ids": [
{}
],
"collection_ids": [
{}
],
"minimum_amount": 123,
"usage_limit": 123,
"once_per_customer": true,
"starts_at": "<string>",
"ends_at": "<string>",
"status": "<string>"
}
'import requests
url = "https://api.launchmystore.io/api/v1/discounts/{id}.json"
payload = {
"code": "<string>",
"type": "<string>",
"value": 123,
"applies_to": "<string>",
"product_ids": [{}],
"collection_ids": [{}],
"minimum_amount": 123,
"usage_limit": 123,
"once_per_customer": True,
"starts_at": "<string>",
"ends_at": "<string>",
"status": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
type: '<string>',
value: 123,
applies_to: '<string>',
product_ids: [{}],
collection_ids: [{}],
minimum_amount: 123,
usage_limit: 123,
once_per_customer: true,
starts_at: '<string>',
ends_at: '<string>',
status: '<string>'
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'type' => '<string>',
'value' => 123,
'applies_to' => '<string>',
'product_ids' => [
[
]
],
'collection_ids' => [
[
]
],
'minimum_amount' => 123,
'usage_limit' => 123,
'once_per_customer' => true,
'starts_at' => '<string>',
'ends_at' => '<string>',
'status' => '<string>'
]),
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.launchmystore.io/api/v1/discounts/{id}.json"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": 123,\n \"applies_to\": \"<string>\",\n \"product_ids\": [\n {}\n ],\n \"collection_ids\": [\n {}\n ],\n \"minimum_amount\": 123,\n \"usage_limit\": 123,\n \"once_per_customer\": true,\n \"starts_at\": \"<string>\",\n \"ends_at\": \"<string>\",\n \"status\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.launchmystore.io/api/v1/discounts/{id}.json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": 123,\n \"applies_to\": \"<string>\",\n \"product_ids\": [\n {}\n ],\n \"collection_ids\": [\n {}\n ],\n \"minimum_amount\": 123,\n \"usage_limit\": 123,\n \"once_per_customer\": true,\n \"starts_at\": \"<string>\",\n \"ends_at\": \"<string>\",\n \"status\": \"<string>\"\n}")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": 123,\n \"applies_to\": \"<string>\",\n \"product_ids\": [\n {}\n ],\n \"collection_ids\": [\n {}\n ],\n \"minimum_amount\": 123,\n \"usage_limit\": 123,\n \"once_per_customer\": true,\n \"starts_at\": \"<string>\",\n \"ends_at\": \"<string>\",\n \"status\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": 123,
"state": "<string>",
"message": "<string>",
"data.discount": {}
}Discounts
Update Discount
Update an existing discount code
PUT
/
api
/
v1
/
discounts
/
{id}
.json
Update Discount
curl --request PUT \
--url https://api.launchmystore.io/api/v1/discounts/{id}.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"type": "<string>",
"value": 123,
"applies_to": "<string>",
"product_ids": [
{}
],
"collection_ids": [
{}
],
"minimum_amount": 123,
"usage_limit": 123,
"once_per_customer": true,
"starts_at": "<string>",
"ends_at": "<string>",
"status": "<string>"
}
'import requests
url = "https://api.launchmystore.io/api/v1/discounts/{id}.json"
payload = {
"code": "<string>",
"type": "<string>",
"value": 123,
"applies_to": "<string>",
"product_ids": [{}],
"collection_ids": [{}],
"minimum_amount": 123,
"usage_limit": 123,
"once_per_customer": True,
"starts_at": "<string>",
"ends_at": "<string>",
"status": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
type: '<string>',
value: 123,
applies_to: '<string>',
product_ids: [{}],
collection_ids: [{}],
minimum_amount: 123,
usage_limit: 123,
once_per_customer: true,
starts_at: '<string>',
ends_at: '<string>',
status: '<string>'
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'type' => '<string>',
'value' => 123,
'applies_to' => '<string>',
'product_ids' => [
[
]
],
'collection_ids' => [
[
]
],
'minimum_amount' => 123,
'usage_limit' => 123,
'once_per_customer' => true,
'starts_at' => '<string>',
'ends_at' => '<string>',
'status' => '<string>'
]),
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.launchmystore.io/api/v1/discounts/{id}.json"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": 123,\n \"applies_to\": \"<string>\",\n \"product_ids\": [\n {}\n ],\n \"collection_ids\": [\n {}\n ],\n \"minimum_amount\": 123,\n \"usage_limit\": 123,\n \"once_per_customer\": true,\n \"starts_at\": \"<string>\",\n \"ends_at\": \"<string>\",\n \"status\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.launchmystore.io/api/v1/discounts/{id}.json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": 123,\n \"applies_to\": \"<string>\",\n \"product_ids\": [\n {}\n ],\n \"collection_ids\": [\n {}\n ],\n \"minimum_amount\": 123,\n \"usage_limit\": 123,\n \"once_per_customer\": true,\n \"starts_at\": \"<string>\",\n \"ends_at\": \"<string>\",\n \"status\": \"<string>\"\n}")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": 123,\n \"applies_to\": \"<string>\",\n \"product_ids\": [\n {}\n ],\n \"collection_ids\": [\n {}\n ],\n \"minimum_amount\": 123,\n \"usage_limit\": 123,\n \"once_per_customer\": true,\n \"starts_at\": \"<string>\",\n \"ends_at\": \"<string>\",\n \"status\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": 123,
"state": "<string>",
"message": "<string>",
"data.discount": {}
}Update Discount
Updates an existing discount code. Only provided fields will be updated.Request
curl -X PUT "https://api.launchmystore.io/api/v1/discounts/disc_abc123.json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"usage_limit": 1000,
"ends_at": "2024-09-30T23:59:59Z"
}'
const response = await fetch('https://api.launchmystore.io/api/v1/discounts/disc_abc123.json', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
usage_limit: 1000,
ends_at: '2024-09-30T23:59:59Z'
})
});
Path Parameters
string
required
The unique discount ID to update
Body Parameters
All parameters are optional. Only provided fields will be updated. Any field not listed below is ignored.string
Discount code (changing code affects any saved links)
string
Discount type:
percentage, fixed_amount, free_shipping, buy_x_get_ynumber
Discount value (percentage or fixed amount). Must be
>= 0.string
What the discount applies to:
all, products, collectionsarray
Product IDs (when
applies_to is products)array
Collection IDs (when
applies_to is collections)number
Minimum order amount required for the discount to apply
integer
Maximum total uses. Must be
>= 1.boolean
Limit to one use per customer
string
Start date (ISO 8601)
string
End date (ISO 8601)
string
Discount status:
active, expired, scheduled, disabledResponse
Returns the standard response envelope with the updated discount row underdata.discount.
integer
HTTP status code (e.g.
200)string
Response state:
success or errorstring
Human-readable message (
null on success)object
The updated 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,
"minOrderTotal": 50,
"totalCoupons": 1000,
"usedCount": 145,
"usesPerCustomer": 1,
"applyOnProducts": [],
"startDate": "2024-06-01T00:00:00Z",
"endDate": "2024-09-30T23:59:59Z",
"createdAt": "2024-05-15T10:00:00Z",
"updatedAt": "2024-07-01T14:30:00Z"
}
},
"count": null,
"pagination": null
}
Notes
- Setting
statustodisabled(or any value other thanactive) deactivates the discount;activereactivates it. - Changing the
codewill affect any shared links or saved customer carts. - Usage count cannot be modified directly.
Error Response
Errors return the same envelope with anerror state. A missing discount
returns 404:
{
"status": 404,
"state": "error",
"message": "Discount not found",
"data": null
}