> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-support-migration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Upsert Variable



## OpenAPI

````yaml https://core-api-public-docs.b-cdn.net/docs/v3/compute.json put /compute/script/{id}/variables
openapi: 3.0.0
info:
  title: bunny.net Compute API
  description: >-
    <img src='https://bunny.net/v2/images/bunnynet-logo-dark.svg' style='width:
    200px;' alt='bunny.net Logo'>
                   Edge Scripts and Compute API documentation for bunny.net. This API provides endpoints for managing edge scripts, releases, secrets, variables, and other compute-related resources.
  termsOfService: https://bunny.net/tos
  contact:
    name: bunny.net
    url: https://docs.bunny.net
    email: support@bunny.net
  version: 1.0.0
servers:
  - url: https://api.bunny.net
    description: bunny.net API Server
security:
  - AccessKey: []
paths:
  /compute/script/{id}/variables:
    put:
      tags:
        - Variable
      summary: Upsert Variable
      operationId: UpsertEdgeScriptVariableEndpoint_UpsertEdgeScriptVariable
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the script which will have the variable upserted
          schema:
            type: integer
            format: int64
          x-position: 1
      requestBody:
        x-name: model
        description: The variable that will be upserted
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertEdgeScriptVariableModel'
        required: true
        x-position: 2
      responses:
        '200':
          description: The variable was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EdgeScriptVariableModel'
        '204':
          description: The variable was updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EdgeScriptVariableModel'
        '401':
          description: The request authorization failed
        '404':
          description: The script with the requested ID does not exist.
        '500':
          description: Internal Server Error
      security:
        - AccessKey:
            - User
            - UserApi
            - SubuserAPICompute
            - SubuserAPIDns
            - SubuserCompute
            - SubuserManage
            - SubuserAPIManage
        - bearer:
            - User
            - UserApi
            - SubuserAPICompute
            - SubuserAPIDns
            - SubuserCompute
            - SubuserManage
            - SubuserAPIManage
components:
  schemas:
    UpsertEdgeScriptVariableModel:
      type: object
      additionalProperties: false
      required:
        - Name
      properties:
        Name:
          type: string
          maxLength: 256
          minLength: 1
        Required:
          type: boolean
          nullable: true
        DefaultValue:
          type: string
          maxLength: 4096
          nullable: true
    EdgeScriptVariableModel:
      type: object
      additionalProperties: false
      properties:
        Id:
          type: integer
          format: int64
        Name:
          type: string
          nullable: true
        Required:
          type: boolean
        DefaultValue:
          type: string
          nullable: true
  securitySchemes:
    AccessKey:
      type: apiKey
      description: API Access Key authorization header
      name: AccessKey
      in: header
    bearer:
      type: apiKey
      description: Bearer token authorization header
      name: Authorization
      in: header

````