API
Obtaining the API Key
To obtain the API key:
Navigate to the Settings page in the Staff Panel.
Scroll down to the API Settings section.
Ensure the Enable API checkbox is checked.
Set your desired API key in the input field labeled "Enter API Key".
Save the settings by clicking the Save Settings button.
The API key is private and should not be shared with anyone. It can be any string you choose, but it’s important to make sure it’s secure (e.g., a long and complex password-like string).
Endpoint: /api/users/:discordID
(GET)
/api/users/:discordID
(GET)This API endpoint allows you to retrieve detailed information about a user based on their Discord ID. The data returned includes user information, the contents of their cart, and the products they own.
URL Parameters
discordID (string): The Discord ID of the user whose information you want to retrieve.
Headers
x-api-key (string): This is required for authentication. The API key must be included in the header to access this endpoint.
Success Response
Status Code:
200 OK
Response Body:
Possible Error Responses:
Axios Example:
Endpoint: /api/users/:discordID/addproduct/:urlId
(POST)
/api/users/:discordID/addproduct/:urlId
(POST)This API endpoint allows you to add a specific product to a user's owned products list based on their Discord ID and the product's unique urlId
.
URL Parameters
discordID
(string): The Discord ID of the user to whom the product should be added.urlId
(string): The unique identifier for the product to be added. This is typically a URL-safe string such asproduct-name
.
Headers
x-api-key (string): This is required for authentication. The API key must be included in the header to access this endpoint.
Success Response
Status Code:
200 OK
Response Body:
Possible Error Responses:
Axios Example:
Endpoint: /api/users/:discordID/removeproduct/:urlId
(POST)
/api/users/:discordID/removeproduct/:urlId
(POST)This API endpoint allows you to remove a specific product from a user's owned products list based on their Discord ID and the product's unique urlId
.
URL Parameters
discordID
(string): The Discord ID of the user to whom the product should be added.urlId
(string): The unique identifier for the product to be added. This is typically a URL-safe string such asproduct-name
.
Headers
x-api-key (string): This is required for authentication. The API key must be included in the header to access this endpoint.
Success Response
Status Code:
200 OK
Response Body:
Possible Error Responses:
Axios Example:
Endpoint: /api/discounts/create
(POST)
/api/discounts/create
(POST)This API endpoint allows you to create a new discount code for your store, specifying its name, discount percentage, maximum uses, and expiration date.
Request Body
name
string
Yes
The unique name of the discount code.
discountPercentage
number
Yes
The percentage discount (e.g., 10
for a 10% discount).
maxUses
number
No
The maximum number of times the code can be used. Leave empty for unlimited.
expiresAt
string
No
The expiration date of the code in ISO 8601 format. Leave empty for no expiration.
Headers
x-api-key (string): This is required for authentication. The API key must be included in the header to access this endpoint.
Success Response
Status Code:
200 OK
Response Body:
Possible Error Responses:
Axios Example:
Endpoint: /api/payments/:transactionID
(GET)
/api/payments/:transactionID
(GET)This API endpoint allows you to retrieve detailed payment information based on a specific transaction ID. The returned data includes details about the payment method, user information, products purchased, and any discounts applied.
URL Parameters
transactionID (string): The unique transaction ID associated with the payment you want to retrieve.
Headers
x-api-key (string): This is required for authentication. The API key must be included in the header to access this endpoint.
Success Response
Status Code:
200 OK
Response Body:
Possible Error Responses:
Axios Example:
Endpoint: /api/products
(GET)
/api/products
(GET)This API endpoint allows you to retrieve detailed information about all products available in the system. The data returned includes the product's name, type, price, total purchases, total earned, total downloads, and creation date.
Headers
x-api-key (string): This is required for authentication. The API key must be included in the header to access this endpoint.
Success Response
Status Code:
200 OK
Response Body:
Possible Error Responses:
Axios Example:
Endpoint: /api/statistics
(GET)
/api/statistics
(GET)This API endpoint provides aggregated statistics about the platform, including total purchases, total earnings, total site visits, as well as the total number of users and products.
Headers
x-api-key (string): This is required for authentication. The API key must be included in the header to access this endpoint.
Success Response
Status Code:
200 OK
Response Body:
Possible Error Responses:
Axios Example:
Endpoint: /api/reviews
(GET)
/api/reviews
(GET)This API endpoint allows you to retrieve all reviews submitted by users. Each review includes the user's Discord ID, the name of the product reviewed, the rating, the comment, and the creation date.
Headers
x-api-key (string): This is required for authentication. The API key must be included in the header to access this endpoint.
Success Response
Status Code:
200 OK
Response Body:
Possible Error Responses:
Axios Example:
Last updated