Get a Shortened List of Recent Chats im.recent.get

Scope: im

Who can execute the method: any user

The method im.recent.get retrieves a list of the user's recent chats.

Method Parameters

Name
type

Description

SKIP_OPENLINES
string

Skip chats from Open Channels.

Possible values:

  • Y — yes
  • N — no

SKIP_CHAT
string

Skip group chats.

Possible values:

  • Y — yes
  • N — no

SKIP_DIALOG
string

Skip one-on-one dialogs.

Possible values:

  • Y — yes
  • N — no

LAST_UPDATE
datetime

Retrieve data from the specified date in ATOM (ISO-8601) format

ONLY_OPENLINES
string

Select only chats from Open Channels.

Possible values:

  • Y — yes
  • N — no

LAST_SYNC_DATE
datetime

Date of the previous retrieval in ATOM (ISO-8601) format to load changes that occurred in the list since the specified date.

The retrieval returns data no older than 7 days

Code Examples

How to Use Examples in Documentation

curl -X POST \
          -H "Content-Type: application/json" \
          -H "Accept: application/json" \
          -d '{"SKIP_OPENLINES":"Y","LAST_UPDATE":"2026-02-25T18:30:00+01:00"}' \
          https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/im.recent.get
        
curl -X POST \
          -H "Content-Type: application/json" \
          -H "Accept: application/json" \
          -d '{"SKIP_OPENLINES":"Y","LAST_UPDATE":"2026-02-25T18:30:00+01:00","auth":"**put_access_token_here**"}' \
          https://**put_your_bitrix24_address**/rest/im.recent.get
        
