Skip to main content
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>",
  "title": "<string>",
  "value": 123,
  "usage_limit": 123,
  "once_per_customer": true,
  "minimum_order_amount": 123,
  "minimum_quantity": 123,
  "applies_to": "<string>",
  "product_ids": [
    {}
  ],
  "collection_ids": [
    {}
  ],
  "customer_eligibility": "<string>",
  "customer_ids": [
    {}
  ],
  "starts_at": "<string>",
  "ends_at": "<string>",
  "status": "<string>"
}
'
{
  "success": true,
  "data": {}
}

Documentation Index

Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt

Use this file to discover all available pages before exploring further.

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"
  }'

Path Parameters

id
string
required
The unique discount ID to update

Body Parameters

All parameters are optional. Only provided fields will be updated.
code
string
Discount code (changing code affects any saved links)
title
string
Internal title/description
value
number
Discount value
usage_limit
integer
Maximum uses. Set to null for unlimited.
once_per_customer
boolean
Limit to one use per customer
minimum_order_amount
integer
Minimum order amount in cents
minimum_quantity
integer
Minimum quantity required
applies_to
string
What the discount applies to
product_ids
array
Product IDs for specific_products
collection_ids
array
Collection IDs for specific_collections
customer_eligibility
string
Customer eligibility setting
customer_ids
array
Specific customer IDs
starts_at
string
Start date (ISO 8601)
ends_at
string
End date (ISO 8601). Set to null to remove expiration.
status
string
Set to disabled to deactivate or active to reactivate

Response

success
boolean
Whether the request succeeded
data
object
The updated discount object

Example Response

{
  "success": true,
  "data": {
    "id": "disc_abc123",
    "code": "SUMMER20",
    "title": "Summer Sale 20% Off",
    "type": "percentage",
    "value": 20,
    "status": "active",
    "usage_count": 145,
    "usage_limit": 1000,
    "once_per_customer": true,
    "minimum_order_amount": 5000,
    "applies_to": "all",
    "starts_at": "2024-06-01T00:00:00Z",
    "ends_at": "2024-09-30T23:59:59Z",
    "created_at": "2024-05-15T10:00:00Z",
    "updated_at": "2024-07-01T14:30:00Z"
  }
}

Notes

  • The type field cannot be changed after creation
  • Changing the code will affect any shared links or saved customer carts
  • Setting status to disabled immediately deactivates the discount
  • Usage count cannot be modified directly

Error Codes

CodeDescription
UNAUTHORIZEDInvalid or missing access token
FORBIDDENApp doesn’t have write_discounts scope
NOT_FOUNDDiscount with the specified ID does not exist
VALIDATION_ERRORInvalid request body (see error details)
DUPLICATE_CODEA discount with this code already exists