---
title: "Create a global environment variable"
method: POST
path: "/global_environment_variables"
tags: ["Global Environment Variables"]
---

# Create a global environment variable

`POST /global_environment_variables`

## Request

- Base URL: `https://sg.deployhq.com`
- URL: `https://sg.deployhq.com/global_environment_variables`
- Auth: HTTP basic

Creates a new account-level environment variable. Locked variables cannot be read back after creation.

## Request body

- EnvironmentVariableObject
  - `environment_variable` object, required
    - `name` string, required
    - `value` string, required
    - `locked` boolean
    - `build_pipeline` boolean

## Response `201`

Success

- EnvironmentVariable
  - `identifier` integer
  - `name` string
  - `masked_value` string
  - `locked` boolean
  - `build_pipeline` boolean
  - `created_at` string
  - `updated_at` string

## Other responses

- `401`: You are not authorized to access this resource. You need to authenticate yourself first.
- `403`: You are not allowed to access this resource. You do not have the necessary permissions.
- `422`: Unprocessable Entity
- `500`: An unexpected error occurred on the server. The server was unable to process the request.

---

[API](https://skmtc.dev/deployhq/apis/deployhq-api-interactive-documentation.md) · [All operations](https://skmtc.dev/deployhq/apis/deployhq-api-interactive-documentation/llms.txt) · [OpenAPI document](https://skmtc.dev/deployhq/apis/deployhq-api-interactive-documentation/revisions/830264ae58be?raw)
