# Introduction

Welcome to the LeaderOS API documentation.

This documentation is for developers who want to integrate LeaderOS into their own applications, or who want to extend LeaderOS with their own plugins.


# Authentication

LeaderOS uses a HTTP header to authenticate requests with an API key.\
The header is called `X-Api-Key` and the value is the API key.

{% hint style="info" %}
The API key can be found in the LeaderOS settings.
{% endhint %}

#### Examples

{% tabs %}
{% tab title="cURL" %}

#### GET Request

```
curl https://yourwebsite.com/api/store/products
   -H "X-Api-Key: YOUR_API_KEY"
```

#### POST Request

```
curl https://yourwebsite.com/api/store/products
   -H "X-Api-Key: YOUR_API_KEY"
   -H "Content-Type: multipart/form-data"
   -X POST
   -d "username=test&password=test"
```

{% endtab %}

{% tab title="PHP" %}

#### GET Request

<pre class="language-php"><code class="lang-php">// GET
<strong>$ch = curl_init();
</strong>curl_setopt($ch, CURLOPT_URL, "https://yourwebsite.com/api/store/products");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$headers = [
    'X-Api-Key: YOUR_API_KEY'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$output = curl_exec ($ch);
curl_close ($ch);
</code></pre>

#### POST Request

```php
// POST
curl_setopt($ch, CURLOPT_URL, "https://yourwebsite.com/api/auth/login");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'username' => 'test',
    'password' => 'test'
]);

$headers = [
    'X-Api-Key: YOUR_API_KEY'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$output = curl_exec ($ch);
curl_close ($ch);
```

{% endtab %}

{% tab title="JavaScript" %}

#### GET Request

```javascript
const instance = axios.create({
  baseURL: 'https://yourwebsite.com',
  headers: {
    'X-API-KEY': 'YOUR_API_KEY',
  },
});

// GET
instance.get('/api/store/products');
```

#### POST Request

```javascript
const instance = axios.create({
  baseURL: 'https://yourwebsite.com',
  headers: {
    'X-API-KEY': 'YOUR_API_KEY',
  },
});

// POST
instance.post('/api/auth/login', {
  username: 'test',
  password: 'test'
}, {
  headers: {
    'Content-Type': 'multipart/form-data',
  }
});
```

{% endtab %}
{% endtabs %}


# Auth


# Login

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/auth/login`

#### Request Body

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| username<mark style="color:red;">\*</mark>  | string |             |
| password<mark style="color:red;">\*</mark>  | string |             |
| ip<mark style="color:red;">\*</mark>        | string |             |
| useragent<mark style="color:red;">\*</mark> | string |             |

{% tabs %}
{% tab title="200: Successful" %}

```json
{
    "status": true,
    "data": {
        "token": "202cb962ac59075b964b07152d234b70",
        "isTfaRequired": false
    }
}
```

{% endtab %}

{% tab title="404: User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}

{% tab title="401: Wrong password" %}

```json
{
    "status": false,
    "error": "WRONG_PASSWORD",
    "message": "Wrong password!"
}
```

{% endtab %}
{% endtabs %}


# Register

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/auth/register`

#### Request Body

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| username<mark style="color:red;">\*</mark>  | string |             |
| password<mark style="color:red;">\*</mark>  | string |             |
| email<mark style="color:red;">\*</mark>     | string |             |
| ip<mark style="color:red;">\*</mark>        | string |             |
| useragent<mark style="color:red;">\*</mark> | string |             |

{% tabs %}
{% tab title="200: Successful" %}

```json
{
    "status": true,
    "data": {
        "token": "202cb962ac59075b964b07152d234b70"
    }
}
```

{% endtab %}

{% tab title="400:  Username exist" %}

```json
{
    "status": false,
    "error": "USERNAME_ALREADY_EXIST",
    "message": "Username already exists!"
}
```

{% endtab %}

{% tab title="400: Email exist" %}

```json
{
    "status": false,
    "error": "EMAIL_ALREADY_EXIST",
    "message": "Email already exists!"
}
```

{% endtab %}

{% tab title="400: Register limit" %}

```json
{
    "status": false,
    "error": "REGISTER_LIMIT",
    "message": "You have reached the limit of registrations!"
}
```

{% endtab %}

{% tab title="400: Invalid username" %}

```json
{
    "status": false,
    "error": "INVALID_USERNAME",
    "message": "Invalid username!"
}
```

{% endtab %}
{% endtabs %}


# Sessions

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/auth/sessions/<token>`

{% tabs %}
{% tab title="200: OK Successful" %}

```json
{
    "status": true
}
```

{% endtab %}

{% tab title="404: Not Found Session not found" %}

```json
{
    "status": false,
    "error": "SESSION_NOT_FOUND",
    "message": "Session not found!"
}
```

{% endtab %}
{% endtabs %}

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/auth/sessions`

#### Request Body

| Name                                     | Type   | Description                    |
| ---------------------------------------- | ------ | ------------------------------ |
| userID<mark style="color:red;">\*</mark> | int    |                                |
| ip<mark style="color:red;">\*</mark>     | string |                                |
| expires                                  | string | Datetime (2025-01-20 15:30:20) |

{% tabs %}
{% tab title="201: Created Successful login" %}

```json
{
    "status": true,
    "token": "202cb962ac59075b964b07152d234b70"
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}


# 2FA

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/auth/tfa/verify`

#### Request Body

| Name                                    | Type   | Description   |
| --------------------------------------- | ------ | ------------- |
| token<mark style="color:red;">\*</mark> | string | Session Token |
| code<mark style="color:red;">\*</mark>  | string |               |

{% tabs %}
{% tab title="200: Successful" %}

```json
{
    "status": true,
}
```

{% endtab %}

{% tab title="404: Session not found" %}

```json
{
    "status": false,
    "error": "SESSION_NOT_FOUND",
    "message": "Session not found!"
}
```

{% endtab %}
{% endtabs %}


# Users


# Profiles

## Get a user profile details

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/users/?userID=<user_id>`

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/users/?username=<username>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "id": "2",
    "username": "leaderos",
    "email": "test@gmail.com",
    "credit": "150.00",
    "isVerified": "1",
    "authStatus": "0",
    "creationIP": "1.1.1.1",
    "creationDate": "2022-09-15 10:41:44",
    "linkedAccounts": [
        "discord": "111111111111" // Linked Discord User ID
    ]
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}


# Roles

## Get all roles of a user

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/users/<user_id>/roles`

#### Path Parameters

| Name                                       | Type    | Description |
| ------------------------------------------ | ------- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | numeric | User's ID   |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "2",
        "discordRoleID": "673855784005795840",
        "name": "Admin",
        "slug": "admin",
        "priority": "99",
        "expiryDate": "1000-01-01 00:00:00", // Permanent role
    },
    {
        "id": "3",
        "discordRoleID": "673855784005795841",
        "name": "VIP",
        "slug": "vip",
        "priority": "5",
        "expiryDate": "2023-09-03 12:30:45", // Temporary role
    }
]
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}

