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

# Preview a broadcast

> Renders the template for the first pending recipients so you can check personalisation, encoding and segment counts before you launch. Nothing is sent and nothing is charged.



## OpenAPI

````yaml openapi-sms.yaml GET /broadcasts/{id}/preview
openapi: 3.0.3
info:
  title: Vobiz Messaging API
  description: >
    Send and receive SMS, MMS and RCS messages, buy messaging numbers, register
    for

    US 10DLC and toll-free, run broadcasts, manage conversations, opt-outs and
    webhooks.


    **Base URL:** `https://api.vobiz.ai/api/v1/sms`


    **Authentication:** every request needs the `X-Auth-ID` and `X-Auth-Token`
    headers.

    The account is taken from your credentials; you never put an account ID in a
    path or body.

    Field names in this API are camelCase.
  version: '1.0'
  contact:
    email: support@vobiz.ai
    url: https://vobiz.ai
servers:
  - url: https://api.vobiz.ai/api/v1/sms
    description: Production
security:
  - AuthID: []
    AuthToken: []
tags:
  - name: Messages
    description: Send messages and inspect their delivery state.
  - name: Numbers
    description: >-
      Messaging-capable numbers on your account, inventory search, purchase and
      release.
  - name: Coverage
    description: Where you can send, per country.
  - name: Conversations
    description: Two-way threads between one of your numbers and a contact.
  - name: Opt-outs
    description: Numbers that must not receive messages on a channel.
  - name: Webhooks
    description: Subscriptions that deliver message and broadcast events to your server.
  - name: Broadcasts
    description: Bulk sends from an uploaded recipient list.
  - name: RCS Senders
    description: RCS sender (agent) identities and their message templates.
  - name: 10DLC Brands
    description: US 10DLC brand registration.
  - name: 10DLC Campaigns
    description: US 10DLC campaigns, toll-free verification and supporting documents.
paths:
  /broadcasts/{id}/preview:
    get:
      tags:
        - Broadcasts
      summary: Preview a broadcast
      description: >-
        Renders the template for the first pending recipients so you can check
        personalisation, encoding and segment counts before you launch. Nothing
        is sent and nothing is charged. `missingVariables` lists placeholders
        that have no matching upload column; they render as empty text, so fix
        the template or re-upload before launching. `estimatedSegments` totals
        the segments across every pending recipient, not only the samples shown.
      operationId: preview-broadcast
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            The broadcast's `id` (UUID), as returned by `POST /broadcasts` or
            `GET /broadcasts`. An id that is not a UUID, or that belongs to
            another account, returns `404` with `broadcast not found`.
          schema:
            type: string
            format: uuid
          example: 3f8d2a6e-5b1c-4e7f-a9d0-2c4b6e8f1a35
        - name: limit
          in: query
          description: >-
            Number of pending recipients to render in `samples`, from 1 to 50.
            Defaults to 5 when you omit it or pass `0`. A value above 50 returns
            `400` with `limit must be between 1 and 50`, and a non-integer
            returns `400` with `limit must be an integer`.
          schema:
            type: integer
            minimum: 1
            maximum: 50
            default: 5
      responses:
        '200':
          description: Rendered samples and totals.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadcastPreview'
              example:
                samples:
                  - to: '+14155550123'
                    text: Hi Priya, your refund of $42.00 is on its way.
                    segments: 1
                    encoding: GSM-7
                  - to: '+14155550124'
                    text: Hi Sam, your refund of $18.50 is on its way.
                    segments: 1
                    encoding: GSM-7
                missingVariables: []
                estimatedSegments: 2
        '400':
          description: '`limit` is out of range.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: limit must be between 1 and 50
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: The broadcast does not exist on your account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: broadcast not found
      x-codeSamples:
        - lang: typescript
          label: Node SDK
          source: >
            import { VobizClient } from "@vobiz/sdk";


            const client = new VobizClient({ apiKey: "MA_XXXXXXXX", authToken:
            "YOUR_AUTH_TOKEN" });


            await client.sms.broadcasts.previewBroadcast({
                id: "3f8d2a6e-5b1c-4e7f-a9d0-2c4b6e8f1a35"
            })
        - lang: python
          label: Python SDK
          source: |
            from vobiz import Vobiz

            client = Vobiz(api_key="MA_XXXXXXXX", auth_token="YOUR_AUTH_TOKEN")

            client.sms.broadcasts.preview_broadcast(
                id="3f8d2a6e-5b1c-4e7f-a9d0-2c4b6e8f1a35",
            )
        - lang: go
          label: Go SDK
          source: |
            import (
                "context"

                vobiz "github.com/vobiz-ai/Vobiz-Go-SDK"
                "github.com/vobiz-ai/Vobiz-Go-SDK/client"
                "github.com/vobiz-ai/Vobiz-Go-SDK/option"
                "github.com/vobiz-ai/Vobiz-Go-SDK/sms"
            )

            c := client.NewClient(
                option.WithAPIKey("MA_XXXXXXXX"),
                option.WithAuthToken("YOUR_AUTH_TOKEN"),
            )

            request := &sms.PreviewBroadcastRequest{
                    ID: "3f8d2a6e-5b1c-4e7f-a9d0-2c4b6e8f1a35",
                }
            c.Sms.Broadcasts.PreviewBroadcast(
                    context.TODO(),
                    request,
                )
        - lang: java
          label: Java SDK
          source: |
            import com.vobiz.api.VobizApiClient;

            VobizApiClient client = VobizApiClient
                .builder()
                .apiKey("MA_XXXXXXXX")
                .authToken("YOUR_AUTH_TOKEN")
                .build();

            client.sms().broadcasts().previewBroadcast(
                "3f8d2a6e-5b1c-4e7f-a9d0-2c4b6e8f1a35",
                PreviewBroadcastRequest
                    .builder()
                    .build()
            );
        - lang: ruby
          label: Ruby SDK
          source: >
            require 'vobiz'


            client = Vobiz::Client.new(api_key: 'MA_XXXXXXXX', auth_token:
            'YOUR_AUTH_TOKEN')


            client.sms.broadcasts.preview_broadcast(id:
            "3f8d2a6e-5b1c-4e7f-a9d0-2c4b6e8f1a35")
        - lang: csharp
          label: C# SDK
          source: |
            using Vobiz;
            using Vobiz.Sms;

            var client = new VobizApiClient("YOUR_AUTH_TOKEN", "MA_XXXXXXXX");

            await client.Sms.Broadcasts.PreviewBroadcastAsync(
                new PreviewBroadcastRequest { Id = "3f8d2a6e-5b1c-4e7f-a9d0-2c4b6e8f1a35" }
            );
        - lang: php
          label: PHP SDK
          source: >
            <?php


            require 'vendor/autoload.php';


            use Vobiz\VobizClient;


            $client = new VobizClient(apiKey: 'MA_XXXXXXXX', authToken:
            'YOUR_AUTH_TOKEN');


            $client->sms->broadcasts->previewBroadcast(
                '3f8d2a6e-5b1c-4e7f-a9d0-2c4b6e8f1a35',
                new PreviewBroadcastRequest([]),
            );
