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

# Create or replace a team environment variable

> Creates the variable in the selected environment scope or updates the existing variable with the same normalized name. Plaintext values are never returned.



## OpenAPI

````yaml /openapi/v1.json post /teams/{teamSlug}/env-vars
openapi: 3.1.0
info:
  title: Felan API
  description: >-
    Team-scoped access to Felan sessions, integrations, environments,
    environment variables, automations, and inbound events.
  version: 1.0.0
  contact:
    name: Felan Support
    url: https://felan.ai
servers:
  - url: https://app.felan.ai/api/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Teams
  - name: Integrations
  - name: Environments
  - name: Environment Variables
  - name: Automations
  - name: Sessions
  - name: Events
  - name: OpenAPI
paths:
  /teams/{teamSlug}/env-vars:
    post:
      tags:
        - Environment Variables
      summary: Create or replace a team environment variable
      description: >-
        Creates the variable in the selected environment scope or updates the
        existing variable with the same normalized name. Plaintext values are
        never returned.
      operationId: upsertTeamEnvironmentVariable
      parameters:
        - $ref: '#/components/parameters/TeamSlug'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnvironmentVariableCreateInput'
      responses:
        '201':
          description: Environment variable stored
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/EnvironmentVariable'
        '400':
          description: Missing or invalid environment-variable field
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Concurrent create conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    TeamSlug:
      name: teamSlug
      in: path
      required: true
      description: Felan team slug shown in dashboard URLs and Team Settings
      schema:
        type: string
        minLength: 1
  schemas:
    EnvironmentVariableCreateInput:
      type: object
      required:
        - name
        - value
      properties:
        name:
          type: string
          description: Trimmed and uppercased before validation against ^[A-Z_][A-Z0-9_]*$.
          example: BASE_URL
        value:
          type: string
        is_secret:
          type: boolean
          default: true
        source:
          type: string
          default: user
        metadata:
          type: object
          additionalProperties: true
        environment:
          type: string
          description: Environment slug
        environment_id:
          type: string
          format: uuid
    EnvironmentVariable:
      type: object
      required:
        - id
        - team_id
        - name
        - has_value
        - is_secret
        - environment_id
        - source
        - metadata
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        team_id:
          type: string
          format: uuid
        name:
          type: string
          example: BASE_URL
        has_value:
          type: boolean
        is_secret:
          type: boolean
        environment_id:
          type:
            - string
            - 'null'
          format: uuid
        source:
          type: string
        source_scope:
          type: string
          enum:
            - default
            - environment
        metadata:
          type: object
          additionalProperties: true
        created_by:
          type:
            - string
            - 'null'
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              examples:
                - VALIDATION_ERROR
                - UNAUTHORIZED
                - NOT_FOUND
                - EXECUTION_DENIED
                - CONFLICT
                - RATE_LIMITED
                - SESSION_START_FAILED
                - SESSION_PUBLISH_FAILED
                - MESSAGE_PUBLISH_FAILED
                - INTERNAL_ERROR
            message:
              type: string
  responses:
    Unauthorized:
      description: Missing or invalid team API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource missing or outside the authenticated team
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Team API key rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: The server could not complete the request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Team API key. Current keys retain the bzy_team_ compatibility prefix.

````