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

# Call a customer on WhatsApp

> Calls one customer from the agent's WhatsApp number. When they allow the number to call them, the call is placed now (`call_placed`). When they have not, `permissionTemplate` is sent and the call is placed as soon as they allow it (`waiting_for_permission`); a decline or 24 hours without an answer ends it with a reason. Follow it with `GET /whatsapp/calls/{callRequestId}`. An unknown `branchId`, a template without a call permission request, or a workspace that cannot place WhatsApp calls is refused before anything is sent. A retry with the same `Idempotency-Key` gets the first request back. Needs a Full access key.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v2/agents/{agentId}/whatsapp/calls
openapi: 3.1.0
info:
  title: Centillion Labs API
  description: >-
    The public API of Centillion Labs: agents, their branches and versions,
    knowledge, tools and the secrets they send, chat, conversations, contacts,
    campaigns, batch calls, agent testing, issues and Helpdesk.
  version: 2.0.0
servers:
  - url: https://app.cntillion.com
security:
  - workspaceApiKey: []
  - workspaceApiKeyHeader: []
tags:
  - name: Agents
    description: Create, read, change, clone and delete agents.
  - name: Branches and versions
    description: Branches, drafts, immutable versions, merges, publishing and traffic.
  - name: Workflow and voice
    description: A branch's workflow and its voice settings.
  - name: Tools
    description: 'Workspace tools: HTTP, client, MCP server and code tools.'
  - name: Secrets
    description: >-
      Named credentials, such as an API key, that HTTP tools and MCP servers
      send as a header by naming the secret's id in
      `configuration.secretHeaders`. A value is encrypted when saved and never
      returned. A new value reaches every tool and published agent that uses the
      secret on its next call, with nothing to publish, and a secret can be
      deleted only once no tool and no published agent sends it.
  - name: Auth connections
    description: >-
      How the workspace's tools sign in to an API, kept once and named by id in
      an HTTP tool's or an MCP server's `configuration.authConnectionId` (or
      `configuration.page.authConnectionId` for a web form's link request).
      Secrets are encrypted when saved and never returned. A change reaches
      every tool and published agent that uses the connection on its next call,
      and a connection can be deleted only once nothing signs in with it.
  - name: Knowledge sources
    description: What an agent knows, and training it on that.
  - name: Chat
    description: Talk to an agent from your own systems.
  - name: Conversations
    description: Conversations, their messages, feedback and analysis.
  - name: Leads and contacts
    description: The leads and contacts an agent collected.
  - name: Contacts and enrollments
    description: Upsert contacts and enroll them in always-open campaigns.
  - name: Batch calls
    description: Outbound call batches, their recipients and their runs.
  - name: Campaigns
    description: >-
      Managed outbound calling: campaigns that call each lead within calling
      windows and retry, call back or redirect as their lead policy allows,
      their leads, calls and attention items, and the workspace's campaign
      settings.
  - name: WhatsApp
    description: WhatsApp templates and template messages.
  - name: Agent testing
    description: Workspace tests, agent suites, execution, and results.
  - name: Issues
    description: >-
      Issues an agent raised or a teammate flagged about how it behaves: triage,
      comment, merge and resolve.
  - name: Helpdesk
    description: Helpdesk tickets, their messages, teams and statuses.
  - name: Status
    description: Whether the API is up.
paths:
  /api/v2/agents/{agentId}/whatsapp/calls:
    post:
      tags:
        - WhatsApp
      summary: Call a customer on WhatsApp
      description: >-
        Calls one customer from the agent's WhatsApp number. When they allow the
        number to call them, the call is placed now (`call_placed`). When they
        have not, `permissionTemplate` is sent and the call is placed as soon as
        they allow it (`waiting_for_permission`); a decline or 24 hours without
        an answer ends it with a reason. Follow it with `GET
        /whatsapp/calls/{callRequestId}`. An unknown `branchId`, a template
        without a call permission request, or a workspace that cannot place
        WhatsApp calls is refused before anything is sent. A retry with the same
        `Idempotency-Key` gets the first request back. Needs a Full access key.
      operationId: startWhatsAppCall
      parameters:
        - name: agentId
          in: path
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 128
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            Between 1 and 128 characters. A retry with the same key and body
            gets the first answer back and writes nothing; the same key with
            another body is refused with `409`.
          schema:
            type: string
            minLength: 1
            maxLength: 128
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartWhatsAppCallRequest'
      responses:
        '201':
          description: Placed, or waiting on the customer.
          headers:
            Idempotent-Replayed:
              description: >-
                `true` when this is the stored answer to an earlier request with
                the same key.
              schema:
                type: string
                enum:
                  - 'true'
                  - 'false'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StartWhatsAppCallResponse'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '409':
          $ref: '#/components/responses/Error409'
        '413':
          $ref: '#/components/responses/Error413'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '502':
          $ref: '#/components/responses/Error502'
        '504':
          $ref: '#/components/responses/Error504'
components:
  schemas:
    StartWhatsAppCallRequest:
      type: object
      properties:
        branchId:
          description: >-
            A published branch of the agent the conversation runs on. Checked
            before anything is sent; left out, the live version answers.
          type: string
          minLength: 1
          maxLength: 100
        dynamicVariables:
          description: >-
            Values for the agent's dynamic variables, such as
            `{{customer_name}}`, kept for the conversation. Template values are
            not passed to the agent; repeat one here when the agent needs it.
            Names starting with `secret__` are refused.
          type: object
          propertyNames:
            type: string
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
          additionalProperties:
            anyOf:
              - type: string
                maxLength: 12000
              - type: number
              - type: boolean
        from:
          description: >-
            A `phoneNumberId` or `phoneNumber` from the template list. Required
            when the agent has more than one WhatsApp number.
          type: string
          minLength: 1
          maxLength: 64
        permissionTemplate:
          type: object
          properties:
            variables:
              description: >-
                A value for each of the template's variables, keyed as the
                template list names them.
              type: object
              properties:
                body:
                  type: object
                  propertyNames:
                    type: string
                    minLength: 1
                    maxLength: 64
                  additionalProperties:
                    type: string
                    maxLength: 4096
                buttons:
                  description: >-
                    A value for each button the template list marks `required`,
                    keyed by its `position`: the end of a URL button's link, or
                    a coupon code. A `quick_reply` button may take a payload,
                    which WhatsApp returns when the customer taps it.
                  type: object
                  propertyNames:
                    type: string
                    minLength: 1
                    maxLength: 64
                  additionalProperties:
                    type: string
                    maxLength: 4096
                header:
                  type: object
                  propertyNames:
                    type: string
                    minLength: 1
                    maxLength: 64
                  additionalProperties:
                    type: string
                    maxLength: 4096
              additionalProperties: false
            headerMedia:
              description: >-
                The file of a template whose `headerMedia` is `image`, `video`
                or `document`. Required for those templates.
              type: object
              properties:
                filename:
                  description: >-
                    The name a document shows under in WhatsApp. Defaults to the
                    link's file name.
                  type: string
                  minLength: 1
                  maxLength: 240
                link:
                  type: string
                  minLength: 1
                  maxLength: 2000
                  description: >-
                    A public `https://` link to the image, video or document.
                    Meta fetches it when it sends the message.
              required:
                - link
              additionalProperties: false
            language:
              description: >-
                Required when the template is approved in more than one
                language.
              type: string
              minLength: 1
              maxLength: 35
            name:
              type: string
              minLength: 1
              maxLength: 512
          required:
            - name
          additionalProperties: false
          description: >-
            An approved template with a call permission request, sent when the
            customer has not allowed this number to call them. Its values are
            given as a template send's are.
        to:
          type: string
          minLength: 1
          maxLength: 32
          description: >-
            The customer's WhatsApp number with its country code, such as
            `5215512345678`. A `+`, spaces and dashes are ignored.
      required:
        - permissionTemplate
        - to
      additionalProperties: false
    StartWhatsAppCallResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/WhatsAppCall'
      required:
        - data
    WhatsAppCall:
      type: object
      properties:
        callId:
          description: >-
            The voice call, once placed. Its conversation is in the agent's
            conversations.
          type:
            - string
            - 'null'
        expiresAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: >-
            While `waiting_for_permission`: when the request lapses without an
            answer.
        from:
          anyOf:
            - type: object
              properties:
                displayName:
                  type: string
                phoneNumber:
                  description: The number's digits, when its name shows them.
                  type:
                    - string
                    - 'null'
                phoneNumberId:
                  type: string
              required:
                - displayName
                - phoneNumber
                - phoneNumberId
            - type: 'null'
        id:
          type: string
          description: The call request, for `GET /whatsapp/calls/{callRequestId}`.
        permissionRequest:
          anyOf:
            - type: object
              properties:
                channelConversationId:
                  type: string
                messageId:
                  type: string
              required:
                - channelConversationId
                - messageId
            - type: 'null'
          description: >-
            The call permission request sent, when the customer had not allowed
            calls.
        reason:
          description: >-
            Why the call was not placed, when the status is `declined`,
            `expired` or `failed`.
          type:
            - string
            - 'null'
        status:
          type: string
          enum:
            - call_placed
            - waiting_for_permission
            - dialing
            - declined
            - expired
            - failed
          description: >-
            `call_placed` when the call went out; `waiting_for_permission` after
            the request was sent, until the customer answers or 24 hours pass;
            `dialing` while the call is placed after they allowed it;
            `declined`, `expired` or `failed` when it was not placed.
        to:
          type: string
      required:
        - callId
        - expiresAt
        - from
        - id
        - permissionRequest
        - reason
        - status
        - to
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable code, such as `NOT_FOUND`.
            message:
              type: string
              description: What went wrong, for a person.
            details:
              description: More about the failure, on some endpoints.
          required:
            - code
            - message
      required:
        - error
  responses:
    Error400:
      description: The request is invalid. `error.message` names the first problem.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error401:
      description: No valid workspace API key was sent.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error403:
      description: The key or the workspace's plan does not allow this request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error404:
      description: The endpoint, or a record it names, was not found in this workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error409:
      description: The record changed since it was read, or its state does not allow this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error413:
      description: The request body is too large.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error415:
      description: The request body is not of a media type this endpoint accepts.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error422:
      description: The request is well formed, but it cannot be carried out.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error429:
      description: Too many requests. Wait for `Retry-After` seconds.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error500:
      description: The request could not be completed. Try again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error502:
      description: A server this request depends on did not answer as expected.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error504:
      description: The request took too long. Try again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    workspaceApiKey:
      type: http
      scheme: bearer
      bearerFormat: cl_api_...
      description: >-
        A workspace API key from Workspace settings > API keys, sent as
        `Authorization: Bearer cl_api_...`. A Read only key can call the GET
        endpoints; every other method needs a Full access key.
    workspaceApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        The same workspace API key, for a gateway that keeps `Authorization` for
        itself.

````

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