## Add role to user

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/users/<user_id>/roles`

#### Path Parameters

| Name                                       | Type    | Description |
| ------------------------------------------ | ------- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | numeric | User's ID   |

#### Request Body

| Name                                     | Type    | Description |
| ---------------------------------------- | ------- | ----------- |
| roleID<mark style="color:red;">\*</mark> | numeric |             |
| expiryDate                               | string  |             |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "2",
        "discordRoleID": "673855784005795840",
        "name": "Admin",
        "slug": "admin",
        "priority": "99",
        "expiryDate": "1000-01-01 00:00:00", // Permanent role
    },
    {
        "id": "3",
        "discordRoleID": "673855784005795841",
        "name": "VIP",
        "slug": "vip",
        "priority": "5",
        "expiryDate": "2023-09-03 12:30:45", // Temporary role
    }
]
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}

## Update user roles

<mark style="color:purple;">`PATCH`</mark> `https://yourwebsite.com/api/users/<user_id>/roles/<role>`

#### Path Parameters

| Name                                       | Type    | Description |
| ------------------------------------------ | ------- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | numeric | User's ID   |
| role                                       | string  | Role ID     |

#### Request Body

| Name                                     | Type    | Description |
| ---------------------------------------- | ------- | ----------- |
| roleID<mark style="color:red;">\*</mark> | numeric |             |
| expiryDate                               | string  |             |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "2",
        "discordRoleID": "673855784005795840",
        "name": "Admin",
        "slug": "admin",
        "priority": "99",
        "expiryDate": "1000-01-01 00:00:00", // Permanent role
    },
    {
        "id": "3",
        "discordRoleID": "673855784005795841",
        "name": "VIP",
        "slug": "vip",
        "priority": "5",
        "expiryDate": "2023-09-03 12:30:45", // Temporary role
    }
]
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}

## Remove role from user

<mark style="color:red;">`DELETE`</mark> `https://yourwebsite.com/api/users/<user_id>/roles/<role>`

#### Path Parameters

| Name                                       | Type    | Description |
| ------------------------------------------ | ------- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | numeric | User's ID   |
| role<mark style="color:red;">\*</mark>     | string  | Role ID     |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "2",
        "discordRoleID": "673855784005795840",
        "name": "Admin",
        "slug": "admin",
        "priority": "99",
        "expiryDate": "1000-01-01 00:00:00", // Permanent role
    },
    {
        "id": "3",
        "discordRoleID": "673855784005795841",
        "name": "VIP",
        "slug": "vip",
        "priority": "5",
        "expiryDate": "2023-09-03 12:30:45", // Temporary role
    }
]
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}


# Tickets

## Get all tickets opened by a user

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/users/<user_id>/tickets`

#### Path Parameters

| Name                                       | Type    | Description |
| ------------------------------------------ | ------- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | numeric | User's ID   |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "1",
        "accountID": "1",
        "categoryID": "3",
        "title": "I need help!",
        "statusID": "2",
        "readStatus": "1",
        "updateDate": "2022-09-15 10:54:46",
        "creationDate": "2022-09-15 10:51:02",
        "categoryName": "Other"
    },
    {
        "id": "2",
        "accountID": "1",
        "categoryID": "1",
        "title": "Cheater report!",
        "statusID": "2",
        "readStatus": "1",
        "updateDate": "2022-09-15 10:54:27",
        "creationDate": "2022-09-15 10:52:07",
        "categoryName": "Cheat"
    }
]
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}


# Orders

## Get all orders of a user

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/users/<user_id>/orders`

#### Path Parameters

| Name                                       | Type    | Description |
| ------------------------------------------ | ------- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | numeric | User's ID   |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "2",
        "accountID": "2",
        "coupon": "test",
        "total": "100.00",
        "discount": "0.00",
        "subtotal": "100.00",
        "earnings": "100.00",
        "cashback": "0.00",
        "credit": "0.00",
        "type": "1",
        "status": "1",
        "paymentAPI": "paypal",
        "paymentID": "0",
        "creationDate": "2023-02-15 10:42:48"
    },
    {
        "id": "3",
        "accountID": "2",
        "coupon": null,
        "total": "300.00",
        "discount": "0.00",
        "subtotal": "300.00",
        "earnings": "300.00",
        "cashback": "0.00",
        "credit": "0.00",
        "type": "2",
        "status": "1",
        "paymentAPI": "paypal",
        "paymentID": "0",
        "creationDate": "2023-02-15 10:42:48"
    }
]
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}


