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

# Cancel a campaign

> As `POST /v1/broadcasts/{broadcastId}/cancel`. Recipients not yet sent are skipped; messages already queued may still be delivered.



## OpenAPI

````yaml /api-reference/v2/openapi.json post /v2/campaigns/{campaignId}/cancel
openapi: 3.0.3
info:
  title: Zavu API v2
  version: 2.0.0
  description: >-
    The second version of the Zavu API. It runs on the same engine as /v1: the
    same API keys, the same per-project rate limit, the same sending limits,
    prices and reviews. /v1 keeps working unchanged, and you can mix calls to
    both.


    **Addresses, not senders.** /v2 has no sender object. Where a message leaves
    from is named the way the recipient sees it: an E.164 number, an email
    address, `@botname` for Telegram, `@username` for Instagram, the Facebook
    Page id for Messenger, and the literal `sms_oneway` for one-way SMS (sent
    from shared numbers, never a number of your own). `GET /v2/channels` lists
    one entry per (address, type); a number that carries WhatsApp and SMS is two
    entries with the same address.


    **What else changes.** No `Zavu-Sender` header (`from` or `conversationId`
    instead); every send reports how it was routed; one project webhook carries
    every event; every error is `{code, message, details}` at the root.


    **Wrong method.** A path under `/v2/messages`, `/v2/conversations`,
    `/v2/contacts`, `/v2/channels`, `/v2/templates`, `/v2/campaigns`,
    `/v2/agents`, `/v2/webhook` or `/v2/email-domains` called with a method it
    does not take answers `405 method_not_allowed`, with `details.allowed` and
    an `Allow` header.


    **Money.** Every amount is USD, rounded to 6 decimals.
servers:
  - url: https://api.zavu.dev
security:
  - bearerAuth: []
tags:
  - name: Messages
    description: Send, list and read messages.
  - name: Conversations
    description: Inbox threads, one per contact across channels.
  - name: Contacts
    description: Contacts and the identifiers they are reached at.
  - name: Channels
    description: 'Where the project can send from: one entry per (address, type).'
  - name: Templates
    description: WhatsApp message templates.
  - name: Campaigns
    description: One message to many recipients.
  - name: Webhook
    description: The one project webhook for every event.
  - name: Agents
    description: AI agents and the addresses they answer on.
  - name: Numbers
    description: Search and buy phone numbers.
  - name: Email Domains
    description: Domains to send email from.
  - name: Functions
    description: Configure Zavu Functions.
