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

# Update variable

> Update a global variable, or a personal one of your own



## OpenAPI

````yaml PATCH /api/v1/agent-vault/variables/{variableId}
openapi: 3.0.3
info:
  title: Infisical API
  description: List of all available APIs that can be consumed
  version: 0.0.1
servers:
  - url: https://us.infisical.com
    description: Production server (US)
  - url: https://eu.infisical.com
    description: Production server (EU)
  - url: http://localhost:8080
    description: Local server
security: []
paths:
  /api/v1/agent-vault/variables/{variableId}:
    patch:
      tags:
        - Agent Vault Variables
      description: Update a global variable, or a personal one of your own
      operationId: updateAgentVaultVariable
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: variableId
          required: true
          description: The ID of the variable.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                key:
                  type: string
                  minLength: 1
                  maxLength: 64
                  pattern: ^[A-Z][A-Z0-9_]*$
                  description: >-
                    The name values use to refer to the variable, as `{{KEY}}`.
                    Starts with a letter and uses only upper case letters,
                    numbers and underscores.
                value:
                  type: string
                  minLength: 1
                  maxLength: 8192
                  pattern: ^[^\x00-\x1f\x7f]*$
                  description: >-
                    The value the proxy puts in place of each `{{KEY}}`. Omit to
                    keep the stored value.
              additionalProperties: false
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  variable:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: The ID of the variable.
                      key:
                        type: string
                        description: >-
                          The name values use to refer to the variable, as
                          `{{KEY}}`. Starts with a letter and uses only upper
                          case letters, numbers and underscores.
                      scope:
                        type: string
                        enum:
                          - global
                          - personal
                        description: >-
                          global for a variable admins set up for services, or
                          personal for one of your own, which only your personal
                          values can use and only you can see. Personal keys are
                          unique among your own variables.
                      usedByServices:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                              description: The ID of a service that uses this variable.
                            name:
                              type: string
                              description: The name of the service.
                            hostPattern:
                              type: string
                              description: The host pattern of the service.
                            accessBundleId:
                              type: string
                              format: uuid
                              description: >-
                                The ID of the access bundle the service belongs
                                to.
                            accessBundleName:
                              type: string
                              description: >-
                                The name of the access bundle the service
                                belongs to.
                          required:
                            - id
                            - name
                            - hostPattern
                            - accessBundleId
                            - accessBundleName
                          additionalProperties: false
                        description: >-
                          The services that use this variable, across every
                          access bundle, ordered by access bundle name and then
                          service name. For a personal variable, the services
                          whose personal values, as you set them, use it. A
                          variable in use can't be deleted.
                      createdAt:
                        type: string
                        format: date-time
                        description: When the variable was added.
                      updatedAt:
                        type: string
                        format: date-time
                        description: When the variable was last changed.
                    required:
                      - id
                      - key
                      - scope
                      - usedByServices
                      - createdAt
                      - updatedAt
                    additionalProperties: false
                required:
                  - variable
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 400
                  message:
                    type: string
                  error:
                    type: string
                  details: {}
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 401
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 403
                  message:
                    type: string
                  details: {}
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 404
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '422':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 422
                  message: {}
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 500
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false

````

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