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

# Deploy a conversation flow

> This endpoint allows you to deploy a conversation to a list of users defined by their phone number and country code. It also allows you to schedule deployments for a future date.

<Warning>
  Remember that to use this endpoint, you must have obtained your API key in the **Developers** section of the Treble platform.
</Warning>

## Select which number deploys (multichannel companies)

For multichannel companies, you can select which cellphone will deploy the user with `user_session_keys`. If you want the first number to make the deployment, you can just add the key `deployment_squad` and the corresponding value will be `DS_[CELLPHONE]`. You may add several deployment squads so several numbers can deploy.

```json theme={null}
"user_session_keys": [
  {
    "key": "deployment_squad",
    "value": "DS_[CELLPHONE]"
  }
]
```


## OpenAPI

````yaml open-api-files/treble-api-en.json POST /deployment/api/poll/{poll_id}
openapi: 3.0.1
info:
  title: Treble Poll API
  description: Documentation for the poll deployment endpoint in Treble
  version: 1.0.0
servers:
  - url: https://main.treble.ai
    description: Main Treble server
  - url: https://yourdomain.com
    description: >-
      Example server for implementing webhooks. This represents YOUR server
      where you must implement the endpoints that Treble will call.
security: []
tags:
  - name: Webhooks
    description: >-
      Endpoints that Treble will call on your server. These are not real
      endpoints that you can call, but a representation of the webhooks that
      Treble will invoke in your system.
paths:
  /deployment/api/poll/{poll_id}:
    post:
      summary: Deploy a poll to specific users
      description: >-
        This endpoint allows you to deploy a conversation to a list of users
        defined by their phone number and country code. It also allows you to
        schedule deployments for a future date.
      parameters:
        - name: poll_id
          in: path
          required: true
          description: ID of the poll you want to deploy
          schema:
            type: string
        - name: Authorization
          in: header
          required: true
          description: >-
            Authorization API Key. Can be obtained at
            https://app.treble.ai/en/dashboard/settings/developers
          schema:
            type: string
          example: API_KEY
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            enum:
              - application/json
      requestBody:
        description: Information of the users to whom the poll will be deployed
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - users
              properties:
                users:
                  type: array
                  description: List of users to whom the poll will be deployed
                  items:
                    type: object
                    required:
                      - cellphone
                      - country_code
                      - user_session_keys
                    properties:
                      cellphone:
                        type: string
                        description: >-
                          User's phone number without the country code (e.g.,
                          '3051234567')
                      country_code:
                        type: string
                        description: Country code with the + symbol (e.g., '+57')
                      user_session_keys:
                        type: array
                        description: >-
                          Variables that can be replaced in question texts or
                          delivered when a webhook is called. For multi-channel
                          companies, you can include the 'deployment_squad' key
                          to select which phone number will perform the
                          deployment.
                        items:
                          type: object
                          required:
                            - key
                            - value
                          properties:
                            key:
                              type: string
                              description: >-
                                Name of the variable. Special values include
                                'deployment_squad' to select which phone number
                                will perform the deployment.
                            value:
                              type: string
                              description: >-
                                Value of the variable. For 'deployment_squad',
                                the value must be 'DS_[CELLPHONE]'.
                      deployment_eta:
                        type: integer
                        description: >-
                          UNIX UTC timestamp to schedule the deployment for a
                          future date (optional). Example: 1615823201 (March 15,
                          2021, 3:46:41 PM UTC)
            examples:
              Basic example:
                value:
                  users:
                    - cellphone: '3051234567'
                      country_code: '+57'
                      user_session_keys:
                        - key: name
                          value: John
                        - key: TransID
                          value: '12345'
                        - key: schoolname
                          value: Redschool
              Example with deployment_eta:
                value:
                  users:
                    - cellphone: '3051234567'
                      country_code: '+57'
                      user_session_keys:
                        - key: name
                          value: Jhon
                      deployment_eta: 1615823201
              Example with deployment_squad:
                value:
                  users:
                    - cellphone: '3051234567'
                      country_code: '+57'
                      user_session_keys:
                        - key: name
                          value: Jhon
                        - key: deployment_squad
                          value: DS_[CELLPHONE]
      responses:
        '200':
          description: The poll was deployed correctly
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Confirmation message
                  id:
                    type: string
                    description: Deployment ID
                  batch_id:
                    type: string
                    description: Batch deployment ID
                  new_last_scheduleded_deployment:
                    type: string
                    format: date-time
                    description: Date and time of the last scheduled deployment
                  conversations_id:
                    type: array
                    items:
                      type: string
                    description: List of IDs of the created conversations
              example:
                message: The poll was deployed
                id: 5f8d7e6a5f8d7e6a5f8d7e6a
                batch_id: 5f8d7e6a5f8d7e6a5f8d7e6b
                new_last_scheduleded_deployment: '2021-03-15T15:46:41Z'
                conversations_id:
                  - 5f8d7e6a5f8d7e6a5f8d7e6c
        '400':
          description: Error in the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code
                  message:
                    type: string
                    description: Error description
        '401':
          description: Unauthorized. Invalid or missing API Key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code
                  message:
                    type: string
                    description: Error description
        '404':
          description: Poll not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code
                  message:
                    type: string
                    description: Error description

````