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

# Cancel campaign

> Cancels a campaign in `scheduled` OR `processing` status (extends the
legacy core-api endpoint, which only accepted `scheduled`) — a POST
action route instead of the legacy's DELETE, since this is a state
transition, not a resource deletion. Only dispatches still `pending`/
`processing` are canceled; already-finished ones are left untouched
(fixes the legacy's unconditional updateMany). The dispatch engine
(talqui-core-api) independently checks campaign.campaignStatus before
every send, so messages already in the SQS queue at the moment of
cancellation are skipped rather than sent once this lands.



## OpenAPI

````yaml /api/services-api.yaml post /v1/tenants/{tenantID}/campaigns/{campaignID}/cancel
openapi: 3.0.3
info:
  description: >-
    Talqui is an omnichannel customer service platform that unifies
    conversations from WhatsApp, Instagram, Telegram, and many other channels
    into a single attendant panel, alongside a broader ecosystem of plugins and
    integrations. This API gives developers programmatic access to Talqui's
    services layer, exposing the operations needed to read and manage tenants,
    conversations, plugins, and related resources that power that platform.


    Authentication is available on behalf of an Operator (the default for this
    API), a Plugin Connection, or a Plugin — see the [Talqui authentication
    guide](https://docs.talqui.chat/guides/introduction/authentication/) for how
    each token is obtained and when to use it.


    Need help or have questions not covered here? Reach out to
    support@talqui.com.
  license:
    name: ISC
    url: https://opensource.org/license/isc-license-txt
  title: Talqui - Services API
  version: 0.69.1
servers:
  - description: Production
    url: https://services-api.talqui.chat
security: []
tags:
  - name: Tenants
  - name: Settings
  - name: Analytics/Reports
  - name: Analytics
  - name: Campaigns
  - name: Campaigns/Models
  - name: Contacts
  - name: Contacts/Imports
  - name: Handoff links
  - name: Inboxes
  - name: Messages
  - name: Notifications
  - name: Sessions
  - name: Operators/Shortcuts
  - name: Operators
  - name: Plugins
  - name: Setup
  - name: Uploads
paths:
  /v1/tenants/{tenantID}/campaigns/{campaignID}/cancel:
    post:
      tags:
        - Campaigns
      summary: Cancel campaign
      description: |-
        Cancels a campaign in `scheduled` OR `processing` status (extends the
        legacy core-api endpoint, which only accepted `scheduled`) — a POST
        action route instead of the legacy's DELETE, since this is a state
        transition, not a resource deletion. Only dispatches still `pending`/
        `processing` are canceled; already-finished ones are left untouched
        (fixes the legacy's unconditional updateMany). The dispatch engine
        (talqui-core-api) independently checks campaign.campaignStatus before
        every send, so messages already in the SQS queue at the moment of
        cancellation are skipped rather than sent once this lands.
      operationId: CancelCampaignController
      parameters:
        - in: path
          name: tenantID
          required: true
          schema:
            type: string
        - in: path
          name: campaignID
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  alreadyProcessedCount:
                    description: >-
                      Dispatches already success/failure/canceled before this
                      call — untouched.
                    type: number
                  campaignID:
                    type: string
                  canceledCount:
                    description: >-
                      Dispatches that were pending/processing and are now
                      canceled.
                    type: number
                required:
                  - campaignID
                  - canceledCount
                  - alreadyProcessedCount
                type: object
          description: Response for status 200.
        '400':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      oneOf:
                        - $ref: '#/components/schemas/MissingTenantIDError'
                        - $ref: '#/components/schemas/MissingCampaignIDError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            MissingTenantIDError (error_code 1001): tenantID absent from the
            URL. | MissingCampaignIDError (error_code 1741): campaignID absent
            from the URL.
        '401':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/UnauthorizedError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: 'UnauthorizedError (error_code 1003): missing/invalid operator token.'
        '403':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/ForbiddenError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: 'ForbiddenError (error_code 1004): operator token rejected upstream.'
        '404':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/CampaignNotFoundError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            CampaignNotFoundError (error_code 1740): no campaign matches for
            this tenant.
        '422':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/CampaignNotAcceptCancelError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            CampaignNotAcceptCancelError (error_code 1780): campaign status is
            not scheduled or processing.
        '500':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/UnknownError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            UnknownError (error_code 5999): Unexpected internal error not
            otherwise documented for this endpoint.
      security:
        - operatorAuth: []
components:
  schemas:
    MissingTenantIDError:
      additionalProperties: false
      properties:
        error:
          enum:
            - MissingTenantIDError
          type: string
        error_code:
          enum:
            - 1001
          type: number
        message:
          example: tenantID is required.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    MissingCampaignIDError:
      additionalProperties: false
      properties:
        error:
          enum:
            - MissingCampaignIDError
          type: string
        error_code:
          enum:
            - 1741
          type: number
        message:
          example: campaignID is required.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    UnauthorizedError:
      additionalProperties: false
      properties:
        error:
          enum:
            - UnauthorizedError
          type: string
        error_code:
          enum:
            - 1003
          type: number
        message:
          example: You are not authorized to perform this request.
          type: string
        statusCode:
          enum:
            - 401
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    ForbiddenError:
      additionalProperties: false
      properties:
        error:
          enum:
            - ForbiddenError
          type: string
        error_code:
          enum:
            - 1004
          type: number
        message:
          example: You do not have access to this resource.
          type: string
        statusCode:
          enum:
            - 403
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    CampaignNotFoundError:
      additionalProperties: false
      properties:
        error:
          enum:
            - CampaignNotFoundError
          type: string
        error_code:
          enum:
            - 1740
          type: number
        message:
          example: Campaign not found.
          type: string
        statusCode:
          enum:
            - 404
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    CampaignNotAcceptCancelError:
      additionalProperties: false
      properties:
        error:
          enum:
            - CampaignNotAcceptCancelError
          type: string
        error_code:
          enum:
            - 1780
          type: number
        message:
          example: Only scheduled or processing campaigns can be canceled.
          type: string
        statusCode:
          enum:
            - 422
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    UnknownError:
      additionalProperties: false
      properties:
        error:
          enum:
            - UnknownError
          type: string
        error_code:
          enum:
            - 5999
          type: number
        message:
          example: For some unknown reason your request has not succeeded.
          type: string
        statusCode:
          enum:
            - 500
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
  securitySchemes:
    operatorAuth:
      bearerFormat: JWT
      description: >-
        Behalf of an Operator (default). A JWT issued by Talqui Core when an
        operator signs in, scoped to every tenant that operator belongs to. Send
        as `Authorization: Bearer <jwt-token>`.
      scheme: bearer
      type: http

````

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