Create a new instance-level variable

POST /admin/ci/variables

Create a new instance-level variable

application/json

Body Required

  • key string Required

    The key of the variable. Max 255 characters

  • value string Required

    The value of a variable

  • protected boolean

    Whether the variable is protected

  • masked boolean

    Whether the variable is masked

  • raw boolean

    Whether the variable will be expanded

  • variable_type string

    The type of a variable. Available types are: env_var (default) and file

    Values are env_var or file.

Responses

  • 201 application/json

    Create a new instance-level variable

    Hide response attributes Show response attributes object
    • variable_type string
    • key string
    • value string
    • protected boolean
    • masked boolean
    • raw boolean
    • environment_scope string
  • 400

    400 Bad Request

POST /admin/ci/variables
curl \
 --request POST 'https://www.gitlab.com/api/v4/admin/ci/variables' \
 --header "Private-Token: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"key":"string","value":"string","protected":true,"masked":true,"raw":true,"variable_type":"env_var"}'
Request examples
{
  "key": "string",
  "value": "string",
  "protected": true,
  "masked": true,
  "raw": true,
  "variable_type": "env_var"
}
Response examples (201)
{
  "variable_type": "env_var",
  "key": "TEST_VARIABLE_1",
  "value": "TEST_1",
  "protected": true,
  "masked": true,
  "raw": true,
  "environment_scope": "*"
}