# API Introduction

### Authentication

Authentication is required for messing with bot api's and maybe more endpoints in the future. This is done with an Authorization HTTP Header.

| Header                                           | Content              |
| ------------------------------------------------ | -------------------- |
| <p></p><p></p><p>Authorization</p><p></p><p></p> | KXlKVSBJukpuH5ymv2so |

You can generate an API key from your Bot Dashboard at any time.

## Install the library

The best way to interact with our API is to use one of our official libraries:

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

```
# Install via NPM
npm install --save persiandevs
```

{% endtab %}
{% endtabs %}

## Make your first request

To make your first request, send an authenticated request to the stats endpoint. This will update your bot `servercount`, which is nice.

## Change Your Bot Server Count On The Site.

<mark style="color:green;">`POST`</mark> `https://persiandevs.ir/api/auth/stats/:id`

#### Request Body

| Name                                            | Type   | Description          |
| ----------------------------------------------- | ------ | -------------------- |
| server\_count<mark style="color:red;">\*</mark> | number | the bot sevrer count |

{% tabs %}
{% tab title="200: OK No Errors! GL Coding!" %}

```javascript
{
    success: "true", 
    users: []
}
```

{% endtab %}

{% tab title="401: Unauthorized Incorrect Auth Key Provided" %}

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

{% endtab %}

{% tab title="429: Too Many Requests You Are Ratelimited" %}

```javascript
{
    success: "false", 
    error: "You are being ratelimited."
}
```

{% endtab %}

{% tab title="404: Not Found Bot Was Not Found!" %}

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

{% endtab %}

{% tab title="400: Bad Request Create A Auth Key For Your Bot First" %}

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

{% endtab %}
{% endtabs %}

example:

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

```javascript
const persiandevs = require('persiandevs');

persiandevs.postStats("Your_Bot_ID", "Your_Auth_Key", "ServerCount")
```

{% 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://docs.persiandevs.ir/api-introduction.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.
