Skip to content
Docs

Updates one or more shared environment variables

PATCHhttps://api.vercel.com/v1/env
Updates a given Shared Environment Variable for a Team.
https://api.vercel.com/v1/env
const response = await fetch('https://api.vercel.com/v1/env?teamId=string&slug=string', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"updates": "[object Object]"
}),
});
const data = await response.json();
console.log(data);
Response
{
"updated": [
{
"created": "2021-02-10T13:11:49.180Z",
"key": "my-api-key",
"ownerId": "team_LLHUOMOoDlqOp8wPE4kFo9pE",
"id": "env_XCG7t7AIHuO2SBA8667zNUiM",
"createdBy": "2qDDuGFTWXBLDNnqZfWPDp1A",
"deletedBy": "2qDDuGFTWXBLDNnqZfWPDp1A",
"updatedBy": "2qDDuGFTWXBLDNnqZfWPDp1A",
"createdAt": "1609492210000",
"deletedAt": "1609492210000",
"updatedAt": "1609492210000",
"value": "string",
"projectId": [],
"type": "encrypted",
"target": [],
"applyToAllCustomEnvironments": "false",
"customEnvironmentIds": [],
"decrypted": "false",
"comment": "string",
"lastEditedByDisplayName": "Example Name"
}
],
"failed": [
{
"error": {
"code": "string",
"message": "string",
"key": "string",
"envVarId": "example_id",
"envVarKey": "string",
"action": "string",
"link": "string",
"value": "string",
"gitBranch": "string",
"target": [],
"project": "string"
}
}
]
}
AuthorizationbearerToken

Default authentication mechanism

teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
application/json
updatesobjectRequired
An object where each key is an environment variable ID (not the key name) and the value is the update to apply
200Success
updatedarrayRequired
failedarrayRequired
400One of the provided values in the request body is invalid.
401The request is not authorized.
402The account is missing a payment so payment method must be updated
403You do not have permission to access this resource.