---
title: "Preview campaign"
method: POST
path: "/campaigns/preview"
tags: ["Campaigns"]
---

# Preview campaign

`POST /campaigns/preview`

## Request

- Base URL: `https://api.textla.com/v1`
- URL: `https://api.textla.com/v1/campaigns/preview`
- Auth: HTTP bearer

Validates the request as Create Campaign would and returns what the campaign's send would do — the audience's contact count and the carrier breakdown — without creating a campaign. An ISV account's preview also carries the estimated credit, the daily credit figures and the SMS segment histogram; an Enterprise preview carries the histogram without a price. `has_media` prices the preview as an MMS send.

## Request body

- PreviewCampaignBody
  - `$schema` string, uri: A URL to the JSON Schema for this object.
  - `audience` Audience, required
    - `all_contacts` boolean: Targets every contact. Must be true when set; cannot be combined with groups, keywords or tags.
    - `groups` Labels
      - `exclude` string[], nullable: Label names to exclude. Must not overlap include. At most 100.
      - `include` string[], nullable: Label names to match. At most 100.
      - `match` string: How include is applied: all, and, none or or. all takes no include values, none takes none. Defaults to and.
    - `keywords` Labels
      - `exclude` string[], nullable: Label names to exclude. Must not overlap include. At most 100.
      - `include` string[], nullable: Label names to match. At most 100.
      - `match` string: How include is applied: all, and, none or or. all takes no include values, none takes none. Defaults to and.
    - `tags` Labels
      - `exclude` string[], nullable: Label names to exclude. Must not overlap include. At most 100.
      - `include` string[], nullable: Label names to match. At most 100.
      - `match` string: How include is applied: all, and, none or or. all takes no include values, none takes none. Defaults to and.
  - `has_media` boolean, nullable: When true, prices the preview as an MMS send. Defaults to false.
  - `message` string, required: Message text, 1 to 1600 characters, with no leading whitespace. May use contact-field variables such as {{ first_name }}.
  - `name` string, required: Campaign name, 1 to 191 characters after trimming.
  - `phone_number` string, required: Sender number. Its carrier restriction excludes the contacts the send could not reach.
  - `send_at` integer, nullable: Send time in milliseconds since the Unix epoch, for example 1793541600000 (2026-11-01T14:00:00Z). Must be in the future. Omit for an immediate send.

## Response `200`

OK

- CampaignPreview
  - `$schema` string, uri: A URL to the JSON Schema for this object.
  - `carrier_excluded_count` integer, nullable, required
  - `carrier_unknown_count` integer, nullable, required
  - `contact_count` integer, required
  - `current_day_credit_usage` string, nullable, required
  - `daily_credit_limit` string, nullable, required
  - `estimated_credit` string, nullable, required
  - `segment_counts` PreviewSegmentCount[], nullable, required
    - `contact_count` integer, required
    - `segment_count` integer, required

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `412`: Precondition Failed
- `422`: Unprocessable Entity
- `429`: Too Many Requests
- `500`: Internal Server Error
- `501`: Not Implemented
- `502`: Bad Gateway
- `503`: Service Unavailable
- `504`: Gateway Timeout

---

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