paths:
  /v2/campaigns/{campaignId}/cancel:
    post:
      tags:
        - Campaigns
      summary: Cancel a campaign
      description: >-
        As `POST /v1/broadcasts/{broadcastId}/cancel`. Recipients not yet sent
        are skipped; messages already queued may still be delivered.
      operationId: cancelCampaignV2
      parameters:
        - name: campaignId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Cancelled.
          content:
            application/json:
              schema:
                type: object
                required:
                  - campaign
                properties:
                  campaign:
                    $ref: '#/components/schemas/Broadcast'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Campaign not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            `invalid_status`: the campaign has finished and cannot be cancelled
            (`details.status`). /v1 answers this `400`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    Broadcast:
      type: object
      required:
        - id
        - name
        - status
        - channel
        - messageType
        - totalContacts
        - createdAt
      properties:
        id:
          type: string
          example: brd_abc123
        name:
          type: string
        status:
          $ref: '#/components/schemas/BroadcastStatus'
        channel:
          $ref: '#/components/schemas/BroadcastChannel'
        messageType:
          $ref: '#/components/schemas/BroadcastMessageType'
        text:
          type: string
        content:
          $ref: '#/components/schemas/BroadcastContent'
        emailSubject:
          type: string
        totalContacts:
          type: integer
          description: Total number of contacts in the broadcast.
        pendingCount:
          type: integer
        sendingCount:
          type: integer
        sentCount:
          type: integer
          description: >-
            Recipients whose message the provider accepted, without a confirmed
            delivery yet. Channels that never report delivery keep their
            recipients here.
        deliveredCount:
          type: integer
          description: Recipients with confirmed delivery to the device.
        failedCount:
          type: integer
        estimatedCost:
          type: number
          nullable: true
          description: Estimated total cost in USD.
        reservedAmount:
          type: number
          nullable: true
          description: Amount reserved from balance in USD.
        actualCost:
          type: number
          nullable: true
          description: Actual cost so far in USD.
        scheduledAt:
          type: string
          format: date-time
        startedAt:
          type: string
          format: date-time
        completedAt:
          type: string
          format: date-time
        metadata:
          type: object
          additionalProperties:
            type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        reviewResult:
          type: object
          nullable: true
          description: AI content review result.
          properties:
            score:
              type: number
              description: >-
                Content safety score from 0.0 to 1.0, where 1.0 is completely
                safe.
            categories:
              type: array
              items:
                type: string
              description: Policy categories violated, if any.
            reasoning:
              type: string
              description: Explanation of the review decision.
            reviewedAt:
              type: string
              format: date-time
            flaggedContent:
              type: array
              items:
                type: string
              nullable: true
              description: Problematic text fragments, if any.
        reviewAttempts:
          type: integer
          nullable: true
          description: Number of review attempts (max 3).
        from:
          type: string
          nullable: true
          description: >-
            The address the campaign is sent from, for its `channel` (the
            sender's first address when `channel` is `smart`).
      description: >-
        A campaign. The same object as a /v1 broadcast: its `id` works on
        `/v1/broadcasts/{broadcastId}`.
    Error:
      type: object
      required:
        - code
        - message
      description: >-
        Every v2 error has this shape at the root. There is no `{error: {...}}`
        wrapper anywhere in v2. A missing resource is `404 not_found` with the
        message `<Resource> not found`; an address the project does not have is
        `404 not_found`, `None of this project's channels has the address
        <address>.`, with the address in `details` under the name the request
        used (`from` or `address`). A `message` is written for the caller and
        never carries a stack trace or a source path. A body that is not JSON is
        `400 invalid_json`, with `details.errors` (`path: []`, the parse error
        in `message`).
      properties:
        code:
          type: string
          example: invalid_request
        message:
          type: string
        details:
          type: object
          additionalProperties: true
          description: >-
            Machine-readable context. Keys that mean the same thing everywhere:

            - `errors`: present on every `400 invalid_request` for an invalid
            body or query parameter, `[{path, message, ...}]`, `path` naming the
            field (`["to"]`, `["contacts", 2, "recipient"]`, `["limit"]`).

            - `recommendation`: one sentence saying what to do next.

            - `dashboardUrl`: the dashboard screen that fixes it.

            - `connect`: on `409 no_channel`, the channels this project can
            connect to reach the recipient, each `{type, request, note,
            available, dashboardUrl?}`; `request` is the exact call (`POST
            /v2/channels` with its body, or `POST /v2/numbers`), or null for a
            channel connected from the dashboard (WhatsApp, Instagram,
            Messenger). `available: false` says why in `note` (one-way SMS
            closed until business verification is approved).

            - `address` / `from`: the address the error is about, under the name
            the request used for it.
          properties:
            errors:
              type: array
              items:
                type: object
                required:
                  - path
                  - message
                properties:
                  path:
                    type: array
                    items:
                      oneOf:
                        - type: string
                        - type: integer
                  message:
                    type: string
                  code:
                    type: string
                additionalProperties: true
    BroadcastStatus:
      type: string
      description: >-
        Current status of the campaign. `pending_review`: in the automated
        content review. `pending_admin_review`: the automated review passed and
        it waits for a person, which is where every channel but a WhatsApp
        campaign on an approved template goes. `rejected`: the review refused
        it; edit it and send again, or escalate. `scheduled` and `sending`
        follow approval.
      enum:
        - draft
        - pending_review
        - pending_admin_review
        - approved
        - rejected
        - escalated
        - rejected_final
        - scheduled
        - sending
        - paused
        - completed
        - cancelled
        - failed
    BroadcastChannel:
      type: string
      description: >-
        Broadcast delivery channel. Use 'smart' for per-contact intelligent
        routing.
      enum:
        - smart
        - sms
        - sms_oneway
        - whatsapp
        - telegram
        - email
    BroadcastMessageType:
      type: string
      description: Type of message for broadcast.
      enum:
        - text
        - image
        - video
        - audio
        - document
        - template
    BroadcastContent:
      type: object
      description: Content for non-text broadcast message types.
      properties:
        mediaUrl:
          type: string
          description: URL of the media file.
        mediaId:
          type: string
          description: Media ID if already uploaded.
        mimeType:
          type: string
          description: MIME type of the media.
        filename:
          type: string
          description: Filename for documents.
        templateId:
          type: string
          description: Template ID for template messages.
        templateVariables:
          type: object
          description: >-
            Default body variables (can be overridden per contact). Key them to
            match the template body: by position (`1`, `2`, ...) for positional
            templates, or by name (e.g. `customer_name`) for named templates.
            Zavu detects the template's format and sends the correct payload to
            Meta. Do not mix positional and named keys.
          additionalProperties:
            type: string
        templateButtonVariables:
          type: object
          description: >-
            Default button variables for dynamic URL/OTP buttons. Keys are the
            button index (0, 1, 2). Per-contact values override these.
          additionalProperties:
            type: string
        templateHeaderVariables:
          type: object
          description: >-
            Default value for a text-header variable, keyed by `1` (can be
            overridden per contact). If omitted, Zavu resolves the header from
            `templateVariables` by the header placeholder's name.
          additionalProperties:
            type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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