Weblutions Documentation
Weblutions Main Site Contact Us Our Discord
FaxStore IconFaxStore

Sales API

By Josh M. 4 mins 2

The FaxStore Sales API allows sales and promotional discounts to be created, retrieved, and removed through the API. Sales can be applied to all items, a specific store category, or an individual item, with a defined discount percentage and expiry time. The available endpoints allow you to retrieve all active sales, retrieve a specific sale by ID, create a new sale, or delete an existing sale.

Table of Contents


Get All Sales

GET/api/sales
Returns an array of all sales running on the store.
Authorization
NameTypeRequiredDescription
authorizationStringrequired
Responses
200OKjson
View response body
[
  {
    "id": 10,
    "name": "Test Sale",
    "items": "9",
    "saleamount": "10",
    "expiry": "",
    "createdAt": "1734312724298"
  }
]
401Unauthorizedplaintext
View response body
You are not authorized to access this resource.

Get Sale

GET/api/sales/:id
Returns the requested sales in an object.
Authorization
NameTypeRequiredDescription
authorizationStringrequired
Path parameters
NameTypeRequiredDescription
idStringrequiredThe internal database ID of the sale.
Responses
200OKjson
View response body
{
  "id": 10,
  "name": "test",
  "items": "9",
  "saleamount": "10",
  "expiry": "",
  "createdAt": "1734312724298"
}
401Unauthorizedplaintext
View response body
You are not authorized to access this resource.
404Not Foundplaintext
View response body
Sale not found.

Create Sale

POST/api/sales
Create a sale with the provided details to run on the store.
Authorization
NameTypeRequiredDescription
authorizationStringrequired
Request body
NameTypeRequiredDescription
nameStringrequiredThe name or description of the sale (displayed internally)
itemsStringrequiredA product ID, category, or astricks for everything. See ntoe.
expiryIntegerrequiredMS timestamp specifying when the sale will end.
saleamountIntegerrequiredInteger representing the percentage discount to apply.
Responses
200OKjson
View response body
{
  "id": 10,
  "name": "Test Sale",
  "items": "9",
  "saleamount": "10",
  "expiry": "",
  "createdAt": "1734312724298"
}
400Bad Bodyplaintext
View response body
Invalid store cateogry ID provided.
Missing required body item - items are required
Invalid store item ID provided.
401Unauthorizedplaintext
View response body
You are not authorized to access this resource.

Notes:

  • For the items body field:

    • Use * for all items, sc-XX for a store category, or XX for a specific item ID.

    • XX in the above represent a product or category ID.

  • Expiries must be in the future or the sale will not begin and will delete within 24 hours.


Delete Sale

DELETE/api/sales/:id
Deletes a sale from the database and ends its active state.
Authorization
NameTypeRequiredDescription
authorizationStringrequired
Path parameters
NameTypeRequiredDescription
idStringrequiredThe database ID of the sale to delete.
Responses
201OKplaintext
View response body
(no content)
404Not Foundplaintext
View response body
Sale ID not found.
401Unauthorizedjson
View response body
You are not authorized to access this resource.