| `id` | integer/string | yes | The ID of a project or [urlencoded NAMESPACE/PROJECT_NAME of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
| `key` | string | yes | The `key` of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9`, and `_` are allowed |
| `value` | string | yes | The `value` of a variable |
| `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file` |
| `protected` | boolean | no | Whether the variable is protected |
| `environment_scope` | string | no | The `environment_scope` of the variable |
| `id` | integer/string | yes | The ID of a project or [urlencoded NAMESPACE/PROJECT_NAME of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
| `key` | string | yes | The `key` of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9`, and `_` are allowed |
| `value` | string | yes | The `value` of a variable |
| `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file` |
| `protected` | boolean | no | Whether the variable is protected |
| `environment_scope` | string | no | The `environment_scope` of the variable |
| `masked` | boolean | no | Whether the variable is masked |
| `id` | integer/string | yes | The ID of a project or [urlencoded NAMESPACE/PROJECT_NAME of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
| `key` | string | yes | The `key` of a variable |
| `value` | string | yes | The `value` of a variable |
| `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file` |
| `protected` | boolean | no | Whether the variable is protected |
| `environment_scope` | string | no | The `environment_scope` of the variable |
| `id` | integer/string | yes | The ID of a project or [urlencoded NAMESPACE/PROJECT_NAME of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
| `key` | string | yes | The `key` of a variable |
| `value` | string | yes | The `value` of a variable |
| `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file` |
| `protected` | boolean | no | Whether the variable is protected |
| `environment_scope` | string | no | The `environment_scope` of the variable |
| `masked` | boolean | no | Whether the variable is masked |
```
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/variables/NEW_VARIABLE" --form "value=updated value"
requires:key,type: String,desc: 'The key of the variable'
requires:value,type: String,desc: 'The value of the variable'
optional:protected,type: String,desc: 'Whether the variable is protected'
optional:masked,type: String,desc: 'Whether the variable is masked'
optional:variable_type,type: String,values: Ci::Variable.variable_types.keys,desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
ifGitlab.ee?
...
...
@@ -81,6 +82,7 @@ module API
optional:key,type: String,desc: 'The key of the variable'
optional:value,type: String,desc: 'The value of the variable'
optional:protected,type: String,desc: 'Whether the variable is protected'
optional:masked,type: String,desc: 'Whether the variable is masked'
optional:variable_type,type: String,values: Ci::Variable.variable_types.keys,desc: 'The type of variable, must be one of env_var or file'