# Utils

{% hint style="warning" %}
**Good to know:** Some routes in this section will require an API Key
{% endhint %}

## Flip Text

## Flip the text

<mark style="color:blue;">`GET`</mark> `https://api.any-bot.xyz/api/v1/fliptext`

All text put into this input will be flipped

#### Query Parameters

| Name                                   | Type   | Description        |
| -------------------------------------- | ------ | ------------------ |
| text<mark style="color:red;">\*</mark> | string | Text to be flipped |

#### Headers

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| API\_KEY | string | Your API Key (Optional) |

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

```javascript
{
    "message": "OK",
    "text": "Hello World",
    "flipped": "dlroW olleH",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "message": "Bad Request",
    "status": 400,
    "error": "text is required",
    "example": "?text=HelloWorld"
}
```

{% endtab %}
{% endtabs %}

## Base64

## Encode to base64

<mark style="color:blue;">`GET`</mark> `https://api.any-bot.xyz/api/v1/base64`

The text that has been put will be coded **based64**

#### Query Parameters

| Name                                   | Type   | Description      |
| -------------------------------------- | ------ | ---------------- |
| text<mark style="color:red;">\*</mark> | string | Text to be coded |

#### Headers

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| API\_KEY | string | Your API Key (Optional) |

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

```javascript
{
    "message": "OK",
    "text": "Hello World",
    "base64": "SGVsbG8gV29ybGQ=",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "message": "Bad Request",
    "status": 400,
    "error": "text is required",
    "example": "?text=HelloWorld"
}
```

{% endtab %}
{% endtabs %}

## Decode to base64

<mark style="color:blue;">`GET`</mark> `https://api.any-bot.xyz/api/v1/decodebase64`

The text that has been put will be decoded **based64**

#### Query Parameters

| Name                                   | Type   | Description        |
| -------------------------------------- | ------ | ------------------ |
| text<mark style="color:red;">\*</mark> | string | Text to be decoded |

#### Headers

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| API\_KEY | string | Your API Key (Optional) |

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

```javascript
{
    "message": "OK",
    "text": "Hello World",
    "base64": "SGVsbG8gV29ybGQ=",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "message": "Bad Request",
    "status": 400,
    "error": "text is required",
    "example": "?text=HelloWorld"
}
```

{% endtab %}
{% endtabs %}

## Binary

## Encode to binary

<mark style="color:blue;">`GET`</mark> `https://api.any-bot.xyz/api/v1/binary`

The text that has been put will be coded **binary**

#### Query Parameters

| Name                                   | Type   | Description      |
| -------------------------------------- | ------ | ---------------- |
| text<mark style="color:red;">\*</mark> | string | Text to be coded |

#### Headers

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| API\_KEY | string | Your API Key (Optional) |

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

```javascript
{
    "message": "OK",
    "text": "Hello World",
    "binary": "1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "message": "Bad Request",
    "status": 400,
    "error": "text is required",
    "example": "?text=HelloWorld"
}
```

{% endtab %}
{% endtabs %}

## Decode to binary

<mark style="color:blue;">`GET`</mark> `https://api.any-bot.xyz/api/v1/decodebinary`

The text that has been put will be decoded **binary**

#### Query Parameters

| Name                                   | Type   | Description        |
| -------------------------------------- | ------ | ------------------ |
| text<mark style="color:red;">\*</mark> | string | Text to be decoded |

#### Headers

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| API\_KEY | string | Your API Key (Optional) |

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

```javascript
{
    "message": "OK",
    "text": "Hello World",
    "binary": "1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "message": "Bad Request",
    "status": 400,
    "error": "text is required",
    "example": "?text=HelloWorld"
}
```

{% endtab %}
{% endtabs %}

## Coin Flip

## Coin Flip

<mark style="color:blue;">`GET`</mark> `https://api.any-bot.xyz/api/v1/coinflip`

Return a random side of a coin<br>

#### Headers

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| API\_KEY | string | Your API Key (Optional) |

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

```javascript
{
    "message": "OK",
    "result": "heads",
    "status": 200
}
```

{% endtab %}
{% endtabs %}

## Password

## Create a Random Password

<mark style="color:blue;">`GET`</mark> `https://api.any-bot.xyz/api/v1/password`

Create a strong and random password

#### Query Parameters

| Name   | Type   | Description                                    |
| ------ | ------ | ---------------------------------------------- |
| length | number | The desired size of the password (Maximum 200) |

#### Headers

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| API\_KEY | string | Your API Key (Optional) |

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

```javascript
{
    "message": "OK",
    "password": "%JWN9+%Ee-",
    "length": 10,
    "status": 200
}
```

{% endtab %}

{% tab title="200: OK Exceeding the allowed limit" %}

```javascript
{
    "message": "OK",
    "password": "-hX5#JmYI+xrbB_Ng8y/Lhtn6pWqg=PBNxCZSLq?PsnSgm/2#2/ms7@UC_h1vhpw&*SsK6qEq/$Al*Jm3Uyd&WoJjKu.c9fs&Jl0xu*CafPo#5HKg@gIjybnFF#4/PV@,_W&N./JDFOfrW$olc30vJkh9QuZ_r5-f@Y7$Km&CtVgK_p7hOW7d0=SLxiYqLDv#/xD2a14",
    "note": "The length of the note is limited to 200 characters",
    "length": 200,
    "status": 200
}
```

{% endtab %}
{% endtabs %}

## Upload

{% hint style="danger" %}
This route necessarily needs an API Key
{% endhint %}

<mark style="color:green;">`POST`</mark> `https://api.any-bot.xyz/api/v1`

#### Query Parameters

| Name                                   | Type   | Description      |
| -------------------------------------- | ------ | ---------------- |
| name<mark style="color:red;">\*</mark> | string | Name of the file |
| url<mark style="color:red;">\*</mark>  | URL    | URL of the file  |
| id<mark style="color:red;">\*</mark>   | number | ID of the file   |

#### Headers

| Name                                       | Type   | Description  |
| ------------------------------------------ | ------ | ------------ |
| API\_KEY<mark style="color:red;">\*</mark> | string | Your API Key |

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

```javascript
{
  "message": "File uploaded",
  "name": "123_test",
  "url": "https://api.any-bot.tech/img/uploads/123_test"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "message": "API_KEY required"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
  "message": "Missing parameters"
}
```

{% endtab %}
{% endtabs %}
