# API methods

First of all,[ get API key](https://tgtaps.gitbook.io/tgtaps-docs/integrations/api-keys) to insert in all requests.

## Table of content

* [Get bot user](#get-bot-user)
* [Get bot user friends](#get-bot-user-friends)
* [Send message](#send-message)
* [Increase points](#increase-points)
* [Remove rate](#remove-rate)
* [Get rate](#get-rate)
* [Set rate](#set-rate)

### Get bot user

Get information about user.

**GET** <https://app.tgtaps.com/api/bot-users/external/bot-user?apiKey=**API\\_KEY**\\&botId=**BOT\\_ID**\\&userTelegramId=**TELEGRAM\\_ID>\*\*

Example response:

```json
{
  "tgId": 165299325,
  "createdAt": "2025-01-31T15:08:08.13319Z",
  "registeredByRefCode": null,
  "tgUsername": "rostislav_dugin",
  "tgName": "Rostislav Dugin",
  "points": 246889,
  "maxEnergy": 1000,
  "customValue": 0,
  "autominePointsPerHour": 0,
  "tonFriendlyAddress": "",
  "level": 2,
  "lastIp": null
}
```

### Get bot user friends

Get friends of the user.

**GET** <https://app.tgtaps.com/api/bot-users/external/bot-user-friends?botId=**BOT\\_ID**\\&apiKey=**API\\_KEY**\\&userTelegramId=**TELEGRAM\\_ID>\*\*

Example response:

```json
[
  {
    "tgId": 671934272,
    "createdAt": "2025-02-02T20:07:55.92733Z",
    "registeredByRefCode": "9acc329d-4cab-40f6-9801-746cc4773fda",
    "tgUsername": "username",
    "tgName": "User Name",
    "points": 0,
    "maxEnergy": 1000,
    "customValue": 0,
    "autominePointsPerHour": 0,
    "tonFriendlyAddress": "",
    "level": 0,
    "lastIp": null
  }
]
```

### Send message

Send message via bot to the user.

**POST** <https://app.tgtaps.com/api/bot-users/external/send-message>

Example request body:

````json
```json
{
  "botId": "BOT_ID",
  "apiKey": "API_KEY",
  "userTelegramId": "TELEGRAM_ID",
  "message": "<b>Hello</b> world",
  "isEnableHtml": true
}
```
````

You can use HTML tags to format your message.

### Increase points

Increase points of the user.

**GET** <https://app.tgtaps.com/api/bot-users/external/increase-points?botId=**BOT\\_ID**\\&apiKey=**API\\_KEY**\\&userTelegramId=**TELEGRAM\\_ID**\\&points=**AMOUNT>\*\*

### Remove rate

To remove rate by Telegram ID, use:

**GET** <https://app.tgtaps.com/api/bot-users/external/remove-rate?apiKey=**API\\_KEY**\\&botId=**BOT\\_ID**\\&userTgId=**TELEGRAM\\_ID>\*\*

P.S. Requests are logged by TgTaps. It will not protect you from killing your subscriptions in case of your mistake in the code. At least, we will know when it happened.

### Get rate

**GET** <https://app.tgtaps.com/api/bot-users/external/get-rate?apiKey=**API\\_KEY**\\&botId=**BOT\\_ID**\\&userTgId=**TELEGRAM\\_ID>\*\*

Example responses (with and without rates):

```
{
  "rateId": "01fa38b1-619c-4815-a983-9598073ef8fb",
  "rateName": "Премиум"
}
```

```
{
  "rateId": null,
  "rateName": null
}
```

### Set rate

**GET** <https://app.tgtaps.com/api/bot-users/externa;/set-rate?apiKey=**API\\_KEY**\\&botId=**BOT\\_ID**\\&userTgId=**TELEGRAM\\_ID**\\&rateId=**RATE\\_ID>\*\*

Example respose:

```
{
  "message": "Rate set successfully"
}
```

***

Something unclear in docs or you know how to improve article? [Message us in community!](https://docs.tgtaps.com/tgtaps-docs/readme/community)\
We will answer you and then promise to improve the article within 3 days.
