
## Get message

`GET /v1/bots/:botId/messages/:messageId`

Returns a message by its ID.

> **Bot type restriction.** The method is available only to bots whose `type` is `personal` or `supervisor`. The type is set during registration via [POST /v1/bots](/docs/bots/management/create) and cannot be changed without re-registration.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `botId` (path) | number | yes | Bot ID. List: [`GET /v1/bots`](/docs/bots/management/list) |
| `messageId` (path) | number | yes | Message ID. It arrives in the `message.id` field of [bot events](/docs/bots/events/bot-events) and in the `data.id` field of the [`POST /v1/bots/:botId/messages`](/docs/bots/messages/send) response |

## Examples

### curl — personal key

```bash
curl https://vibecode.bitrix24.com/v1/bots/42/messages/1501 \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl https://vibecode.bitrix24.com/v1/bots/42/messages/1501 \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/messages/1501', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Message:', data.message.text)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/messages/1501', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.message` | object | Message |
| `data.message.id` | number | Message ID |
| `data.message.chatId` | number | Chat ID |
| `data.message.chat_id` | number | Chat ID, the same value as `data.message.chatId` |
| `data.message.authorId` | number | Author ID. For a bot message — the bot ID |
| `data.message.author_id` | number | Author ID, the same value as `data.message.authorId` |
| `data.message.date` | string | Date sent in ISO 8601 format |
| `data.message.text` | string | Message text |
| `data.message.isSystem` | boolean | Whether the message is a system message |
| `data.message.uuid` | string \| null | Message UUID. `null` if no UUID is set |
| `data.message.forward` | object \| null | Forwarding data. `null` if the message was not forwarded |
| `data.message.params` | object \| array | Additional message parameters. An empty array `[]` if there are no parameters |
| `data.message.viewedByOthers` | boolean | Whether other chat participants have read the message |
| `data.message.block` | object \| null | `null` for a bot text message |
| `data.user` | object | Message author |
| `data.user.id` | number | User ID |
| `data.user.active` | boolean | Whether the account is active |
| `data.user.name` | string | Full name |
| `data.user.firstName` | string | First name |
| `data.user.lastName` | string | Last name. An empty string if not set |
| `data.user.workPosition` | string | Job title |
| `data.user.color` | string | Avatar color in HEX format, for example `#58cc47` |
| `data.user.avatar` | string | Avatar URL. An empty string if no avatar is set |
| `data.user.gender` | string | Gender: `M` — male, `F` — female, an empty string — not specified |
| `data.user.birthday` | string | Date of birth. An empty string if not specified |
| `data.user.extranet` | boolean | Whether the user is external, type `extranet` |
| `data.user.bot` | boolean | Whether the user is a bot |
| `data.user.connector` | boolean | Open Channels user |
| `data.user.externalAuthId` | string | External authentication code of the user account. For a bot — `bot` |
| `data.user.internalAccount` | boolean | Whether this is an internal user of the Bitrix24 account. For a bot — `false` |
| `data.user.intranetUser` | boolean | Whether the user is an employee of the Bitrix24 account. For a bot — `false` |
| `data.user.status` | string | Status: `online`, `away`, `dnd` |
| `data.user.idle` | boolean | User idle flag |
| `data.user.lastActivityDate` | string \| false | Time of last activity in ISO 8601 format. `false` if there was no activity |
| `data.user.mobileLastDate` | string \| false | Time of the last sign-in from the mobile app. `false` if there was none |
| `data.user.desktopLastDate` | string \| false | Time of the last sign-in from the desktop app. `false` if there was none |
| `data.user.absent` | boolean \| string | `false` or the end date of the absence |
| `data.user.departments` | number[] | Department IDs. List: `GET /v1/departments`. An empty array for a bot |
| `data.user.phones` | object \| false | Phone numbers. `false` if there are none |
| `data.user.type` | string | User type: `user`, `bot`, `extranet` |
| `data.user.website` | string | Website. An empty string if not specified |
| `data.user.email` | string | Email address. An empty string if not specified |

## Response example

```json
{
  "success": true,
  "data": {
    "message": {
      "id": 1501,
      "chatId": 123,
      "chat_id": 123,
      "authorId": 42,
      "author_id": 42,
      "date": "2026-10-21T14:00:05+00:00",
      "text": "Test message",
      "isSystem": false,
      "uuid": null,
      "forward": null,
      "params": [],
      "viewedByOthers": false,
      "block": null
    },
    "user": {
      "id": 42,
      "active": true,
      "name": "Test bot",
      "firstName": "Test bot",
      "lastName": "",
      "workPosition": "Chatbot",
      "color": "#58cc47",
      "avatar": "",
      "gender": "M",
      "birthday": "",
      "extranet": false,
      "bot": true,
      "connector": false,
      "externalAuthId": "bot",
      "internalAccount": false,
      "intranetUser": false,
      "status": "online",
      "idle": false,
      "lastActivityDate": false,
      "mobileLastDate": false,
      "desktopLastDate": false,
      "absent": false,
      "departments": [],
      "phones": false,
      "type": "bot",
      "website": "",
      "email": ""
    }
  }
}
```

## Error response example

422 — the bot type is neither `personal` nor `supervisor`:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Method is available only for supervisor and personal bots",
    "b24Code": "BOT_TYPE_NOT_ALLOWED"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_BOT_ID` | `botId` is not a number |
| 400 | `INVALID_PARAMS` | `messageId` in the path must be a positive integer from `1` to `9007199254740991`, without a sign, leading zeros, fraction, exponent or whitespace. Rejected before calling Bitrix24 |
| 404 | `BOT_NOT_FOUND` | No bot found with this ID |
| 403 | `BOT_ACCESS_DENIED` | The bot belongs to a different API key |
| 422 | `BITRIX_ERROR` (`error.b24Code: BOT_TYPE_NOT_ALLOWED`) | The bot type is neither `personal` nor `supervisor` |
| 422 | `BITRIX_ERROR` (`error.b24Code: MESSAGE_NOT_FOUND`) | No message with this `messageId` exists |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access to the message. This is the response for a message from a chat the bot is not a member of |
| 422 | `BITRIX_ERROR` | Another Bitrix24 error, text in `message` |
| 403 | `SCOPE_DENIED` | The API key does not have the `imbot` scope |
| 410 | `BOT_DISABLED` | The bot is disabled and does not process API calls. How to restore it — [Bot disabled](/docs/bots/troubleshooting#bot-disabled-bot_disabled) |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**Typical scenario:** the bot received an event with `replyId` and wants to read the original message the user replied to.

## See also

- [Message context](/docs/bots/messages/context)
- [Send message](/docs/bots/messages/send)
- [Events](/docs/bots/events)
- [Bot platform](/docs/bots)
- [Limits and optimization](/docs/optimization)