# Store


# Listing

## Get the categories and products.

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/store/listing`

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/store/listing?username=<username>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "categories": [
        {
            "id": "7",
            "parentID": "0",
            "name": "VIP",
            "slug": "vip",
            "imageID": "ed1879ac89e4d8c7520c4f80f2eeef4c",
            "imageType": "png",
            "priority": "99",
            "minecraftStatus": "1",
            "minecraftTitle": "&amp;aVIP",
            "minecraftDescription": "&amp;7See all products!",
            "minecraftItem": "diamond",
            "isActive": "1",
            "subcategories": [],
            "products": [
                {
                    "id": "1",
                    "categoryID": "7",
                    "giveRoleID": "0",
                    "name": "VIP",
                    "imageID": "9a87fc6c3b2f7c82c8e84e05e72b3288",
                    "imageType": "png",
                    "details": "<p>VIP Membership</p>",
                    "price": "10.00",
                    "discountedPrice": "9.00",
                    "discountExpiryDate": "1000-01-01 00:00:00",
                    "duration": "30",
                    "stock": "5",
                    "priority": "0",
                    "isFeaturedProduct": "0",
                    "minecraftStatus": "0",
                    "minecraftTitle": "",
                    "minecraftDescription": "",
                    "minecraftItem": "default",
                    "isActive": "1",
                    "creationDate": "2022-09-15 18:47:02"
                },
                {
                    "id": "2",
                    "categoryID": "7",
                    "giveRoleID": "0",
                    "name": "VIP+",
                    "imageID": "bfb68cc343fd7d2c69cab6a1f94604b7",
                    "imageType": "png",
                    "details": "<p>VIP Membership</p>",
                    "price": "15.00",
                    "discountedPrice": "14.00",
                    "discountExpiryDate": "1000-01-01 00:00:00",
                    "duration": "30",
                    "stock": "3",
                    "priority": "0",
                    "isFeaturedProduct": "0",
                    "minecraftStatus": "0",
                    "minecraftTitle": "",
                    "minecraftDescription": "",
                    "minecraftItem": "default",
                    "isActive": "1",
                    "creationDate": "2022-09-15 18:48:42"
                },
                {
                    "id": "3",
                    "categoryID": "7",
                    "giveRoleID": "0",
                    "name": "MVIP",
                    "imageID": "dd6788fc33ecd49084dc4d227ac1ec50",
                    "imageType": "png",
                    "details": "<p>VIP Membership</p>",
                    "price": "25.00",
                    "discountedPrice": "24.00",
                    "discountExpiryDate": "1000-01-01 00:00:00",
                    "duration": "0",
                    "stock": "7",
                    "priority": "0",
                    "isFeaturedProduct": "0",
                    "minecraftStatus": "0",
                    "minecraftTitle": "",
                    "minecraftDescription": "",
                    "minecraftItem": "default",
                    "isActive": "1",
                    "creationDate": "2022-09-15 18:51:12"
                },
                {
                    "id": "4",
                    "categoryID": "7",
                    "giveRoleID": "0",
                    "name": "MVIP+",
                    "imageID": "23cba6792de4bd1065660f3731f72377",
                    "imageType": "png",
                    "details": "<p>MVIP+ Membership</p>",
                    "price": "40.00",
                    "discountedPrice": "38.00",
                    "discountExpiryDate": "1000-01-01 00:00:00",
                    "duration": "30",
                    "stock": "8",
                    "priority": "0",
                    "isFeaturedProduct": "0",
                    "minecraftStatus": "0",
                    "minecraftTitle": "",
                    "minecraftDescription": "",
                    "minecraftItem": "default",
                    "isActive": "1",
                    "creationDate": "2022-09-15 18:52:12"
                }
            ]
        },
        {
            "id": "8",
            "parentID": "0",
            "name": "Factions",
            "slug": "factions",
            "imageID": "017d66002f01317c7e0472b058341024",
            "imageType": "jpg",
            "priority": "0",
            "minecraftStatus": "1",
            "minecraftTitle": "&amp;aFactions",
            "minecraftDescription": "&amp;7See all products!",
            "minecraftItem": "diamond_sword",
            "isActive": "1",
            "subcategories": [
                {
                    "id": "1",
                    "parentID": "8",
                    "name": "Edit Items",
                    "slug": "edit-items",
                    "imageID": "e9edfc34faaef214cc11f25cf2f5b754",
                    "imageType": "png",
                    "priority": "0",
                    "minecraftStatus": "0",
                    "minecraftTitle": "",
                    "minecraftDescription": "",
                    "minecraftItem": "default",
                    "isActive": "1",
                    "subcategories": [],
                    "products": [
                        {
                            "id": "5",
                            "categoryID": "1",
                            "giveRoleID": "0",
                            "name": "Edit Armor",
                            "imageID": "19dce3c3636d9e8a023378a2d4e572da",
                            "imageType": "png",
                            "details": "<p>Edit Armor Product</p>",
                            "price": "20.00",
                            "discountedPrice": "15.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "7",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:05:32"
                        },
                        {
                            "id": "6",
                            "categoryID": "1",
                            "giveRoleID": "0",
                            "name": "Edit Sword",
                            "imageID": "fa40c10314d2a8ac235d7601327abc95",
                            "imageType": "png",
                            "details": "<p>Edit Sword Product</p>",
                            "price": "10.00",
                            "discountedPrice": "5.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "2",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:06:08"
                        },
                        {
                            "id": "7",
                            "categoryID": "1",
                            "giveRoleID": "0",
                            "name": "Edit Pickaxe",
                            "imageID": "f49896279f98737c26e06ceffd87b606",
                            "imageType": "png",
                            "details": "<p>Edit Pickaxe Product</p>",
                            "price": "12.00",
                            "discountedPrice": "6.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "5",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:07:01"
                        }
                    ]
                },
                {
                    "id": "2",
                    "parentID": "8",
                    "name": "Money",
                    "slug": "money",
                    "imageID": "ead67547e8b92cded5abbdbfee58989c",
                    "imageType": "png",
                    "priority": "0",
                    "minecraftStatus": "0",
                    "minecraftTitle": "",
                    "minecraftDescription": "",
                    "minecraftItem": "default",
                    "isActive": "1",
                    "subcategories": [],
                    "products": [
                        {
                            "id": "8",
                            "categoryID": "2",
                            "giveRoleID": "0",
                            "name": "100M Money",
                            "imageID": "1061b187b3f7234c66500e217b7c0c76",
                            "imageType": "png",
                            "details": "<p>100M Money</p>",
                            "price": "10.00",
                            "discountedPrice": "9.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "10",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:08:35"
                        },
                        {
                            "id": "9",
                            "categoryID": "2",
                            "giveRoleID": "0",
                            "name": "500M Money",
                            "imageID": "55d6692fed99c1f729a7215c4129709b",
                            "imageType": "png",
                            "details": "<p>500M Money</p>",
                            "price": "45.00",
                            "discountedPrice": "42.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "6",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:09:18"
                        },
                        {
                            "id": "10",
                            "categoryID": "2",
                            "giveRoleID": "0",
                            "name": "1T Money",
                            "imageID": "d2ff075c06317b476e8bf32b957dc84d",
                            "imageType": "png",
                            "details": "<p>1T Money</p>",
                            "price": "80.00",
                            "discountedPrice": "75.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "22",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:10:02"
                        }
                    ]
                }
            ],
            "products": []
        },
        {
            "id": "9",
            "parentID": "0",
            "name": "Skyblock",
            "slug": "skyblock",
            "imageID": "f10f36b11daa41450d0c379aa0b581eb",
            "imageType": "jpg",
            "priority": "0",
            "minecraftStatus": "1",
            "minecraftTitle": "&amp;aSkyblock",
            "minecraftDescription": "&amp;7See all products!",
            "minecraftItem": "grass_block",
            "isActive": "1",
            "subcategories": [
                {
                    "id": "3",
                    "parentID": "9",
                    "name": "Blocks",
                    "slug": "blocks",
                    "imageID": "9a9410733016c1b4115273ff6a86b5fe",
                    "imageType": "png",
                    "priority": "0",
                    "minecraftStatus": "0",
                    "minecraftTitle": "",
                    "minecraftDescription": "",
                    "minecraftItem": "default",
                    "isActive": "1",
                    "subcategories": [],
                    "products": [
                        {
                            "id": "17",
                            "categoryID": "3",
                            "giveRoleID": "0",
                            "name": "64x Gold Block",
                            "imageID": "4dc5b4b864e96df8b59ad20c27b75e43",
                            "imageType": "png",
                            "details": "<p>64x Gold Block</p>",
                            "price": "16.00",
                            "discountedPrice": "15.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "2",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:20:27"
                        },
                        {
                            "id": "18",
                            "categoryID": "3",
                            "giveRoleID": "0",
                            "name": "64x Emerald Block",
                            "imageID": "5880b4100317b2b55c85a75b9497c3d8",
                            "imageType": "png",
                            "details": "<p>64x Emerald Block</p>",
                            "price": "32.00",
                            "discountedPrice": "21.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "12",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:21:51"
                        },
                        {
                            "id": "19",
                            "categoryID": "3",
                            "giveRoleID": "0",
                            "name": "64x Diamond Block",
                            "imageID": "273c7bfc2a828cddeb7638abde2ef8ad",
                            "imageType": "png",
                            "details": "<p>64x Diamond Block</p>",
                            "price": "72.00",
                            "discountedPrice": "70.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "12",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:24:00"
                        }
                    ]
                },
                {
                    "id": "4",
                    "parentID": "9",
                    "name": "Money",
                    "slug": "money",
                    "imageID": "f303e7b76f625e85d28530a348337a20",
                    "imageType": "png",
                    "priority": "0",
                    "minecraftStatus": "0",
                    "minecraftTitle": "",
                    "minecraftDescription": "",
                    "minecraftItem": "default",
                    "isActive": "1",
                    "subcategories": [],
                    "products": [
                        {
                            "id": "11",
                            "categoryID": "4",
                            "giveRoleID": "0",
                            "name": "100M Money",
                            "imageID": "86278bb3abf22d5094458178576d5782",
                            "imageType": "png",
                            "details": "<p>100M Money</p>",
                            "price": "10.00",
                            "discountedPrice": "9.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "12",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:12:44"
                        },
                        {
                            "id": "12",
                            "categoryID": "4",
                            "giveRoleID": "0",
                            "name": "500M Money",
                            "imageID": "f4e3c7ca7832daf04acd9f0b756dc0c1",
                            "imageType": "png",
                            "details": "<p>500M Money</p>",
                            "price": "45.00",
                            "discountedPrice": "42.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "23",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:13:25"
                        },
                        {
                            "id": "13",
                            "categoryID": "4",
                            "giveRoleID": "0",
                            "name": "1T Money",
                            "imageID": "a6e6e612f687835b03c88e3052c9cc18",
                            "imageType": "png",
                            "details": "<p>1T Money</p>",
                            "price": "80.00",
                            "discountedPrice": "75.00",
                            "discountExpiryDate": "1000-01-01 00:00:00",
                            "duration": "0",
                            "stock": "34",
                            "priority": "0",
                            "isFeaturedProduct": "0",
                            "minecraftStatus": "0",
                            "minecraftTitle": "",
                            "minecraftDescription": "",
                            "minecraftItem": "default",
                            "isActive": "1",
                            "creationDate": "2022-09-15 19:16:39"
                        }
                    ]
                }
            ],
            "products": []
        }
    ]
}
```

