> For the complete documentation index, see [llms.txt](https://cosmo.atomatrix.gg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cosmo.atomatrix.gg/api/endpoints.md).

# Endpoints

The Documentation shown below will always be for the latest version of the Cosmo API Addon.

Replace `example.com` with your server's IP or FQDN.

## User

### User Information

## Get information about a user.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/users/info`

Retrieve information about any user.

This endpoint can be used by the specific user's API Key or the Admin Key.

#### Path Parameters

| Name                                 | Type   | Description                                                      |
| ------------------------------------ | ------ | ---------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | String | Either a Discord ID or a Minecraft UUID to fetch information on. |

{% tabs %}
{% tab title="200: OK SUCCESS" %}
Example Response:

```json
{
    "discord_id": "490537526436560896",
    "uuid": "2aaf1cc8c6a14ae98d973b9f07f8ff3a",
    "credits": 5624,
    "cosmetics": {
        "equipped": {
            "bandana": null,
            "bodywear": "pEK8nKC4",
            "cloak": null,
            "glasses": null,
            "hat": null,
            "mask": null,
            "pet": null,
            "shoes": null,
            "wings": null
        },
        "locker": [
            "pEK8nKC4",
            "2uOb7Kt5"
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## Get a user's transactions.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/users/transactions`

Retrieve a list of a user's transactions and items bought using the shop.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                 | Type   | Description                                                      |
| ------------------------------------ | ------ | ---------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | String | Either a Discord ID or a Minecraft UUID to fetch information on. |

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

```json
{
    "discord_id": "490537526436560896",
    "uuid": "2aaf1cc8c6a14ae98d973b9f07f8ff3a"
    "transactions": [
        {
            "cosmeticId": "pEK8nKC4",
            "cost": 100,
            "timestamp": 1686515025
        },
        {
            "cosmeticId": "2uOb7Kt5",
            "cost": 300,
            "timestamp": 1686515798
        }
    ],
}
```

{% endtab %}
{% endtabs %}

## Get all linked accounts and UUID's.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/users/list`

Retrieve an array of all the linked accounts and which Minecraft UUID it is linked to.

This endpoint can be used by the Admin Key only.

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

```json
{
    "447076198762151937": "70c8e04f35a942dabe5cc16af8058a8a",
    "490537526436560896": "2aaf1cc8c6a14ae98d973b9f07f8ff3a"
}
```

{% endtab %}
{% endtabs %}

### Account Linking

## Link a Minecraft Account to a Discord Account.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/users/link`

Bind a Minecraft account to a Discord Account by listing the two IDs.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                                  | Type   | Description                                   |
| ----------------------------------------------------- | ------ | --------------------------------------------- |
| discordid<mark style="color:red;">\*</mark>           | String | The user's Discord ID that you wish to link.  |
| minecraft\_username<mark style="color:red;">\*</mark> | String | The Minecraft Username that you wish to link. |

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

```json
{"linked": True}
```

{% endtab %}
{% endtabs %}

## Unlink a Minecraft Account from a Discord Account.

<mark style="color:red;">`DELETE`</mark> `http://example.com/api/v1/users/unlink`

Unlink a Discord Account from a Minecraft Account or vice-versa.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                 | Type   | Description                                        |
| ------------------------------------ | ------ | -------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | String | Either a Discord ID or a Minecraft UUID to unlink. |

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

```json
{"unlinked": True}
```

{% endtab %}
{% endtabs %}

## Cosmetics

### Cosmetic Information

## List all cosmetics.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/cosmetics/list`

Retrieve a list of all the cosmetics the bot has. This is not an endpoint for the shop (which shows buyable cosmetics).

This endpoint can be used by any user API Key or the Admin Key.

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

```json
[
    {
        "categoryId": "eIH69Ue4",
        "cost": 125,
        "description": "Turn into an enderman!",
        "id": "AIr77hfh",
        "name": "Enderman",
        "showcaseImage": "https://i.imgur.com/abcdef",
        "type": "cloak"
    },
    {
        "categoryId": "eIH69Ue4",
        "cost": 150,
        "description": "Happy birthday to you!",
        "id": "AgsoNWHI",
        "name": "Birthday Cape!",
        "showcaseImage": "https://i.imgur.com/123456",
        "type": "cloak"
    }
]
```

{% endtab %}
{% endtabs %}

## List all buyable cosmetics from the shop.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/cosmetics/shop`

Retries a list of all the cosmetics in the shop.

This endpoint can be used by any user API Key or the Admin Key.

{% tabs %}
{% tab title="200: OK SUCCESS" %}
put example here
{% endtab %}
{% endtabs %}

### Modifying Cosmetics

## Create a cosmetic.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/cosmetics/create`

Create/upload a cosmetic or cloak to Cosmo. **There is no error handling for incorrect image and file URLs.**

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                                   | Type   | Description                                                                                                                                                                        |
| ------------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name<mark style="color:red;">\*</mark>                 | String | The display name for the cosmetic.                                                                                                                                                 |
| type<mark style="color:red;">\*</mark>                 | String | The type of cosmetic. Accepted types: cloak, wings, pet, hat, bodywear, bandana, mask, shoes, glasses.                                                                             |
| description<mark style="color:red;">\*</mark>          | String | The description for the cosmetic.                                                                                                                                                  |
| categoryid<mark style="color:red;">\*</mark>           | String | The category ID for the cosmetic to be in.                                                                                                                                         |
| cost<mark style="color:red;">\*</mark>                 | String | The cost of the cosmetic, given as an integer. The value type is parsed as a string, then converted to an integer. To make the cosmetic unavailable for purchase, set this to "0". |
| showcase\_image\_url<mark style="color:red;">\*</mark> | String | <p>A direct image URL to the showcase image of the cosmetic.</p><p><strong>Suggested formats:</strong> .png, .jpeg, .jpg</p>                                                       |
| model\_source\_url<mark style="color:red;">\*</mark>   | String | <p>A direct URL to the CFG of the cosmetic model. <strong>Not required for "cloak" type cosmetics.</strong></p><p><strong>Required format:</strong> .cfg</p>                       |
| texture\_source\_url<mark style="color:red;">\*</mark> | String | <p>A direct image URL to the texture of the cosmetic.</p><p><strong>Required format:</strong> .png</p>                                                                             |

{% tabs %}
{% tab title="200: OK SUCCESS" %}
put response here
{% endtab %}
{% endtabs %}

## Edit a cosmetic

<mark style="color:purple;">`PATCH`</mark> `http://example.com/api/v1/cosmetics/update`

Edit a cosmetic's details.

Apart from "original\_name" all other values are optional, but one must be chosen to actually edit. You can edit any amount of values with one request.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                             | Type   | Description                                                                                                                                          |
| ------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| original\_name<mark style="color:red;">\*</mark> | String | The original name of the cosmetic you wish to edit                                                                                                   |
| name                                             | String | The new display name for the cosmetic.                                                                                                               |
| type                                             | String | <p>The new type for the cosmetic. Accepted types: wings, pet, hat, bodywear, bandana, mask, shoes, glasses.</p><p>Cloak types cannot be changed.</p> |
| description                                      | String | The new description for the cosmetic.                                                                                                                |
| categoryid                                       | String | The new category ID for the cosmetic to be in.                                                                                                       |
| cost                                             | String | The new cost of the cosmetic, given as an integer. The value type is parsed as a string, then converted to an integer.                               |
| showcase\_image\_url                             | String | The new direct image URL to the showcase image of the cosmetic.                                                                                      |
| model\_source\_url                               | String | The new direct URL to the CFG of the cosmetic model. Not required for "cloak" type cosmetics.                                                        |
| texture\_source\_url                             | String | The new direct image URL to the texture of the cosmetic.                                                                                             |

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

```json
{"edited": true}
```

{% endtab %}
{% endtabs %}

## Delete a cosmetic.

<mark style="color:red;">`DELETE`</mark> `http://example.com/api/v1/cosmetics/delete`

Delete a cosmetic from the bot.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                       | Type   | Description                                                    |
| ------------------------------------------ | ------ | -------------------------------------------------------------- |
| cosmetic<mark style="color:red;">\*</mark> | String | The cosmetic's name for the one that you would like to delete. |

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

```json
{"deleted": true}
```

{% endtab %}
{% endtabs %}

### Cosmetic Ownership

## Purchase a cosmetic.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/cosmetics/buy`

Purchase a cosmetic from the shop.

This endpoint can be used by the specific user's API Key or the Admin Key.

#### Path Parameters

| Name                                         | Type   | Description                                                                                                                                         |
| -------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>         | String | Either a Discord ID or a Minecraft UUID to buy the cosmetic on. If this request is being issued from a user key, the ID MUST reflect their account. |
| cosmeticid<mark style="color:red;">\*</mark> | String | The ID of the cosmetic they wish to purchase.                                                                                                       |

{% tabs %}
{% tab title="200: OK SUCCESS" %}
ex resp
{% endtab %}
{% endtabs %}

## Grant a cosmetic.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/cosmetics/grant`

Force grant a cosmetic to a user.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                         | Type   | Description                                                       |
| -------------------------------------------- | ------ | ----------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>         | String | Either a Discord ID or a Minecraft UUID to grant the cosmetic to. |
| cosmeticid<mark style="color:red;">\*</mark> | String | The ID of the cosmetic to grant.                                  |

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

<pre class="language-json"><code class="lang-json"><strong>{"granted": True}
</strong></code></pre>

{% endtab %}
{% endtabs %}

## Revoke a cosmetic.

<mark style="color:red;">`DELETE`</mark> `/cosmetics/revoke`

Force remove a cosmetic from a user.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                         | Type   | Description                                                       |
| -------------------------------------------- | ------ | ----------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>         | String | Either a Discord ID or a Minecraft UUID to grant the cosmetic to. |
| cosmeticid<mark style="color:red;">\*</mark> | String | The ID of the cosmetic to grant.                                  |

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

```json
{"revoked": True}
```

{% endtab %}
{% endtabs %}

### Equipping/Unequipping

## Equip a cosmetic.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/cosmetics/equip`

Equip a cosmetic for a user, or on your own account.

This endpoint can be used by the specific user's API Key or the Admin Key.

#### Path Parameters

| Name                                           | Type   | Description                                                                                                                                           |
| ---------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>           | String | Either a Discord ID or a Minecraft UUID to equip the cosmetic on. If this request is being issued from a user key, the ID MUST reflect their account. |
| cosmetictype<mark style="color:red;">\*</mark> | String | The type of cosmetic to equip. Accepted types: cloak, wings, pet, hat, bodywear, bandana, mask, shoes, glasses.                                       |
| cosmeticid<mark style="color:red;">\*</mark>   | String | The cosmetic ID to equip.                                                                                                                             |

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

```json
{"equipped": True}
```

{% endtab %}
{% endtabs %}

## Unequip a cosmetic.

<mark style="color:red;">`DELETE`</mark> `http://example.com/api/v1/cosmetics/unequip`

Unequip a cosmetic for a user, or on your own account.

This endpoint can be used by the specific user's API Key or the Admin Key.

#### Path Parameters

| Name                                           | Type   | Description                                                                                                                                               |
| ---------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>           | String | Either a Discord ID or a Minecraft UUID to unequip the cosmetic from. If this request is being issued from a user key, the ID MUST reflect their account. |
| cosmetictype<mark style="color:red;">\*</mark> | String | The type of cosmetic to unequip. Accepted types: cloak, wings, pet, hat, bodywear, bandana, mask, shoes, glasses.                                         |

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

```json
{"unequipped": True}
```

{% endtab %}
{% endtabs %}

## Categories

### Category Information

## List all categories.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/categories/list`

Retrieve a list of all cosmetic categories with their name & ID.

This endpoint can be used by any user API Key or the Admin Key.

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

```json
[
    {
        "id": "eIH69Ue4",
        "name": "Lightning Set"
    },
    {
        "id": "F1wHozEL",
        "name": "Fluffy Series"
    }
]
```

{% endtab %}
{% endtabs %}

### Modifying Categories

## Create a new category.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/categories/create`

Create a new category in the bot.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                   | Type   | Description                            |
| -------------------------------------- | ------ | -------------------------------------- |
| name<mark style="color:red;">\*</mark> | String | The display name for the new category. |

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

```json
{
    "id": "kI80vjRP",
    "name": "Lightning Bundle"
}
```

{% endtab %}
{% endtabs %}

## Rename a category.

<mark style="color:purple;">`PATCH`</mark> `http://example.com/api/v1/categories/rename`

Update a category name.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                        | Type   | Description                    |
| ------------------------------------------- | ------ | ------------------------------ |
| old\_name<mark style="color:red;">\*</mark> | String | The old name of the category.  |
| new\_name<mark style="color:red;">\*</mark> | String | The new name for the category. |

{% tabs %}
{% tab title="200: OK SUCCESS" %}
Returns the new data for the category.

```json
{
    "id": "kI80vjRP",
    "name": "Mushroom Bundle"
}
```

{% endtab %}
{% endtabs %}

## Delete a category.

<mark style="color:red;">`DELETE`</mark> `http://example.com/api/v1/categories/delete`

Delete a category from the bot.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                           | Type   | Description                       |
| ---------------------------------------------- | ------ | --------------------------------- |
| category\_id<mark style="color:red;">\*</mark> | String | The ID of the category to delete. |

{% tabs %}
{% tab title="200: OK SUCCESS" %}
Example response
{% endtab %}
{% endtabs %}

## Credits

### Fetching Credits

{% hint style="info" %}
The user's credits can be fetched using the `/users/info` endpoint.
{% endhint %}

### Modifying Credits

## Modify a user's credit amount.

<mark style="color:purple;">`PATCH`</mark> `http://example.com/api/v1/credits/modify`

Adjust a user's credit amount by a certain amount.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                     | Type   | Description                                                               |
| ---------------------------------------- | ------ | ------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>     | String | Either a Discord ID or a Minecraft UUID to fetch information on.          |
| amount<mark style="color:red;">\*</mark> | String | <p>Amount to modify the credits by.</p><p>Example: "-5", "60", "-100"</p> |

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

```json
{"credits": 660} // Shows the users new amount of credits.
```

{% endtab %}
{% endtabs %}

## Set a user's credit amount.

<mark style="color:purple;">`PATCH`</mark> `http://example.com/api/v1/credits/set`

Update a user's credit amount by defining a new amount. If you wish to add or remove credits from a user, you should use the "modify" endpoint.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                          | Type   | Description                                                      |
| --------------------------------------------- | ------ | ---------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>          | String | Either a Discord ID or a Minecraft UUID to fetch information on. |
| new\_amount<mark style="color:red;">\*</mark> | String | A number giving the new amount of credits for the user.          |

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

```json
{"credits": 560} // Shows the users new amount of credits.
```

{% endtab %}
{% endtabs %}

## Coupons

### Coupon Information

## List all coupon codes.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/coupons/list`

Retrieve a list of every coupon code in the bot. Active or inactive.

This endpoint can be used by the Admin Key only.

{% tabs %}
{% tab title="200: OK SUCCESS" %}
Example response
{% endtab %}
{% endtabs %}

### Modifying Coupons

## Create a coupon code.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/coupons/create`

Create a coupon code to add to the bot.

One of the "credit\_grant" and "cosmetic\_grant" parameters is required, or both can be used. The request will fail if none is provided.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                   | Type    | Description                                                                                                                                                         |
| -------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| code<mark style="color:red;">\*</mark> | String  | The name / code for the coupon code.                                                                                                                                |
| active                                 | Boolean | Set to False to set the coupon to not be active (can't be used). If not specified or the input is incorrect, the coupon will be active.                             |
| uses                                   | Integer | Amount of uses the coupon should have. If not specified or the input is incorrect, the coupon will have unlimited uses                                              |
| expires                                | Integer | A unix timestamp for when the coupon should expire. If not specified or the input is incorrect, the coupon will have no expiry.                                     |
| day\_limit                             | Integer | The maximum amount of days a user can be in the server to redeem the coupon code. If not specified or the input is incorrect, the coupon will not have a day limit. |
| credit\_grant                          | Integer | The amount of credits to grant to the user apon redemption. If not specified or the input is incorrect, the coupon will not grant any credits.                      |
| cosmetic\_grant                        | String  | The cosmetic's ID to grant to the user apon redemption. If not specified or the input is incorrect, the coupon will not grant any cosmetics.                        |

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

```json
{"created": true}
```

{% endtab %}
{% endtabs %}

## Update a coupon code.

<mark style="color:purple;">`PATCH`</mark> `http://example.com/api/v1/coupons/edit`

Edit a coupon code's details.

Apart from "original\_name", all other values are optional, but one must be chosen to actually edit. You can edit any amount of values with one request.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                             | Type   | Description                                                                                                                                                             |
| ------------------------------------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| original\_code<mark style="color:red;">\*</mark> | String | The original name of the coupon you wish to edit                                                                                                                        |
| code                                             | String | The new name / code for the coupon code.                                                                                                                                |
| active                                           | String | Set to False to set the coupon to not be active (can't be used). If not specified or the input is incorrect, the coupon will be active.                                 |
| uses                                             | String | The new amount of uses the coupon should have. If not specified or the input is incorrect, the coupon will have unlimited uses                                          |
| expires                                          | String | The new unix timestamp for when the coupon should expire. If not specified or the input is incorrect, the coupon will have no expiry.                                   |
| day\_limit                                       | String | The new maximum amount of days a user can be in the server to redeem the coupon code. If not specified or the input is incorrect, the coupon will not have a day limit. |
| credit\_grant                                    | String | The new amount of credits to grant to the user apon redemption. If not specified or the input is incorrect, the coupon will not grant any credits.                      |
| cosmetic\_grant                                  | String | The new cosmetic ID to grant to the user apon redemption. If not specified or the input is incorrect, the coupon will not grant any cosmetics.                          |

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

```json
{"edited": true}
```

{% endtab %}
{% endtabs %}

## Delete a coupon code.

<mark style="color:red;">`DELETE`</mark> `http://example.com/api/v1/coupons/delete`

Delete a coupon code from the bot. You should usually deactivate a coupon code if you'd rather it wasn't used anymore so that the coupon's history is saved.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                   | Type   | Description                      |
| -------------------------------------- | ------ | -------------------------------- |
| code<mark style="color:red;">\*</mark> | String | The coupon code / name to delete |

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

<pre class="language-json"><code class="lang-json"><strong>{"deleted": true}
</strong></code></pre>

{% endtab %}
{% endtabs %}

### Redeeming Coupons

## Redeem a coupon code.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/coupons/redeem`

Redeem a coupon code on a user's account.

If a code has a dayLimit set, it cannot be redeemed via the API because it cannot check if the user fits or doesn't fit into that category.

This endpoint can be used by the specific user's API Key or the Admin Key.

#### Path Parameters

| Name                                   | Type   | Description                                                                                                                                           |
| -------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark>   | String | Either a Discord ID or a Minecraft UUID to equip the cosmetic on. If this request is being issued from a user key, the ID MUST reflect their account. |
| code<mark style="color:red;">\*</mark> | String | The code to redeem                                                                                                                                    |

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

```json
{
    "redeemed": True,
    "rewards": {
        "credits": 50,
        "cosmetic": "Butterfly Hat"
    }
}
```

{% endtab %}
{% endtabs %}

## Creator Codes

### Code Information

## List all creator codes.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/creatorcodes/list`

Retrieve a list of every creator code in the bot.

This endpoint can be used by the Admin Key only.

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

```json
[
    {
        "code": "fbr",
        "id": "EFcNT0GE",
        "owner": 447076198762151937,
        "uses": [
            {
                "amount_to_creator": 2,
                "cost": 50,
                "customer": 490537526436560896,
                "item_bought": "AgsoNWHI",
                "timestamp": 1687797660
            }
        ]
    }
]
```

{% endtab %}
{% endtabs %}

## Check if a user is supporting.

<mark style="color:blue;">`GET`</mark> `http://example.com/api/v1/creatorcodes/supporting`

Check if a user is supporting a certain creator.

This endpoint can be used by any user's API Key or the Admin Key.

#### Path Parameters

| Name                                            | Type   | Description                                           |
| ----------------------------------------------- | ------ | ----------------------------------------------------- |
| id<mark style="color:red;">\*</mark>            | String | Either a Discord ID or a Minecraft UUID to check for. |
| creator\_code<mark style="color:red;">\*</mark> | String | The creator code to check if the user is supporting.  |

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

```json
{"supporting": true}
```

{% endtab %}

{% tab title="404: Not Found NOT SUPPORTING" %}

```json
{"supporting": false}
```

{% endtab %}
{% endtabs %}

### Modifying Codes

## Create a creator code.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/creatorcodes/create`

Create a coupon code to add to the bot. WARNING: There is no validation for the Discord ID being correct. Make sure that whatever you code has validation.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                             | Type   | Description                                                                                    |
| ------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------- |
| code<mark style="color:red;">\*</mark>           | String | The code to use as the creator code.                                                           |
| assigned\_user<mark style="color:red;">\*</mark> | String | The DISCORD ID to assign this code to. They will get the designated percentage of the credits. |

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

```json
{"created": true}
```

{% endtab %}
{% endtabs %}

## Update a creator code.

<mark style="color:purple;">`PATCH`</mark> `http://example.com/api/v1/creatorcodes/update`

Update a creator code's name or assigned user. WARNING: There is no validation for the Discord ID being correct. Make sure that whatever you code has validation.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                             | Type   | Description                                                                                            |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------ |
| original\_code<mark style="color:red;">\*</mark> | String | The code's name to edit.                                                                               |
| new\_code                                        | String | The new code's name.                                                                                   |
| new\_owner                                       | String | The NEW DISCORD ID to assign this code to. They will now get the designated percentage of the credits. |

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

```json
{"edited": true}
```

{% endtab %}
{% endtabs %}

## Delete a creator code.

<mark style="color:red;">`DELETE`</mark> `http://example.com/api/v1/creatorcodes/delete`

Delete a creator code from the bot.

This endpoint can be used by the Admin Key only.

#### Path Parameters

| Name                                   | Type   | Description             |
| -------------------------------------- | ------ | ----------------------- |
| code<mark style="color:red;">\*</mark> | String | The code name to delete |

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

```json
{"deleted": true}
```

{% endtab %}
{% endtabs %}

### Setting Codes

## Set a creator code.

<mark style="color:green;">`POST`</mark> `http://example.com/api/v1/creatorcodes/set`

Set a creator code on a user's account. Any purchases that the user makes will then give a percentage (set in the config) of funds to the code's owner.

This endpoint can be used by the specific user's API Key or the Admin Key.

#### Path Parameters

| Name                                   | Type   | Description                                                                                                                                           |
| -------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| code<mark style="color:red;">\*</mark> | String | <p>The code to set.<br>Set to "0" to remove a code from an account.</p>                                                                               |
| id<mark style="color:red;">\*</mark>   | String | Either a Discord ID or a Minecraft UUID to equip the cosmetic on. If this request is being issued from a user key, the ID MUST reflect their account. |

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

```json
{"processed": true}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cosmo.atomatrix.gg/api/endpoints.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
