Edit an environment variable
PATCH
/__remote/api.vercel.com/v9/projects/{idOrName}/env/{id}Edit a specific environment variable for a given project by passing the environment variable identifier and either passing the project
id or name in the URL./__remote/api.vercel.com/v9/projects/{idOrName}/env/{id}
const response = await fetch('/__remote/api.vercel.com/v9/projects/idOrName/env/id?teamId=string&slug=string', { method: 'PATCH', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ "key": "GITHUB_APP_ID", "target": [], "gitBranch": "feature-1", "type": "plain", "value": "bkWIjbnxcvo78", "customEnvironmentIds": [], "comment": "database connection string for production" }),});
const data = await response.json();console.log(data);Response
{ "comment": "string", "configurationId": "example_id", "contentHint": { "storeId": "example_id", "type": "redis-url" }, "createdAt": "123", "createdBy": "string", "customEnvironmentIds": [], "decrypted": "false", "edgeConfigId": "example_id", "edgeConfigTokenId": "example_id", "gitBranch": "string", "id": "icfg_1234567890", "internalContentHint": { "encryptedValue": "string", "type": "flags-secret" }, "key": "string", "legacyValue": "string", "sunsetSecretId": "example_id", "target": [], "type": "encrypted", "updatedAt": "123", "updatedBy": "string", "value": "string", "visibility": "config"}AuthorizationbearerToken
Default authentication mechanism
application/json
If defined, the git branch of the environment variable (must have target=preview)
The custom environments that the environment variable should be synced to
200Success
Legacy now-encryption ciphertext, present after migration swaps value/vsmValue
This is used to identify variables that have been migrated from type secret to sensitive.
400One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.
At least one environment variable failed validation
401The request is not authorized.
403You do not have permission to access this resource.
404Error
409The project is being transfered and removing an environment variable is not possible
410Error
429Error
500Error