{% endtab %}
{% endtabs %}


# Products

## Get all products

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/store/products`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    []
}
```

{% endtab %}
{% endtabs %}

## Get a product

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/store/products/<id>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    []
}
```

{% endtab %}
{% endtabs %}


# Categories

## Get all categories

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/store/categories`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    []
}
```

{% endtab %}
{% endtabs %}

## Get a category

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/store/categories/<id>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    []
}
```

{% endtab %}
{% endtabs %}


# Buy

## Buy action

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/store/buy`

#### Request Body

| Name                                       | Type  | Description             |
| ------------------------------------------ | ----- | ----------------------- |
| products<mark style="color:red;">\*</mark> | array | An array of product IDs |
| userID<mark style="color:red;">\*</mark>   | int   | User ID                 |

{% tabs %}
{% tab title="201: Created " %}

```json
{
    "status": true,
    "orderID": "123",
    "credits": "10.00",
    "products": [
        {
            "id": 1,
            "quantity": 1,
            "variables": []
        }
    ],
    "cashback": "1.00",
    "total": "10.00",
    "subtotal": "10.00",
    "discount": "0.00"
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}

{% tab title="404: Not Found Product not found" %}

```json
{
    "status": false,
    "error": "PRODUCT_NOT_FOUND",
    "message": "Product not found!"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid quantity" %}

```json
{
    "status": false,
    "error": "INVALID_QUANTITY",
    "message": "Invalid quantity!"
}
```

{% endtab %}

{% tab title="400: Bad Request Insufficient balance" %}

```json
{
    "status": false,
    "error": "INSUFFICIENT_BALANCE",
    "message": "Insufficient balance!"
}
```

{% endtab %}

{% tab title="400: Bad Request Out of stock" %}

```json
{
    "status": false,
    "error": "OUT_OF_STOCK",
    "message": "Out of stock!"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid Variable" %}

```json
{
    "status": false,
    "error": "INVALID_VARIABLE",
    "message": "Invalid variable provided for product ID: 1"
}
```

{% endtab %}
{% endtabs %}


# Donations

## Get donations.

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/store/donations`

#### Query Parameters

| Name                                   | Type    | Description                                                               |
| -------------------------------------- | ------- | ------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark> | String  | Values: "top-alltime", "top-annual", "top-monthly", "top-daily", "latest" |
| limit                                  | Integer |                                                                           |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "display_name": "LeaderOS",
        "username": "leaderos",
        "total": "5.00 GBP",
        "raw_total": "5.00",
        "currency": "GBP",
        "date": "2023-09-13 23:35:12"
    },
    {
        "display_name": "Geyik",
        "username": "geyik",
        "total": "15.00 GBP",
        "raw_total": "15.00",
        "currency": "GBP",
        "date": "2023-10-13 23:35:12"
    }
]
```

{% endtab %}

{% tab title="400: Bad Request Invalid type" %}

```json
{
    "status": false,
    "error": "INVALID_TYPE",
    "message": "Invalid type!"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid limit" %}

```json
{
    "status": false,
    "error": "INVALID_LIMIT",
    "message": "Invalid limit!"
}
```

{% endtab %}
{% endtabs %}


# Bazaar


# Player Storages

## Get user items storage

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/bazaar/storages/<user_id>/items`

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "4",
        "owner": "1",
        "serverID": "3",
        "itemID": "ENCHANTING_TABLE",
        "modelID": null,
        "name": "Enchanting Table",
        "lore": null,
        "amount": "1",
        "durability": "1",
        "maxDurability": "0",
        "enchantments": null,
        "base64": "rO0ABXNyABpvcmcuYnVra2l0LnV0aWwuaW8uV3JhcHBlcvJQR+zxEm8FAgABTAADbWFwdAAPTGph\r\ndmEvdXRpbC9NYXA7eHBzcgA1Y29tLmdvb2dsZS5jb21tb24uY29sbGVjdC5JbW11dGFibGVNYXAk\r\nU2VyaWFsaXplZEZvcm0AAAAAAAAAAAIAAlsABGtleXN0ABNbTGphdmEvbGFuZy9PYmplY3Q7WwAG\r\ndmFsdWVzcQB+AAR4cHVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAJ0AAI9\r\nPXQABHR5cGV1cQB+AAYAAAACdAAeb3JnLmJ1a2tpdC5pbnZlbnRvcnkuSXRlbVN0YWNrdAARRU5D\r\nSEFOVE1FTlRfVEFCTEU=\r\n",
        "description": null,
        "price": "0.00",
        "sold": "0",
        "creationDate": "2022-08-24 00:15:03"
    },
    {
        "id": "5",
        "owner": "1",
        "serverID": "3",
        "itemID": "BOOKSHELF",
        "modelID": null,
        "name": "Bookshelf",
        "lore": null,
        "amount": "32",
        "durability": "1",
        "maxDurability": "0",
        "enchantments": null,
        "base64": "rO0ABXNyABpvcmcuYnVra2l0LnV0aWwuaW8uV3JhcHBlcvJQR+zxEm8FAgABTAADbWFwdAAPTGph\r\ndmEvdXRpbC9NYXA7eHBzcgA1Y29tLmdvb2dsZS5jb21tb24uY29sbGVjdC5JbW11dGFibGVNYXAk\r\nU2VyaWFsaXplZEZvcm0AAAAAAAAAAAIAAlsABGtleXN0ABNbTGphdmEvbGFuZy9PYmplY3Q7WwAG\r\ndmFsdWVzcQB+AAR4cHVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAI9\r\nPXQABHR5cGV0AAZhbW91bnR1cQB+AAYAAAADdAAeb3JnLmJ1a2tpdC5pbnZlbnRvcnkuSXRlbVN0\r\nYWNrdAAJQk9PS1NIRUxGc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhy\r\nABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAACA=\r\n",
        "description": null,
        "price": "0.00",
        "sold": "0",
        "creationDate": "2022-08-24 00:17:37"
    }
]
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}

