> For the complete documentation index, see [llms.txt](https://itzvoid-za.gitbook.io/nextgen-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://itzvoid-za.gitbook.io/nextgen-api/master.md).

# API Documentation

## Features:

* Server Count Stats Posting To Our Website.
* Bot Information Tracking From Our Website.

## Server Count API

## Server Count

<mark style="color:green;">`POST`</mark> `https://nextgenbots.xyz/api/stats`

This endpoint you to update the server count on the bot's profile page.

#### Path Parameters

| Name           | Type   | Description                                       |
| -------------- | ------ | ------------------------------------------------- |
| Authentication | string | An Authorization Token generated by NextGen Bots. |

#### Request Body

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| server\_count | string | The bot's server count |

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

```javascript
{
    success: true,
    old_servercount: "0",
    servers: "85"
}
```

{% endtab %}

{% tab title="401 The auth token was not found within the post request." %}

```javascript
{ 
    success: false,
    error: "Authorization header not found."
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Make sure to place this within an event or command. If you do not you may get "Count not found in body" errors!
{% endhint %}

{% tabs %}
{% tab title="Discord.js v12 - Example" %}

```javascript
  const nodefetch = require('node-fetch')
  nodefetch(`https://nextgenbots.xyz/api/stats`, {
    method: 'POST',
    body: JSON.stringify({
     server_count: "server count"
    }),
    headers: { 'Content-Type': 'application/json', auth: 'auth token' }
  }).then(c => 
  c.json()
  )
  .then(c => 
  console.log(c)
  ).catch(err => 
  console.log(err)
  )
```

{% endtab %}
{% endtabs %}

## Bot Info API

## Get Bot Info

<mark style="color:blue;">`GET`</mark> `https://nextgenbots.xyz/api/info`

#### Path Parameters

| Name  | Type   | Description   |
| ----- | ------ | ------------- |
| botid | string | The Bot's ID. |

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

```javascript
{
    "success": true,
    "botname": "BotName",
    "votes": 0,
    "monthly_votes": 0,
    "servers": "0"
}
```

{% endtab %}

{% tab title="404 Could not find a bot matching this query." %}

```javascript
{
    "success": false,
    "error": "The bot does not exist or an error occured."
}
```

{% endtab %}
{% endtabs %}

```javascript
const fetch = require("node-fetch");
    let options = fetch(`https://nextgenbots.xyz/api/info`, {
      method: "POST",
      body: JSON.stringify({
        id: "botid"
      }),
      headers: {
        "Content-Type": "application/json",
        auth: "api token"
      }
    })
      .then(c => c.json())
      .then(c => {
      console.log(c)
      }).catch(err)
```
