# Fragbots

## Get Fragbots

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

This endpoint returns all online fragbots and their queues.

{% tabs %}
{% tab title="200 Fragbots successfully retrieved." %}

```javascript
[
    {
        "username": "frag1",
        "guildId": "something",
        "queue": [ 
            "user1", 
            "user2"
        ]
    },
    {
        "username": "frag2",
        "guildId": "something",
        "queue": [ 
            "user3", 
            "user5", 
            "user5" 
        ]
    }
]
```

{% endtab %}
{% endtabs %}

## Get Whitelist

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

This endpoint returns all trimmed Minecraft UUIDs of all people who are whitelisted.

{% tabs %}
{% tab title="200 Whitelist successfully retrieved." %}

```javascript
[
    "6c0254d81d9041bdb75fdca14935fd3e",
    "689ff4bbf61e4e0594e01066892b0bbe"
]
```

{% endtab %}
{% endtabs %}

## Get User

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

This endpoint returns your user data.

#### Path Parameters

| Name  | Type   | Description                |
| ----- | ------ | -------------------------- |
| token | string | Your authentication token. |

{% tabs %}
{% tab title="200 User data successfully retreived." %}

```javascript
{
    "success": true,
    "invites": 32,
    "uuid": "6c0254d81d9041bdb75fdca14935fd3e",
    "discord": "166630166825664512"
}
```

{% endtab %}

{% tab title="400 You didn't provide all of the request parameters." %}

```javascript
{
    "success": false
}
```

{% endtab %}

{% tab title="403 Invalid token." %}

```javascript
{
    "success": false,
    "error": "Invalid token."
}
```

{% endtab %}
{% endtabs %}

## Authentication

Authenticating allows you to get a `token` which is used for some of the requests listed above.

## 1. Send Mojang the hash

<mark style="color:green;">`POST`</mark> `https://sessionserver.mojang.com/session/minecraft/join`

This endpoint tells Mojang that you're joining a server, but in our case it's used to confirm the hash.

#### Request Body

| Name            | Type   | Description                                  |
| --------------- | ------ | -------------------------------------------- |
| accessToken     | string | Your Minecraft access token, AKA session ID. |
| selectedProfile | string | Your Minecraft UUID.                         |
| serverId        | string | Randomly generated Minecraft hex digest.     |

{% tabs %}
{% tab title="200 Request was successful, no content." %}

```
```

{% endtab %}
{% endtabs %}

## 2. Send neppy backend the hash

<mark style="color:green;">`POST`</mark> `https://fragbots.antonio32a.com/authenticate`

This endpoint tells neppy backend your username and your hash so it can be verified. This must be sent after the first request.

#### Path Parameters

| Name     | Type   | Description                                                        |
| -------- | ------ | ------------------------------------------------------------------ |
| hash     | string | Randomly generated Minecraft hex digest from the previous request. |
| username | string | Your Minecraft username-                                           |

{% tabs %}
{% tab title="200 Authentication was successful." %}

```javascript
{
    "success": true,
    "token": "tX2NfdAOIcM19I3PfAtjYDuto8HdAow0d4zQLSM32iMD5H1GIeYY47nktr46NXP",
    "expiresAt": 1616853123922
}
```

{% endtab %}

{% tab title="400 Your didn't provide all of the request parameters" %}

```javascript
{
    "success": false
}
```

{% endtab %}

{% tab title="403 The hashes didn't match." %}

```javascript
{
    "success": false
}
```

{% endtab %}
{% endtabs %}

## 3. Renew the token every 4 hours

<mark style="color:green;">`POST`</mark> `https://fragbots.antonio32a.com/renew`

This endpoint will renew your session.

#### Path Parameters

| Name  | Type   | Description                   |
| ----- | ------ | ----------------------------- |
| token | string | The token obtained in step 2. |

{% tabs %}
{% tab title="200 Token was successfully renewed." %}

```javascript
{
    "success": true,
    "expiresAt": 1616853123922
}
```

{% endtab %}

{% tab title="400 You didn't provide all of the request parameters." %}

```javascript
{
    "success": false
}
```

{% endtab %}

{% tab title="403 Invalid token." %}

```javascript
{
    "success": false,
    "error": "Invalid token."
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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://neppy.antonio32a.com/api-documentation/fragbots.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.