## Add items to user storage

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/bazaar/storages/<user_id>/items`

#### Request Body

| Name                                            | Type    | Description |
| ----------------------------------------------- | ------- | ----------- |
| serverID<mark style="color:red;">\*</mark>      | int     |             |
| itemID<mark style="color:red;">\*</mark>        | numeric |             |
| modelID                                         | numeric |             |
| name                                            | string  |             |
| lore                                            | string  |             |
| amount<mark style="color:red;">\*</mark>        | numeric |             |
| durability<mark style="color:red;">\*</mark>    | numeric |             |
| maxDurability<mark style="color:red;">\*</mark> | numeric |             |
| enchantments                                    | string  |             |
| base64<mark style="color:red;">\*</mark>        | string  |             |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "success": true
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}

{% tab title="400: Bad Request Error while inserting data" %}

```json
{
    "status": false,
    "error": "INSERT_ERROR",
    "message": "Error while inserting data!"
}
```

{% endtab %}
{% endtabs %}

## Remove items to user storage

<mark style="color:red;">`DELETE`</mark> `https://yourwebsite.com/api/bazaar/storages/<user_id>/items/<id>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "success": true
}
```

{% endtab %}

{% tab title="400: Bad Request Error while deleting data" %}

```json
{
    "status": false,
    "error": "DELETE_ERROR",
    "message": "Error while deleting data!"
}
```

{% endtab %}
{% endtabs %}


# Servers

## Get all bazaar servers

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/bazaar/servers`

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "1",
        "name": "VIP",
        "slug": "vip",
        "imageID": "ed1879ac89e4d8c7520c4f80f2eeef4c",
        "imageType": "png",
        "priority": "99",
        "isActive": "1"
    },
    {
        "id": "2",
        "name": "Factions",
        "slug": "factions",
        "imageID": "017d66002f01317c7e0472b058341024",
        "imageType": "jpg",
        "priority": "0",
        "isActive": "1"
    },
    {
        "id": "3",
        "name": "Skyblock",
        "slug": "skyblock",
        "imageID": "f10f36b11daa41450d0c379aa0b581eb",
        "imageType": "jpg",
        "priority": "0",
        "isActive": "1"
    },
    {
        "id": "4",
        "name": "Survival",
        "slug": "survival",
        "imageID": "f808c7b6af70367788784006699795f9",
        "imageType": "jpg",
        "priority": "0",
        "isActive": "1"
    }
]
```

{% endtab %}
{% endtabs %}


# Support


# Tickets

## Get tickets

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/support/tickets`

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "1",
        "accountID": "1",
        "categoryID": "3",
        "title": "I need help!",
        "statusID": "2",
        "readStatus": "1",
        "updateDate": "2022-09-15 10:54:46",
        "creationDate": "2022-09-15 10:51:02",
        "categoryName": "Other",
        "messages": [
            {
                "id": "3",
                "accountID": "1",
                "message": "please **help** me!",
                "writeLocation": "1",
                "creationDate": "2022-09-15 10:53:46"
            },
            {
                "id": "4",
                "accountID": "3",
                "message": "<p><strong>How can I help you?</strong></p>",
                "writeLocation": "2",
                "creationDate": "2022-09-15 10:54:46"
            }
        ]
    },
    {
        "id": "2",
        "accountID": "1",
        "categoryID": "1",
        "title": "Cheater report!",
        "statusID": "2",
        "readStatus": "1",
        "updateDate": "2022-09-15 10:54:27",
        "creationDate": "2022-09-15 10:52:07",
        "categoryName": "Cheat",
        "messages": [
            {
                "id": "1",
                "accountID": "1",
                "message": "please **help** me!",
                "writeLocation": "1",
                "creationDate": "2022-09-15 10:53:27"
            },
            {
                "id": "2",
                "accountID": "3",
                "message": "<p>thanks banned!</p>",
                "writeLocation": "2",
                "creationDate": "2022-09-15 10:54:27"
            }
        ]
    }
]
```

{% endtab %}
{% endtabs %}

## Get a ticket

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/support/tickets/<id>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "id": "6",
    "accountID": "1",
    "categoryID": "1",
    "title": "Deneme Başlık!2",
    "statusID": "1",
    "readStatus": "0",
    "updateDate": "2023-07-19 20:13:37",
    "creationDate": "2023-07-19 20:13:37",
    "category": {
        "id": "1",
        "name": "Cheat"
    },
    "messages": [
        {
            "id": "6",
            "accountID": "1",
            "message": "Merhaba deneme içerikkk2",
            "writeLocation": "1",
            "creationDate": "2023-07-19 20:13:37"
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Ticket not found" %}

```json
{
    "status": false,
    "error": "TICKET_NOT_FOUND",
    "message": "Ticket not found!"
}
```

{% endtab %}
{% endtabs %}

## Create ticket

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/support/tickets/<id>`

