> ## Documentation Index
> Fetch the complete documentation index at: https://checkly-422f444a-mintlify-f27640bd.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an environment variable

> Creates a new environment variable.



## OpenAPI

````yaml post /v1/variables
openapi: 3.0.0
info:
  title: Checkly Public API
  version: v1
  description: >-
    These are the docs for the newly released Checkly Public API. If you have
    any questions, please do not hesitate to get in touch with us.
servers:
  - url: https://api.checklyhq.com
security:
  - Bearer: []
tags: []
paths:
  /v1/variables:
    post:
      tags:
        - Environment variables
      summary: Create an environment variable
      description: Creates a new environment variable.
      operationId: postV1Variables
      parameters:
        - schema:
            type: string
            format: uuid
            description: >-
              Your Checkly account ID, you can find it at
              https://app.checklyhq.com/settings/account/general
          required: false
          description: >-
            Your Checkly account ID, you can find it at
            https://app.checklyhq.com/settings/account/general
          name: x-checkly-account
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnvironmentVariablesV1CreateRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentVariablesV1MutationResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    EnvironmentVariablesV1CreateRequest:
      type: object
      properties:
        key:
          type: string
          minLength: 1
          description: The key of the environment variable (this value cannot be changed).
          example: API_KEY
        value:
          type: string
          description: The value of the environment variable.
        locked:
          type: boolean
          default: false
          description: Used only in the UI to hide the value like a password.
        secret:
          type: boolean
          default: false
          description: >-
            Set an environment variable as secret. Once set, its value cannot be
            unlocked.
      required:
        - key
        - value
    EnvironmentVariablesV1MutationResponse:
      type: object
      properties:
        key:
          type: string
          minLength: 1
          description: The key of the environment variable (this value cannot be changed).
          example: API_KEY
        value:
          type: string
          description: The submitted value of the environment variable.
        locked:
          type: boolean
          description: Used only in the UI to hide the value like a password.
        secret:
          type: boolean
          description: Whether the environment variable is stored as a secret.
      required:
        - key
        - value
        - locked
        - secret
    ApiError:
      type: object
      properties:
        statusCode:
          type: number
        error:
          type: string
        message:
          type: string
      required:
        - statusCode
        - error
        - message
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: Bearer
      description: >-
        The Checkly Public API uses API keys to authenticate requests. You can
        get the API Key
        [here](https://app.checklyhq.com/settings/user/api-keys). Your API key
        is like a password: keep it secure!

        Authentication to the API is performed using the Bearer auth method in
        the Authorization header and using the account ID.

        For example, set **Authorization** header while using cURL: `curl -H
        "Authorization: Bearer [apiKey]" "X-Checkly-Account: [accountId]"` 

````