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

# Update an environment variable

> Replaces a readable network environment variable. Its value is encrypted by the controller before it is stored.



## OpenAPI

````yaml https://controller.simplecloud.app/swagger/doc.json put /v0/environment-variables
openapi: 3.1.0
info:
  contact:
    name: SimpleCloud support
    url: https://discord.simplecloud.app
  description: >-
    Manage Minecraft networks, server groups, persistent servers, players, and
    plugins. Authenticate with Authorization: Bearer <JWT> or
    X-Network-Credential: <network password or JWT>. Bearer authentication takes
    precedence when both headers are supplied. Network-scoped operations also
    require X-Network-ID. JWT permissions and network membership restrict
    access; network passwords grant full access to their network, except that
    they cannot read the audit log. Registration requires an existing
    credential; password authentication also requires its existing network ID.
    The admin endpoint requires an admin JWT. Credential verification accepts
    credentials in the request body without authentication headers.
  title: SimpleCloud Controller API
  version: '1.0'
servers:
  - url: https://controller.simplecloud.app/
security: []
externalDocs:
  description: ''
  url: ''
paths:
  /v0/environment-variables:
    put:
      tags:
        - environment-variables
      summary: Update an environment variable
      description: >-
        Replaces a readable network environment variable. Its value is encrypted
        by the controller before it is stored.
      operationId: update_environment_variable
      parameters:
        - description: Network ID
          in: header
          name: X-Network-ID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/models.WriteEnvironmentVariableRequest'
              summary: request
              description: Environment variable key and plaintext value
        description: Environment variable key and plaintext value
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.UpdateEnvironmentVariableResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ErrorResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ErrorResponse'
          description: Internal Server Error
      security:
        - BearerAuth: []
        - NetworkCredential: []
components:
  schemas:
    models.WriteEnvironmentVariableRequest:
      description: Request for creating or updating an environment variable
      properties:
        key:
          example: JAVA_TOOL_OPTIONS
          type: string
        value:
          example: '-Xmx2G'
          type: string
      required:
        - key
        - value
      type: object
    models.UpdateEnvironmentVariableResponse:
      description: Response for updating an environment variable
      properties:
        environment_variable_id:
          example: 123e4567-e89b-12d3-a456-426614174000
          type: string
        key:
          example: JAVA_TOOL_OPTIONS
          type: string
        message:
          example: Environment variable updated successfully
          type: string
        value:
          example: '-Xmx2G'
          type: string
      type: object
    models.ErrorResponse:
      description: Generic error response
      properties:
        error:
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      description: >-
        JWT sent in Authorization: Bearer <token>. Access depends on the token's
        network membership and permissions. The admin endpoint requires admin
        claims.
      scheme: bearer
      type: http
    NetworkCredential:
      description: >-
        Network password or signed JWT. Password authentication also requires
        X-Network-ID and grants full access to that network, except the audit
        log. JWT permissions still apply.
      in: header
      name: X-Network-Credential
      type: apiKey

````

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