#### Request Body

| Name                                         | Type   | Description                                                                                                                                                      |
| -------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| accountID<mark style="color:red;">\*</mark>  | String |                                                                                                                                                                  |
| categoryID<mark style="color:red;">\*</mark> | String |                                                                                                                                                                  |
| title<mark style="color:red;">\*</mark>      | String |                                                                                                                                                                  |
| message<mark style="color:red;">\*</mark>    | String |                                                                                                                                                                  |
| statusID                                     | String | <p>Default: 1 (Open)</p><p><strong>1:</strong> Open</p><p><strong>2:</strong> Answered</p><p><strong>3:</strong> User-Reply</p><p><strong>4:</strong> Closed</p> |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "success": true,
    "data": {
        "id": "6"
    }
}
```

{% endtab %}
{% endtabs %}

## Close ticket

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/support/tickets/<id>/close`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "success": true,
    "data": {
        "id": "6"
    }
}
```

{% endtab %}

{% tab title="404: Not Found Ticket not found" %}

```json
{
    "status": false,
    "error": "TICKET_NOT_FOUND",
    "message": "Ticket not found!"
}
```

{% endtab %}
{% endtabs %}


# Messages

## Get all messages of a ticket

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/support/tickets/<ticket-id>/messages`

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "1",
        "accountID": "1",
        "supportID": "2",
        "message": "please **help** me!",
        "writeLocation": "1",
        "creationDate": "2022-09-15 10:53:27"
    },
    {
        "id": "2",
        "accountID": "3",
        "supportID": "2",
        "message": "<p>thanks banned!</p>",
        "writeLocation": "2",
        "creationDate": "2022-09-15 10:54:27"
    },
    {
        "id": "7",
        "accountID": "1",
        "supportID": "2",
        "message": "Merhaba deneme içerikkk2",
        "writeLocation": "2",
        "creationDate": "2023-07-19 20:32:34"
    },
    {
        "id": "8",
        "accountID": "1",
        "supportID": "2",
        "message": "Merhaba deneme içerikkk2",
        "writeLocation": "2",
        "creationDate": "2023-07-19 20:32:54"
    },
    {
        "id": "9",
        "accountID": "1",
        "supportID": "2",
        "message": "Merhaba deneme içerikkk2",
        "writeLocation": "2",
        "creationDate": "2023-07-19 20:34:34"
    }
]
```

{% endtab %}
{% endtabs %}

## Get a message of a ticket

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/support/tickets/<ticket-id>/messages/<id>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "id": "9",
    "accountID": "1",
    "supportID": "2",
    "message": "Merhaba deneme içerikkk2",
    "writeLocation": "2",
    "creationDate": "2023-07-19 20:34:34"
}
```

