> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apifycloud.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Outbound Messages

> Search outbound messages (campaign + direct) with complex filters

## Endpoint

`POST https://api.apifycloud.io/api/v1/analytics/{appId}/outbound-messages/search`

## Authentication

Bearer token required.

Scope: `messages:read`

## Path parameters

* `appId` (UUID, required)

## Request body

* `limit` (number, optional)
* `cursor` (string, optional)
* `status` (string, optional) one of `all`, `queued`, `sent`, `delivered`, `read`, `failed`
* `search` (string, optional) matches phone number, template, or campaign name
* `campaign` (string, optional) campaign name search
* `template` (string, optional) template name search
* `source` (string, optional) one of `all`, `campaign`, `direct`
* `tags` (array of strings, optional)
* `startDate` (string, optional) ISO date (YYYY-MM-DD)
* `endDate` (string, optional) ISO date (YYYY-MM-DD)

```json theme={null}
{
  "limit": 25,
  "status": "sent",
  "search": "promo",
  "source": "campaign",
  "tags": ["vip"]
}
```

## Response

```json theme={null}
{
  "data": [
    {
      "id": "uuid",
      "phone_number": "string",
      "status": "string",
      "source": "campaign",
      "template_name": "string",
      "campaign_name": "string",
      "created_at": "2024-01-01T00:00:00.000Z",
      "sent_at": "2024-01-01T00:00:00.000Z",
      "delivered_at": "2024-01-01T00:00:00.000Z",
      "read_at": "2024-01-01T00:00:00.000Z"
    }
  ],
  "meta": {
    "timestamp": "2024-01-01T00:00:00.000Z"
  },
  "pagination": {
    "limit": 25,
    "hasMore": false,
    "nextCursor": null
  }
}
```

## Errors

* `400 invalid_request` invalid JSON body
* `403 forbidden` unauthorized for app or missing scope
* `400 validation_error` invalid request parameters
* `429 rate_limit_exceeded`
* `500 server_error`

## Example

```bash theme={null}
curl -X POST "https://api.apifycloud.io/api/v1/analytics/{appId}/outbound-messages/search" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "limit": 25,
    "status": "sent",
    "source": "campaign",
    "tags": ["vip"]
  }'
```
