Updates one or more shared environment variables
PATCH
https://api.vercel.com/v1/envUpdates a given Shared Environment Variable for a Team.
Request
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({ bearerToken: "<YOUR_BEARER_TOKEN_HERE>",});
async function run() { const result = await vercel.environment.updateSharedEnvVariable({ teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l", slug: "my-team-url-slug", requestBody: { updates: { "env_2WjyKQmM8ZnGcJsPWMrHRHrE": { key: "API_URL", value: "https://api.vercel.com", target: [ "production", "preview", ], projectIdUpdates: { link: [ "prj_2WjyKQmM8ZnGcJsPWMrHRHrE", ], }, }, }, }, });
console.log(result);}
run();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