# API Documentation

If you are using JavaScript I recommend using the [npm package](https://www.npmjs.com/package/lilyweight) instead of the API.\
You can take a look at the Cloudflare Worker source [here](https://github.com/Antonio32A/lilyweight-worker) and the npm package source [here](https://github.com/Antonio32A/lilyweight).

## Get Weight

<mark style="color:blue;">`GET`</mark> `https://lily.antonio32a.com/:player`

Get player's lily weight.&#x20;

#### Path Parameters

| Name | Type   | Description                                 |
| ---- | ------ | ------------------------------------------- |
| id   | string | Either player's Minecraft username or UUID. |

#### Query Parameters

| Name           | Type    | Description                                                                                                                                         |
| -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| key            | string  | Your Hypixel API key.                                                                                                                               |
| returnUsername | boolean | Whether it should return the player's username. This usually requires an extra GET request to Mojang's API so it will be slower. Defaults to false. |

{% tabs %}
{% tab title="200 Successfully fetched player's weight.
This returns the username field if returnsUsername query parameter is set to true." %}
```javascript
{
    "success": true,
    "data": {
        "username": "SirDesco",
        "uuid": "e710ff36fe334c0e8401bda9d24fa121",
        "total": 14447.57066158911,
        "skill": {
            "base": 10346.795817290036,
            "overflow": 173.65681281116142
        },
        "catacombs": {
            "completion": {
                "base": 1232.676833730818,
                "master": 532.7492424907152
            },
            "experience": 1058.0313866996628
        },
        "slayer": 1103.6605685667157
    }
}
```
{% endtab %}

{% tab title="400 Invalid API key or player provided." %}
```
{
    "success": false,
    "error": "Invalid API key or player provided."
}
```
{% endtab %}
{% endtabs %}

