## Search `client.Chats.Search(ctx, query) (*CursorSearch[Chat], error)` **get** `/v1/chats/search` Search chats by title/network or participants using Beeper Desktop's renderer algorithm. ### Parameters - `query ChatSearchParams` - `AccountIDs param.Field[[]string]` Provide an array of account IDs to filter chats from specific messaging accounts only - `Cursor param.Field[string]` Opaque pagination cursor; do not inspect. Use together with 'direction'. - `Direction param.Field[ChatSearchParamsDirection]` Pagination direction used with 'cursor': 'before' fetches older results, 'after' fetches newer results. Defaults to 'before' when only 'cursor' is provided. - `const ChatSearchParamsDirectionAfter ChatSearchParamsDirection = "after"` - `const ChatSearchParamsDirectionBefore ChatSearchParamsDirection = "before"` - `Inbox param.Field[ChatSearchParamsInbox]` Filter by inbox type: "primary" (non-archived, non-low-priority), "low-priority", or "archive". If not specified, shows all chats. - `const ChatSearchParamsInboxPrimary ChatSearchParamsInbox = "primary"` - `const ChatSearchParamsInboxLowPriority ChatSearchParamsInbox = "low-priority"` - `const ChatSearchParamsInboxArchive ChatSearchParamsInbox = "archive"` - `IncludeMuted param.Field[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 param.Field[Time]` Provide an ISO datetime string to only retrieve chats with last activity after this time - `LastActivityBefore param.Field[Time]` Provide an ISO datetime string to only retrieve chats with last activity before this time - `Limit param.Field[int64]` Set the maximum number of chats to retrieve. Valid range: 1-200, default is 50 - `Query param.Field[string]` Literal token search (non-semantic). Use single words users type (e.g., "dinner"). When multiple words provided, ALL must match. Case-insensitive. - `Scope param.Field[ChatSearchParamsScope]` Search scope: 'titles' matches title + network; 'participants' matches participant names. - `const ChatSearchParamsScopeTitles ChatSearchParamsScope = "titles"` - `const ChatSearchParamsScopeParticipants ChatSearchParamsScope = "participants"` - `Type param.Field[ChatSearchParamsType]` Specify the type of chats to retrieve: use "single" for direct messages, "group" for group chats, or "any" to get all types - `const ChatSearchParamsTypeSingle ChatSearchParamsType = "single"` - `const ChatSearchParamsTypeGroup ChatSearchParamsType = "group"` - `const ChatSearchParamsTypeAny ChatSearchParamsType = "any"` - `UnreadOnly param.Field[bool]` Set to true to only retrieve chats that have unread messages ### Returns - `type Chat struct{…}` - `ID string` Unique identifier of the chat across Beeper. - `AccountID string` Account ID this chat belongs to. - `Participants ChatParticipants` Chat participants information. - `HasMore bool` True if there are more participants than included in items. - `Items []User` Participants returned for this chat (limited by the request; may be a subset). - `ID string` Stable Beeper user ID. Use as the primary key when referencing a person. - `CannotMessage bool` True if Beeper cannot initiate messages to this user (e.g., blocked, network restriction, or no DM path). The user may still message you. - `Email string` Email address if known. Not guaranteed verified. - `FullName string` Display name as shown in clients (e.g., 'Alice Example'). May include emojis. - `ImgURL string` Avatar image URL if available. May be temporary or local-only to this device; download promptly if durable access is needed. - `IsSelf bool` True if this user represents the authenticated account's own identity. - `PhoneNumber string` User's phone number in E.164 format (e.g., '+14155552671'). Omit if unknown. - `Username string` Human-readable handle if available (e.g., '@alice'). May be network-specific and not globally unique. - `Total int64` Total number of participants in the chat. - `Title string` Display title of the chat as computed by the client/server. - `Type ChatType` Chat type: 'single' for direct messages, 'group' for group chats. - `const ChatTypeSingle ChatType = "single"` - `const ChatTypeGroup ChatType = "group"` - `UnreadCount int64` Number of unread messages. - `IsArchived bool` True if chat is archived. - `IsMuted bool` True if chat notifications are muted. - `IsPinned bool` True if chat is pinned. - `LastActivity Time` Timestamp of last activity. - `LastReadMessageSortKey string` Last read message sortKey. - `LocalChatID string` Local chat ID specific to this Beeper Desktop installation. ### Example ```go package main import ( "context" "fmt" "github.com/beeper/desktop-api-go" ) func main() { client := beeperdesktopapi.NewClient( ) page, err := client.Chats.Search(context.TODO(), beeperdesktopapi.ChatSearchParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ```