> ## 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.

# Update a session

> This endpoint allows you to update the session keys of a specific user and continue the conversation started previously. The webhook triggered by the user's first response will provide the session_external_id needed for this request.



## OpenAPI

````yaml open-api-files/treble-api-en.json POST /session/{session_external_id}/update
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:
  /session/{session_external_id}/update:
    post:
      summary: Update user session and continue conversation
      description: >-
        This endpoint allows you to update the session keys of a specific user
        and continue the conversation started previously. The webhook triggered
        by the user's first response will provide the session_external_id needed
        for this request.
      parameters:
        - name: session_external_id
          in: path
          required: true
          description: >-
            External ID of the user's session. Obtained from the
            'session_external_id' field in the webhook response triggered by the
            user's first interaction.
          schema:
            type: string
          example: f33b4734a2e5db671b59877ed3f662ec1f6332a0418c25de4868e35a
        - name: content-type
          in: header
          required: true
          schema:
            type: string
            enum:
              - application/json
      requestBody:
        description: Information of the session keys to be updated
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_session_keys
              properties:
                user_session_keys:
                  type: array
                  description: List of user session keys to be updated
                  items:
                    $ref: '#/components/schemas/UserSessionKey'
            example:
              user_session_keys:
                - key: order
                  value: 1 Cheeseburger, 2 Sodas
      responses:
        '200':
          description: Session updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Confirmation message
                  session_id:
                    type: string
                    description: ID of the updated session
              example:
                message: Session updated successfully
                session_id: f33b4734a2e5db671b59877ed3f662ec1f6332a0418c25de4868e35a
        '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
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code
                  message:
                    type: string
                    description: Error description
components:
  schemas:
    UserSessionKey:
      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 in
            multi-channel companies.
        value:
          type: string
          description: >-
            Value of the variable. For 'deployment_squad', the value must be
            'DS_[CELLPHONE]'.

````