{% endtab %}
{% endtabs %}

## Add messages to tickets

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/support/tickets/<ticket-id>/messages`

#### Path Parameters

| Name      | Type    | Description |
| --------- | ------- | ----------- |
| ticket-id | integer |             |

#### Request Body

| Name                                      | Type    | Description    |
| ----------------------------------------- | ------- | -------------- |
| message<mark style="color:red;">\*</mark> | String  |                |
| accountID                                 | String  |                |
| isAdmin                                   | boolean | Default: false |
| discordUserID                             | String  |                |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "success": true,
    "data": {
        "id": "9"
    }
}
```

{% endtab %}
{% endtabs %}


# Categories

## Get all categories

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/support/categories`

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "1",
        "name": "Cheat"
    },
    {
        "id": "2",
        "name": "Payment"
    },
    {
        "id": "3",
        "name": "Other"
    }
]
```

{% endtab %}
{% endtabs %}

## Get a category

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/support/categories/<id>`

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "1",
        "name": "Cheat"
    }
]
```

{% endtab %}
{% endtabs %}


# Quick Answers

## Get all quick answers

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/store/answers`

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "1",
        "title": "hello",
        "content": "<p><strong>How can I help you?</strong></p>"
    },
    {
        "id": "2",
        "title": "test",
        "content": "Test message!"
    }
]
```

{% endtab %}
{% endtabs %}

## Get a category

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/support/answers/<id>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "id": "1",
    "title": "hello",
    "content": "<p><strong>How can I help you?</strong></p>"
}
```

{% endtab %}
{% endtabs %}


# Credits


# Show Credits

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/credits?username=<username>`

{% tabs %}
{% tab title="200: OK Successful login" %}

```json
{
    "credits": "10.25 USD",
    "raw_credits": 10.25,
    "currency": "USD"
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}


# Add Credits

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/credits/add`

#### Request Body

| Name                                               | Type    | Description |
| -------------------------------------------------- | ------- | ----------- |
| target\_username<mark style="color:red;">\*</mark> | string  |             |
| amount<mark style="color:red;">\*</mark>           | decimal |             |

{% tabs %}
{% tab title="200: OK Successful login" %}

```json
{
    "current_credits": "10.25 USD",
    "current_raw_credits": 10.25,
    "currency": "USD"
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid amount" %}

```json
{
    "status": false,
    "error": "INVALID_AMOUNT",
    "message": "You can't send less than 0.01!"
}
```

{% endtab %}
{% endtabs %}


# Remove Credits

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/credits/remove`

#### Request Body

