# Search messages

Returns one page of matches across the account. search is at most 200 characters; a longer value is rejected with 400 before the search runs. page is zero-based and defaults to 0. limit defaults to 20 and cannot exceed 500. data.count is the total number of matches, data.currentPage is the page that was returned, and data.hasMore is true when a later page exists.

Endpoint: POST /v1/messages/search
Version: 1.0.0
Security: bearerAuth, oauth2

## Security:

  - `bearerAuth` (unknown)
    http bearer API key scopes: inbox.messages:read

  - `oauth2` (unknown)
    oauth2 scopes: inbox.messages:read

## Request fields (application/json):

  - `search` (string, required)
    Text to search for. Maximum 200 characters.

  - `page` (integer)
    Zero-based page index. The first page is 0. Defaults to 0 when omitted.
    Example: 0

  - `limit` (integer)
    Number of messages to return. Defaults to 20 when omitted. Maximum 500.

## Response 200:

  - `200` (unknown)
    One page of matching messages, with the total across all pages.

## Response 200 fields (application/json):

  - `data` (object, required)

  - `data.messages` (array, required)

  - `data.messages.id` (string, required)

  - `data.messages.chatId` (string, required)
    Pass this to GET /v1/messages to read the conversation.

  - `data.messages.chatName` (string, required)

  - `data.messages.previewId` (string, required)

  - `data.messages.timestamp` (string, required)

  - `data.messages.text` (string)

  - `data.messages.source` (string, required)

  - `data.count` (integer, required)
    Total matches across all pages.

  - `data.currentPage` (integer, required)
    Zero-based index of the page returned.

  - `data.hasMore` (boolean, required)
    True when a later page exists.

## Response 400:

  - `400` (unknown)
    Bad request or validation failed

## Response 400 fields (application/json):

  - `message` (string, required)
    The first problem, as "field: reason". It is one of the entries in details, not a separate sentence.

  - `details` (object)
    Present on a validation failure.

  - `details.formErrors` (array, required)
    Problems with the request as a whole, which no single field accounts for.

  - `details.fieldErrors` (object, required)
    Field name to the problems with it. A field the endpoint does not accept is listed here under its own name, with "Unrecognized key".

## Response 401:

  - `401` (unknown)
    Unauthorized – missing, invalid, or expired API key (Bearer token required). An expired key returns message "API key expired".

## Response 401 fields (application/json):

  - `message` (string, required)
    e.g. "API key is required", "Invalid API key", or "API key expired"

  - `code` (string)
    Optional code e.g. MISSING_API_KEY when rate limiter runs before valid auth

## Response 403:

  - `403` (unknown)
    Forbidden – insufficient permissions

## Response 403 fields (application/json):

  - `message` (string, required)

## Response 404:

  - `404` (unknown)
    Resource not found (e.g. NOT_FOUND, RECORD_NOT_FOUND, EVENT_NOT_FOUND)

## Response 404 fields (application/json):

  - `message` (string, required)
    e.g. "Resource not found!" or "Record not found!"

## Response 429:

  - `429` (unknown)
    Rate limit exceeded. Each plan has its own allowance per endpoint per 10 seconds: Startup 20, Growth 50, Business 100. Response includes RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, and Retry-After headers.

## Response 429 fields (application/json):

  - `code` (string, required)
    Fixed code for rate limit responses
    Enum: "RATE_LIMIT_EXCEEDED"

  - `message` (string, required)
    e.g. "Too many requests, please try again later."

  - `retryAfter` (number)
    Seconds until the rate limit window resets

  - `limit` (object)
    The plan limit that was applied, per endpoint per 10 seconds: Startup 20, Growth 50, Business 100.

  - `limit.points` (number, required)

  - `limit.windowSec` (number, required)

## Response 429 headers (application/json):

  - `RateLimit-Limit` (string)
    Maximum requests allowed in the current window

  - `RateLimit-Remaining` (string)
    Requests remaining in the current window

  - `RateLimit-Reset` (string)
    ISO 8601 timestamp when the rate limit window resets

  - `Retry-After` (string)
    Seconds until the client can retry (when applicable)

## Response 500:

  - `500` (unknown)
    Internal server error. Unhandled errors return a generic message; no stack trace is ever returned.

## Response 500 fields (application/json):

  - `message` (string, required)
    Generic: "Something went wrong", or a safe error message

## Response 400 examples:

  - `A field was out of range` (unknown)

  - `The body carried a field the endpoint does not accept` (unknown)

## Response 401 examples:

  - `Missing API key` (unknown)

  - `Invalid API key` (unknown)

  - `Expired API key` (unknown)

  - `Missing auth when rate limiter runs first` (unknown)

## Response 404 examples:

  - `Generic not found` (unknown)

  - `Record not found` (unknown)

## Response 500 examples:

  - `Generic` (unknown)

  - `Error with message` (unknown)