try
        {
            const response = await $b24.callMethod(
                'im.recent.get',
                {
                    SKIP_OPENLINES: 'Y',
                    LAST_UPDATE: '2026-02-25T18:30:00+01:00'
                }
            );
        
            console.log(response.getData().result);
        }
        catch (error)
        {
            console.error(error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'im.recent.get',
                    [
                        'SKIP_OPENLINES' => 'Y',
                        'LAST_UPDATE' => '2026-02-25T18:30:00+01:00',
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'im.recent.get',
            {
                SKIP_OPENLINES: 'Y',
                LAST_UPDATE: '2026-02-25T18:30:00+01:00'
            },
            function(result)
            {
                if (result.error())
                {
                    console.error(result.error());
                }
                else
                {
                    console.log(result.data());
                }
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'im.recent.get',
            [
                'SKIP_OPENLINES' => 'Y',
                'LAST_UPDATE' => '2026-02-25T18:30:00+01:00',
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP Status: 200

{
            "result": [
                {
                    "id": "chat1451",
                    "chat_id": 1451,
                    "type": "chat",
                    "avatar": {
                        "url": "",
                        "color": "#df532d"
                    },
                    "title": "Maximally Complete Task Template",
                    "message": {
                        "id": 84501,
                        "text": "John Doe created a task [Attachment]",
                        "file": false,
                        "author_id": 0,
                        "attach": true,
                        "sticker": null,
                        "date": "2026-02-26T00:01:26+03:00",
                        "status": "received",
                        "uuid": null
                    },
                    "counter": 0,
                    "last_id": 84501,
                    "pinned": false,
                    "unread": false,
                    "has_reminder": false,
                    "date_update": "2026-02-26T00:01:26+03:00",
                    "date_last_activity": "2026-02-26T00:01:26+03:00",
                    "chat": {
                        "id": 1451,
                        "parent_chat_id": 0,
                        "parent_message_id": 0,
                        "name": "Maximally Complete Task Template",
                        "owner": 503,
                        "extranet": false,
                        "contains_collaber": false,
                        "avatar": "",
                        "color": "#df532d",
                        "type": "tasksTask",
                        "entity_type": "TASKS_TASK",
                        "entity_id": "8293",
                        "entity_data_1": "",
                        "entity_data_2": "",
                        "entity_data_3": "",
                        "mute_list": [],
                        "manager_list": [
                            503
                        ],
                        "date_create": "2026-02-26T00:01:26+03:00",
                        "message_type": "X",
                        "user_counter": 4,
                        "restrictions": {
                            "avatar": true,
                            "rename": true,
                            "extend": true,
                            "call": true,
                            "mute": true,
                            "leave": true,
                            "leave_owner": true,
                            "send": true,
                            "user_list": true
                        },
                        "role": "OWNER",
                        "text_field_enabled": true,
                        "background_id": null,
                        "entity_link": {
                            "type": "TASKS",
                            "url": "/company/personal/user/503/tasks/task/view/8293/?ta_sec=chat_tasks&ta_el=view_button",
                            "id": "8293"
                        },
                        "permissions": {
                            "manage_users_add": "member",
                            "manage_users_delete": "manager",
                            "manage_ui": "member",
                            "manage_settings": "owner",
                            "manage_messages": "member",
                            "can_post": "member"
                        },
                        "public": ""
                    },
                    "user": {
                        "id": 0
                    },
                    "options": []
                },
                {
                    "id": "chat1449",
                    "chat_id": 1449,
                    "type": "chat",
                    "avatar": {
                        "url": "",
                        "color": "#ab7761"
                    },
                    "title": "Maximally Complete Task Template",
                    "message": {
                        "id": 84499,
                        "text": "John Doe created a task [Attachment]",
                        "file": false,
                        "author_id": 0,
                        "attach": true,
                        "sticker": null,
                        "date": "2026-02-26T00:01:25+03:00",
                        "status": "received",
                        "uuid": null
                    },
                    "counter": 0,
                    "last_id": 84499,
                    "pinned": false,
                    "unread": false,
                    "has_reminder": false,
                    "date_update": "2026-02-26T00:01:25+03:00",
                    "date_last_activity": "2026-02-26T00:01:25+03:00",
                    "chat": {
                        "id": 1449,
                        "parent_chat_id": 0,
                        "parent_message_id": 0,
                        "name": "Maximally Complete Task Template",
                        "owner": 503,
                        "extranet": false,
                        "contains_collaber": false,
                        "avatar": "",
                        "color": "#ab7761",
                        "type": "tasksTask",
                        "entity_type": "TASKS_TASK",
                        "entity_id": "8291",
                        "entity_data_1": "",
                        "entity_data_2": "",
                        "entity_data_3": "",
                        "mute_list": [],
                        "manager_list": [
                            503
                        ],
                        "date_create": "2026-02-26T00:01:25+03:00",
                        "message_type": "X",
                        "user_counter": 4,
                        "restrictions": {
                            "avatar": true,
                            "rename": true,
                            "extend": true,
                            "call": true,
                            "mute": true,
                            "leave": true,
                            "leave_owner": true,
                            "send": true,
                            "user_list": true
                        },
                        "role": "OWNER",
                        "text_field_enabled": true,
                        "background_id": null,
                        "entity_link": {
                            "type": "TASKS",
                            "url": "/company/personal/user/503/tasks/task/view/8291/?ta_sec=chat_tasks&ta_el=view_button",
                            "id": "8291"
                        },
                        "permissions": {
                            "manage_users_add": "member",
                            "manage_users_delete": "manager",
                            "manage_ui": "member",
                            "manage_settings": "owner",
                            "manage_messages": "member",
                            "can_post": "member"
                        },
                        "public": ""
                    },
                    "user": {
                        "id": 0
                    },
                    "options": []
                }
            ],
            "time": {
                "start": 1772086038,
                "finish": 1772086038.652287,
                "duration": 0.6522870063781738,
                "processing": 0,
                "date_start": "2026-02-26T09:07:18+03:00",
                "date_finish": "2026-02-26T09:07:18+03:00",
                "operating_reset_at": 1772086638,
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

result
array

List of recent dialogs (detailed description)

time
time

Information about the request execution time

Object result-item

Name
type

Description

id
string

Identifier of the dialog: number for user, chatXXX for chat

type
string

Type of record: user for user, chat for chat

avatar
object

Object describing the avatar of the record (detailed description)

title
string

Title of the record: first and last name for user, chat name for chat

message
object

Object describing the last message (detailed description)

counter
integer

Unread message counter

chat_id
integer

Chat identifier

last_id
integer

Identifier of the last read message

pinned
boolean

Indicator of a pinned dialog

unread
boolean

Indicator of a manual "unread" mark

has_reminder
boolean

Indicator of a set reminder

date_update
datetime

Date of the record update in the recent list in ATOM format

date_last_activity
datetime

Date of the last activity in the dialog in ATOM format

user
object

Object describing the user. Not available for records of type chat. (detailed description)

chat
object

Object describing the chat. Not available for records of type user. (detailed description)

options
array

Additional parameters of the record

Object avatar

Name
type

Description

url
string

Link to the avatar. If empty, the avatar is not set

color
string

Color of the dialog in HEX format

Object message

Name
type

Description

id
integer

Identifier of the message

text
string

Text of the message without BB codes and line breaks

file
boolean

Indicator of the presence of files

attach
boolean

Indicator of the presence of attachments

author_id
integer

Identifier of the message author

date
datetime

Date of the message in ATOM format

sticker
integer

Identifier of the sticker. If there is no sticker, the value is null

status
string

Delivery status of the message

uuid
string

External identifier of the message. If not set, the value is null

Object user

Name
type

Description

id
integer

Identifier of the user

name
string

User's full name

first_name
string

User's first name

last_name
string

User's last name

work_position
string

User's job title

color
string

User's color in HEX format

avatar
string

Link to the avatar. If empty, the avatar is not set

gender
string

User's gender

birthday
string

Birthday in DD-MM format. If empty, not set

extranet
boolean

Indicator of an external extranet user

network
boolean

Indicator of a Bitrix24.Network user

bot
boolean

Indicator of a bot

connector
boolean

Indicator of a user from Open Channels

external_auth_id
string

External authorization code

status
string

Selected status of the user

idle
datetime

Date when the user stepped away from the computer, in ATOM format. If not set, false

last_activity_date
datetime

Date of the user's last action in ATOM format

mobile_last_date
datetime

Date of the last action in the mobile application in ATOM format. If not set, false

absent
datetime

Date until which the user is on vacation, in ATOM format. If not set, false

Object chat

Name
type

Description

id
integer

Identifier of the chat

title
string

Title of the chat

name
string

Name of the chat (field from the response)

owner
integer

Identifier of the chat owner

extranet
boolean

Indicator of the participation of an external extranet user in the chat

parent_chat_id
integer

Identifier of the parent chat

parent_message_id
integer

Identifier of the parent message

contains_collaber
boolean

Indicator of the participation of collaborator users

color
string

Color of the chat in HEX format

avatar
string

Link to the avatar. If empty, the avatar is not set

type
string

Type of chat: group, call, open line, etc.

entity_type
string

External code for the chat: type

entity_id
string

External code for the chat: identifier

entity_data_1
string

External data for the chat

entity_data_2
string

External data for the chat

entity_data_3
string

External data for the chat

date_create
datetime

Date of chat creation in ATOM format

message_type
string

Type of chat messages

mute_list
array

List of users who have disabled notifications

manager_list
array

List of chat manager identifiers

user_counter
integer

Number of chat participants

restrictions
object

Restrictions on actions in the chat (detailed description)

role
string

Current user's role in the chat

text_field_enabled
boolean

Availability of the message input field

background_id
integer

Identifier of the chat background. If not set, the value is null

entity_link
object

Link to the related object (detailed description)

permissions
object

Permissions for actions in the chat (detailed description)

public
string

Indicator of the chat's public status

Object restrictions

Name
type

Description

avatar
boolean

Availability of avatar change

rename
boolean

Availability of name change

extend
boolean

Availability of chat extension

call
boolean

Availability of calls

mute
boolean

Availability of notification disabling

leave
boolean

Availability of leaving the chat

leave_owner
boolean

Availability of the owner leaving the chat

send
boolean

Availability of sending messages

user_list
boolean

Availability of viewing the list of participants

Name
type

Description

type
string

Type of the related object

url
string

Link to the related object

id
string

Identifier of the related object

Object permissions

Name
type

Description

manage_users_add
string

Permission to add participants

manage_users_delete
string

Permission to remove participants

manage_ui
string

Permission to manage the chat interface

manage_settings
string

Permission to manage chat settings

manage_messages
string

Permission to manage messages

can_post
string

Permission to send messages

Error Handling

Name
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
error_description

Textual description of the error. The description is not intended to be shown to the end user in its raw form

Statuses and System Error Codes

HTTP Status: 20x, 40x, 50x

The errors described below may occur when calling any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not allowed to be called using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The methods must be called using the HTTPS protocol

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is available only on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user whose access token or webhook was used to call the method lacks permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires higher privileges than those provided by the webhook token

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users

500

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning