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

# Update variable

> Updates the variables in a conversation, such as the contact's phone or email, or conversation details like company.



## OpenAPI

````yaml POST /v1/accounts/{account_id}/conversations/{conversation_id}/variables
openapi: 3.1.0
info:
  title: WotNot API
  version: 1.0.0
  description: 'WotNot API: Update variable.'
servers:
  - url: https://api.wotnot.io
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/accounts/{account_id}/conversations/{conversation_id}/variables:
    post:
      summary: Update variable
      description: >-
        Updates the variables in a conversation, such as the contact's phone or
        email, or conversation details like company.
      operationId: updateVariable
      parameters:
        - name: account_id
          in: path
          required: true
          description: The ID of your WotNot account.
          schema:
            type: string
        - name: conversation_id
          in: path
          required: true
          description: >-
            The ID of the conversation to update. It's the `conversation.id` you
            get back from Create conversation.
          schema:
            type: string
      requestBody:
        required: true
        description: The variables to update.
        content:
          application/json:
            schema:
              type: object
              required:
                - variables
              properties:
                variables:
                  type: array
                  minItems: 1
                  description: The variables to update. Send at least one.
                  items:
                    type: object
                    required:
                      - name
                      - type
                      - value
                    properties:
                      name:
                        type: string
                        description: The variable's name, for example `name` or `company`.
                        example: name
                      type:
                        type: string
                        description: >-
                          The kind of variable, for example `conversation` or
                          `contact`.
                        example: conversation
                      value:
                        type: string
                        description: The new value, for example `John Doe`.
                        example: John Doe
            example:
              variables:
                - name: name
                  type: conversation
                  value: John Doe
                - name: phone
                  type: contact
                  value: '9999999999'
                - name: company
                  type: conversation
                  value: Example
                - name: email
                  type: contact
                  value: john.doe@gmail.com
      responses:
        '200':
          description: The variables were updated. Returns `ok` set to `true`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                properties:
                  ok:
                    type: boolean
                    description: '`true` when the request worked. Errors return `false`.'
                    example: true
              example:
                ok: true
        '400':
          description: >-
            Something in the body is invalid, for example `variables` is empty.
            `message` lists the problems for each field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FieldErrors'
              example:
                ok: false
                message:
                  variables:
                    - Shorter than minimum length 1.
                status: 400
                error: BAD_REQUEST
        '401':
          description: >-
            The token is missing or wrong. Check that the `Authorization` header
            is `Bearer` followed by your account token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: UNAUTHORIZED
                ok: false
                status: 401
                message: Invalid token. Provide the valid account token.
        '404':
          description: No conversation was found with this `conversation_id`. Check the ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodedError'
              example:
                message: Conversation is not found
                ok: false
                error: CONVERSATION_NOT_FOUND
                code: CONVERSATION_NOT_FOUND
                status: 404
components:
  schemas:
    FieldErrors:
      type: object
      description: >-
        Returned when fields in the request body are invalid. Lists the problems
        for each field.
      required:
        - ok
        - message
        - status
        - error
      properties:
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        message:
          type: object
          description: >-
            The fields that have problems. Each key is a field name, and its
            value lists what's wrong with it.
          additionalProperties:
            type: array
            description: >-
              What's wrong with this field, for example `Shorter than minimum
              length 1.`
            items:
              type: string
        status:
          type: integer
          description: The HTTP status code, repeated in the body.
          example: 400
        error:
          type: string
          description: '`BAD_REQUEST` for this kind of error.'
          example: BAD_REQUEST
    Error:
      type: object
      description: Returned whenever a request fails.
      required:
        - error
        - ok
        - status
        - message
      properties:
        error:
          type: string
          description: >-
            A short error code in capital letters, for example `UNAUTHORIZED`.
            Check this in your code to tell errors apart.
          example: UNAUTHORIZED
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        status:
          type: integer
          description: The HTTP status code, repeated in the body, for example `401`.
          example: 401
        message:
          type: string
          description: What went wrong and how to fix it, in plain words.
          example: Invalid token. Provide the valid account token.
    CodedError:
      type: object
      description: An error with a short code that says what went wrong.
      required:
        - ok
        - message
        - error
        - code
      properties:
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        message:
          type: string
          description: What went wrong, in plain words.
          example: Please reach out to support to use this feature
        error:
          type: string
          description: >-
            A short error code in capital letters, for example
            `UNAUTHORIZED_FEATURE`. Check this in your code to tell errors
            apart.
          example: UNAUTHORIZED_FEATURE
        code:
          type: string
          description: A code for the result. In these examples it matches `error`.
          example: UNAUTHORIZED_FEATURE
        status:
          type: integer
          description: >-
            The HTTP status code, repeated in the body. Not every error includes
            it.
          example: 401
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All of WotNot's APIs use Bearer token authentication. Send your account
        token as `Bearer <token>`. You can find it in Settings > Account
        Settings > Developer. Keep it on your server: anyone who has it can call
        the API as your account.

````

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