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

# Create or update team environment variable

> Stores encrypted values and never returns secret values. Idempotent: reusing an existing name updates it. Names use `UPPERCASE_WITH_UNDERSCORES` and are normalized automatically (a lowercase `name1` is stored as `NAME1`). Requires a team API key (`bzy_team_*`) or internal auth.



## OpenAPI

````yaml /openapi/v1.json post /teams/{id}/env-vars
openapi: 3.1.0
info:
  title: Bugzy API
  description: >-
    Programmatic access to Bugzy's QA automation capabilities. Trigger test
    runs, query results, manage schedules, and configure event triggers.
  version: 1.0.0
  contact:
    name: Bugzy Support
    url: https://www.bugzy.ai
servers:
  - url: https://bugzy.ai/api/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /teams/{id}/env-vars:
    post:
      tags:
        - Team Environment Variables
      summary: Create or update team environment variable
      description: >-
        Stores encrypted values and never returns secret values. Idempotent:
        reusing an existing name updates it. Names use
        `UPPERCASE_WITH_UNDERSCORES` and are normalized automatically (a
        lowercase `name1` is stored as `NAME1`). Requires a team API key
        (`bzy_team_*`) or internal auth.
      operationId: upsertTeamEnvVar
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: >-
                    Normalized to UPPERCASE_WITH_UNDERSCORES; must match
                    ^[A-Z_][A-Z0-9_]*$ after normalization.
                  example: BASE_URL
                value:
                  type: string
                is_secret:
                  type: boolean
                  default: true
                environment:
                  type: string
                environment_id:
                  type: string
                  format: uuid
              required:
                - name
                - value
      responses:
        '201':
          description: Team env var stored
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/EnvVar'
        '400':
          description: >-
            Invalid name (not a valid UPPERCASE_WITH_UNDERSCORES identifier
            after normalization) or missing required field
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Referenced environment does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Concurrent create conflict for the same name
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    EnvVar:
      type: object
      properties:
        name:
          type: string
          example: BASE_URL
        has_value:
          type: boolean
        is_secret:
          type: boolean
        environment_id:
          type: string
          format: uuid
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: NOT_FOUND
            message:
              type: string
              example: Execution not found
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Project API key (bzy_proj_*) for project routes or team API key
        (bzy_team_*) for selected team routes.

````