---
title: "Search chats"
method: GET
path: "/v1/{account_id}/chats/search"
tags: ["Messaging"]
---

# Search chats

`GET /v1/{account_id}/chats/search`

## Request

- Base URL: `https://api.curviate.com`
- URL: `https://api.curviate.com/v1/{account_id}/chats/search`
- Auth: HTTP bearer

Free-text search of the connected account's own inbox, matching participant names and message content. Served from chats and messages already retrieved, so it costs no platform call. A chat never retrieved cannot match; the response's coverage block says how complete that is.

## Path parameters

- `account_id` string, required

## Query parameters

- `query` string, required
- `limit` integer
- `cursor` string

## Response `200`

A page of chats matching the search term (participant names and/or message content), the next-page cursor, and how much of the stored inbox the search could see.

- object
  - `object` 'chat_list': Response type discriminator.
  - `items` object[]
    - `object` 'chat': Response type discriminator.
    - `id` string: Chat identifier.
    - `account_id` string: Account id that owns this chat.
    - `name` string, nullable: Chat display name, or null.
    - `type` '1to1' | 'group' | 'channel': Conversation type.
    - `is_group` boolean
    - `is_1to1` boolean
    - `unread_count` number: Number of unread messages in this chat.
    - `user_id` string: Identifier of the 1:1 counterpart, when the match is a 1:1 chat.
    - `last_message` object: The most recent stored message in the chat, when one is stored.
      - `object` 'message': Response type discriminator.
      - `id` string: Message identifier.
      - `account_id` string: Account id that owns this message.
      - `text` string, nullable: Full message text. Curviate does not keep it on the way out; reading a conversation back stores its message bodies in your tenant's inbox records, with no expiry.
      - `sender_id` string: Identifier of the sender.
      - `attachments` object[]: Attachment descriptors on the message, without the file bytes. Empty when the message has none.
        - `id` string: Attachment identifier.
        - `mimetype` string: MIME type of the attachment.
        - `type` string: Attachment kind: file | img | video | audio.
        - `filename` string: Original file name.
        - `file_size` number: Size in bytes.
        - `unavailable` boolean, nullable: True when the attachment is no longer available.
  - `cursor` string, nullable: Opaque next-page cursor; null on the last page.
  - `coverage` object: How complete the searched corpus is. This searches the chats and messages already retrieved for this account, so a chat never retrieved cannot match. Retrieve a chat's messages (GET .../chats/{chat_id}/messages) to widen it.
    - `complete` boolean: True when every stored chat has a complete message walk that no later invalidation has withdrawn; false when any chat is unwalked, mid-walk or withdrawn.
    - `chats_stored` number: Chats held for this account.
    - `chats_incomplete` number: Of those, how many have messages that were never fully enumerated.
  - `safety_warning` SafetyWarning: Present on a successful response when this account crossed an account-safety ceiling while the affected budget row is on the default warn posture. The action still happened. Field-identical to the BUDGET_EXHAUSTED error body except that blocked is false and hint.message describes the outcome, so one branch handles both postures and switching the account to enforce is a configuration change rather than a client rewrite.
    - `row` string, nullable, required: The budget row that breached, for example profile_views or pending_invites. Null when the breach is not about a row: an activity_window warning on an action that spends no budget of its own (editing a message, dismissing a notification, a Recruiter or Sales Navigator admin action) is still governed by the hours the account works in. Read hint.parameter for what to change; whenever this is null it names posture, because the activity window edges are set per action type and this action has none, so the levers that reach it are the account timezone and posture.
    - `reset_at` string, nullable, required: The instant the refusal lifts: the window roll on a ceiling refusal, the next window open on an activity-window one. Null in the two cases no clock frees, the pending_invites gauge and InMail credits (row inmail).
    - `hint` object, required
      - `parameter` string, required: The settable parameter on PATCH /v1/{account_id}/safety-policy.
      - `message` string, required: What the condition is and what changing that parameter would do. This is the one field whose text differs from the BUDGET_EXHAUSTED refusal: here it says the action went through, and on a ceiling breach how far past the ceiling this row now stands, rather than telling you to set posture to warn when it already is. Branch on parameter, reason and blocked, never on this text.
    - `reason` 'ceiling' | 'activity_window', required: Which rule was crossed. ceiling means the row's configured limit is spent; activity_window means the account is outside the hours it works in, which is a different fact with a different remedy. hint.parameter names the right setting for each.
    - `blocked` boolean, required: Always false here. True on the BUDGET_EXHAUSTED refusal carrying the same payload.

## Other responses

- `400`: Missing or empty account_id, missing or empty query, or a malformed cursor.
- `401`: Missing or invalid API key.
- `404`: The supplied account_id does not belong to this tenant. An id whose connection was replaced or removed also stops resolving here, and it is already absent from the list, so re-read `GET /v1/accounts` for the current id.
- `422`: The account is restricted and cannot be queried.
- `429`: Rate limited: slow down and retry after the hinted delay.
- `500`: Internal error.
- `502`: A temporary error occurred. Please try again.
- `503`: Service unavailable.
- `504`: Gateway timeout.

---

[API](https://skmtc.dev/curviate/apis/curviate-api.md) · [All operations](https://skmtc.dev/curviate/apis/curviate-api/llms.txt) · [OpenAPI document](https://skmtc.dev/curviate/apis/curviate-api/revisions/eab848801d95?raw)