| Name                                               | Type    | Description |
| -------------------------------------------------- | ------- | ----------- |
| target\_username<mark style="color:red;">\*</mark> | string  |             |
| amount<mark style="color:red;">\*</mark>           | decimal |             |

{% tabs %}
{% tab title="200: OK Successful login" %}

```json
{
    "current_credits": "10.25 USD",
    "current_raw_credits": 10.25,
    "currency": "USD"
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid amount" %}

```json
{
    "status": false,
    "error": "INVALID_AMOUNT",
    "message": "You can't send less than 0.01!"
}
```

{% endtab %}

{% tab title="400: Bad Request Not enough credits" %}

```json
{
    "status": false,
    "error": "NOT_ENOUGH_CREDITS",
    "message": "This user doesn't have enough credits to remove this amount!"
}
```

{% endtab %}
{% endtabs %}


# Send Credits

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/credits/send`

#### Request Body

| Name                                               | Type    | Description |
| -------------------------------------------------- | ------- | ----------- |
| sender\_username<mark style="color:red;">\*</mark> | string  |             |
| target\_username<mark style="color:red;">\*</mark> | string  |             |
| amount<mark style="color:red;">\*</mark>           | decimal |             |

{% tabs %}
{% tab title="200: OK Successful login" %}

```json
{
    "current_credits": "8.25 USD",
    "current_raw_credits": 8.25,
    "target_current_credits": "2.25 USD",
    "target_current_raw_credits": 2.25,
    "currency": "USD"
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}

{% tab title="404: Not Found Target user not found" %}

```json
{
    "status": false,
    "error": "TARGET_USER_NOT_FOUND",
    "message": "Target user not found!"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid target" %}

```json
{
    "status": false,
    "error": "INVALID_TARGET",
    "message": "You can't send credits to yourself!"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid amount" %}

```json
{
    "status": false,
    "error": "INVALID_AMOUNT",
    "message": "You can't send less than 0.01!"
}
```

{% endtab %}

{% tab title="400: Bad Request Not enough credits" %}

```json
{
    "status": false,
    "error": "NOT_ENOUGH_CREDITS",
    "message": "This user doesn't have enough credits to remove this amount!"
}
```

{% endtab %}
{% endtabs %}


# Set Credits

<mark style="color:green;">`POST`</mark> `https://yourwebsite.com/api/credits/<user>/set`

#### Request Body

| Name                                               | Type    | Description |
| -------------------------------------------------- | ------- | ----------- |
| target\_username<mark style="color:red;">\*</mark> | string  |             |
| amount<mark style="color:red;">\*</mark>           | decimal |             |

{% tabs %}
{% tab title="200: OK Successful login" %}

```json
{
    "current_credits": "10.25 USD",
    "current_raw_credits": 10.25,
    "currency": "USD"
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid amount" %}

```json
{
    "status": false,
    "error": "INVALID_AMOUNT",
    "message": "You can't set less than 0!"
}
```

{% endtab %}
{% endtabs %}


# Vote


# Vote Links

## Get all vote links

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/vote-links`

#### Path Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| username | string |             |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "1",
        "name": "Minecraft-MP",
        "link": "https://minecraft-mp.com/server/176829/vote/"
    },
    {
        "id": "2",
        "name": "TOPG",
        "link": "https://topg.org/minecraft-servers/server-501736"
    },
    {
        "id": "3",
        "name": "Minecraft Servers",
        "link": "https://minecraftservers.org/vote/496466"
    },
    {
        "id": "4",
        "name": "TopMinecraftServers",
        "link": "https://topminecraftservers.org/vote/18742"
    }
]
```

{% endtab %}
{% endtabs %}


# Discord


# Users

## Get user by Discord user id

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/integrations/discord/users/<discord-user-id>`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "id": "1",
    "username": "demo",
    "realname": "demo",
    "email": "demo@gmail.com",
    "credit": "350.00",
    "avatar": "https://minotar.net/helm/LeaderOS/128.png",
    "isVerified": "1",
    "authStatus": "0",
    "creationIP": "1.1.1.1",
    "creationDate": "2022-09-15 09:54:08",
    "discordUserID": "477886791769391124",
    "roles": [
        {
            "id": "1",
            "name": "Admin",
            "slug": "admin",
            "discordRoleID": "127886791769391123",
            "expiryDate": "1000-01-01 00:00:00"
        },
        {
            "id": "2",
            "name": "VIP",
            "slug": "vip",
            "discordRoleID": "317886791769391123",
            "expiryDate": "2023-08-30 10:30:45"
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found User not found" %}

```json
{
    "status": false,
    "error": "USER_NOT_FOUND",
    "message": "User not found!"
}
```

{% endtab %}
{% endtabs %}


# Settings

## Get Settings for Discord integration

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/integrations/discord/settings`

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "roleSyncingStatus": true,
    "syncedRoleID": "1131621997231743046",
    "ticketStatus": true,
    "ticketCategoryID": "1148224808119701576",
    "ticketStaffRoleIDs": [
        "1148268311889575976"
    ]
}
```

{% endtab %}
{% endtabs %}


# Roles

## Get Roles for Discord integration

<mark style="color:blue;">`GET`</mark> `https://yourwebsite.com/api/integrations/discord/roles`

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "id": "2",
        "name": "Admin",
        "slug": "admin",
        "usernameCSS": null,
        "badgeCSS": null,
        "priority": "99",
        "discordRoleID": "1148268003478224926"
    },
    {
        "id": "3",
        "name": "Support",
        "slug": "support",
        "usernameCSS": null,
        "badgeCSS": null,
        "priority": "98",
        "discordRoleID": "1148268311889575976"
    }
]
```

{% endtab %}
{% endtabs %}


