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

# Upsert variables

> Creates or updates one or more custom variables in a single batch.
Variables scoped to a plugin connection require both a
pluginConnectionID and a pluginURN.



## OpenAPI

````yaml /api/services-api.yaml put /v1/tenants/{tenantID}/settings/variables
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.65.0
servers:
  - description: Production
    url: https://services-api.talqui.chat
security: []
tags:
  - name: Tenants
  - name: Settings
  - name: Analytics
  - name: Campaigns
  - name: Campaigns models
  - name: Contacts
  - name: Handoff links
  - name: Inboxes
  - name: Messages
  - name: Notifications
  - name: Sessions
  - name: Operators
  - name: Plugins
  - name: Setup
  - name: Uploads
paths:
  /v1/tenants/{tenantID}/settings/variables:
    put:
      tags:
        - Settings
      summary: Upsert variables
      description: |-
        Creates or updates one or more custom variables in a single batch.
        Variables scoped to a plugin connection require both a
        pluginConnectionID and a pluginURN.
      operationId: UpsertVariablesController
      parameters:
        - in: path
          name: tenantID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                variables:
                  description: Variables to create or update, matched by variableKey.
                  items:
                    properties:
                      pluginConnectionID:
                        description: >-
                          Required when variableType is "PLUGIN" — the
                          connection this variable belongs to.
                        nullable: true
                        type: string
                      pluginURN:
                        description: >-
                          Required when variableType is "PLUGIN" — the plugin
                          URN this variable belongs to.
                        nullable: true
                        type: string
                      variableDescription:
                        description: >-
                          Free-text description of what this variable is used
                          for.
                        nullable: true
                        type: string
                      variableKey:
                        description: Unique key used to reference this variable.
                        type: string
                      variableLabel:
                        description: Human-readable label for this variable.
                        type: string
                      variableType:
                        description: The scope this variable applies at.
                        enum:
                          - GLOBAL
                          - TENANT
                          - PLUGIN
                        type: string
                      variableValue:
                        description: The value stored for this variable.
                        type: string
                    required:
                      - variableKey
                      - variableLabel
                      - variableValue
                      - variableType
                    type: object
                  minItems: 1
                  type: array
              required:
                - variables
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  tenantID:
                    description: The tenant these variables belong to.
                    type: string
                  variables:
                    description: The created/updated variables.
                    items:
                      additionalProperties: false
                      properties:
                        createdAt:
                          description: When this variable was created.
                          format: date-time
                          type: string
                        deletedAt:
                          description: When this variable was soft-deleted, if applicable.
                          format: date-time
                          nullable: true
                          type: string
                        pluginConnectionID:
                          description: >-
                            The plugin connection this variable belongs to, when
                            scoped to a plugin.
                          nullable: true
                          type: string
                        pluginURN:
                          description: >-
                            The plugin URN this variable belongs to, when scoped
                            to a plugin.
                          nullable: true
                          type: string
                        tenantID:
                          description: The tenant this variable belongs to.
                          type: string
                        updatedAt:
                          description: When this variable was last updated, if ever.
                          format: date-time
                          nullable: true
                          type: string
                        variableDescription:
                          description: >-
                            Free-text description of what this variable is used
                            for.
                          nullable: true
                          type: string
                        variableID:
                          description: Unique identifier for this variable.
                          type: string
                        variableKey:
                          description: Unique key used to reference this variable.
                          type: string
                        variableLabel:
                          description: Human-readable label for this variable.
                          type: string
                        variableType:
                          description: The scope this variable applies at.
                          enum:
                            - GLOBAL
                            - TENANT
                            - PLUGIN
                          type: string
                        variableValue:
                          description: The value stored for this variable.
                          type: string
                      required:
                        - variableID
                        - tenantID
                        - variableKey
                        - variableLabel
                        - variableValue
                        - variableType
                        - createdAt
                      type: object
                    type: array
                required:
                  - tenantID
                  - variables
                type: object
          description: Response for status 200.
        '400':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      oneOf:
                        - $ref: '#/components/schemas/MissingTenantIDError'
                        - $ref: '#/components/schemas/RequestValidationError'
                        - $ref: '#/components/schemas/MissingPluginConnectionIDError'
                        - $ref: '#/components/schemas/MissingPluginURNError'
                        - $ref: '#/components/schemas/InvalidVariableScopeError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            MissingTenantIDError (error_code 1001): tenantID absent from the
            URL. | RequestValidationError (error_code 1002): request body fails
            schema validation. | MissingPluginConnectionIDError (error_code
            1200): variableType is "PLUGIN" but pluginConnectionID was not
            provided. | MissingPluginURNError (error_code 1200): variableType is
            "PLUGIN" but pluginURN was not provided. | InvalidVariableScopeError
            (error_code 1201): variableType does not match a supported scope for
            this operation.
        '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.'
        '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
    RequestValidationError:
      additionalProperties: false
      properties:
        error:
          enum:
            - RequestValidationError
          type: string
        error_code:
          enum:
            - 1002
          type: number
        fields:
          items:
            additionalProperties: false
            properties:
              allowed:
                type: string
              field:
                type: string
              received:
                type: string
            required:
              - field
              - received
              - allowed
            type: object
          type: array
        message:
          example: Invalid request data.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
        - fields
      type: object
    MissingPluginConnectionIDError:
      additionalProperties: false
      properties:
        error:
          enum:
            - MissingPluginConnectionIDError
          type: string
        error_code:
          enum:
            - 1200
          type: number
        message:
          example: pluginConnectionID is required for plugin-scoped operations.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    MissingPluginURNError:
      additionalProperties: false
      properties:
        error:
          enum:
            - MissingPluginURNError
          type: string
        error_code:
          enum:
            - 1200
          type: number
        message:
          example: pluginURN is required for plugin-scoped operations.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    InvalidVariableScopeError:
      additionalProperties: false
      properties:
        error:
          enum:
            - InvalidVariableScopeError
          type: string
        error_code:
          enum:
            - 1201
          type: number
        message:
          example: Variable type does not match the provided scope.
          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
    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.