## Search `$client->chats->search(?list accountIDs, ?string cursor, ?Direction direction, ?Inbox inbox, ?bool includeMuted, ?\Datetime lastActivityAfter, ?\Datetime lastActivityBefore, ?int limit, ?string query, ?Scope scope, ?Type type, ?bool unreadOnly): CursorSearch` **get** `/v1/chats/search` Search chats by title/network or participants using Beeper Desktop's renderer algorithm. ### Parameters - `accountIDs?:optional list` Provide an array of account IDs to filter chats from specific messaging accounts only - `cursor?:optional string` Opaque pagination cursor; do not inspect. Use together with 'direction'. - `direction?:optional Direction` Pagination direction used with 'cursor': 'before' fetches older results, 'after' fetches newer results. Defaults to 'before' when only 'cursor' is provided. - `inbox?:optional Inbox` Filter by inbox type: "primary" (non-archived, non-low-priority), "low-priority", or "archive". If not specified, shows all chats. - `includeMuted?:optional bool` Include chats marked as Muted by the user, which are usually less important. Default: true. Set to false if the user wants a more refined search. - `lastActivityAfter?:optional \Datetime` Provide an ISO datetime string to only retrieve chats with last activity after this time - `lastActivityBefore?:optional \Datetime` Provide an ISO datetime string to only retrieve chats with last activity before this time - `limit?:optional int` Set the maximum number of chats to retrieve. Valid range: 1-200, default is 50 - `query?:optional string` Literal token search (non-semantic). Use single words users type (e.g., "dinner"). When multiple words provided, ALL must match. Case-insensitive. - `scope?:optional Scope` Search scope: 'titles' matches title + network; 'participants' matches participant names. - `type?:optional Type` Specify the type of chats to retrieve: use "single" for direct messages, "group" for group chats, or "any" to get all types - `unreadOnly?:optional bool` Set to true to only retrieve chats that have unread messages ### Returns - `Chat` - `string id` Unique identifier of the chat across Beeper. - `string accountID` Account ID this chat belongs to. - `Participants participants` Chat participants information. - `string title` Display title of the chat as computed by the client/server. - `Type type` Chat type: 'single' for direct messages, 'group' for group chats. - `int unreadCount` Number of unread messages. - `?bool isArchived` True if chat is archived. - `?bool isMuted` True if chat notifications are muted. - `?bool isPinned` True if chat is pinned. - `?\Datetime lastActivity` Timestamp of last activity. - `?string lastReadMessageSortKey` Last read message sortKey. - `?string localChatID` Local chat ID specific to this Beeper Desktop installation. ### Example ```php chats->search( accountIDs: [ 'local-whatsapp_ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc', 'local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI', ], cursor: '1725489123456|c29tZUltc2dQYWdl', direction: 'before', inbox: 'primary', includeMuted: true, lastActivityAfter: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'), lastActivityBefore: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'), limit: 1, query: 'x', scope: 'titles', type: 'single', unreadOnly: true, ); var_dump($page); ```