components:
  schemas:
    BroadcastPreview:
      type: object
      properties:
        samples:
          type: array
          description: >-
            The template rendered for up to `limit` pending recipients, in
            upload order. Empty when no recipient is pending.
          items:
            $ref: '#/components/schemas/BroadcastPreviewSample'
        missingVariables:
          type: array
          description: >-
            Placeholders in the template that have no matching upload column.
            They render as empty text; an empty array means every placeholder is
            filled.
          items:
            type: string
          example: []
        estimatedSegments:
          type: integer
          description: >-
            Total SMS segments across all pending recipients. Multiply by your
            per-segment rate to estimate the cost of the launch.
          example: 3
      description: >-
        The template rendered for the first pending recipients, with the
        information you need to check a broadcast before launching it.
    Error:
      type: object
      description: >-
        The body of every error response: a flat object with one `error` string
        that explains what went wrong. Use the HTTP status code to decide how to
        handle the error, and log `error` for diagnosis.
      required:
        - error
      properties:
        error:
          type: string
          example: 'recipient has opted out: +14155550123'
          description: >-
            Human-readable explanation of the error, for example `phoneNumber is
            required` or `recipient has opted out: +14155550123`. Branch on the
            HTTP status code rather than on this text.
    BroadcastPreviewSample:
      type: object
      properties:
        to:
          type: string
          example: '+14155550123'
          description: The recipient's number in E.164 format.
        text:
          type: string
          description: >-
            The exact message text this recipient will receive, with their
            variables filled.
          example: Hi Priya, your refund of $42.00 is on its way.
        segments:
          type: integer
          description: Number of SMS segments this text is sent and billed as.
          example: 1
        encoding:
          type: string
          enum:
            - GSM-7
            - UCS-2
          description: >-
            `GSM-7` when every character is in the GSM alphabet (160 characters
            in a single segment). `UCS-2` when the text contains other
            characters, such as emoji or most non-Latin scripts (70 characters
            in a single segment).
          example: GSM-7
      description: >-
        The template rendered for one recipient, with the encoding and segment
        count it will be sent with.
  responses:
    Unauthorized:
      description: Missing or invalid `X-Auth-ID` / `X-Auth-Token`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: missing or invalid credentials
  securitySchemes:
    AuthID:
      type: apiKey
      in: header
      name: X-Auth-ID
      description: Your Vobiz account Auth ID (`MA_XXXXXXXX`).
    AuthToken:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: Your Vobiz account Auth Token.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.