Skip to main content
GET
/
v1
/
env
/
{id}
getSharedEnvVar
import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.environment.getSharedEnvVar({
    id: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();
{
  "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": [
    "prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
    "prj_2WjyKQmM8ZnGcJsPWMrasEFg"
  ],
  "type": "encrypted",
  "target": "production",
  "applyToAllCustomEnvironments": true,
  "decrypted": true,
  "comment": "<string>",
  "lastEditedByDisplayName": "<string>"
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

id
string
required

The unique ID for the Shared Environment Variable to get the decrypted value.

Query Parameters

teamId
string

The Team identifier to perform the request on behalf of.

Example:

"team_1a2b3c4d5e6f7g8h9i0j1k2l"

slug
string

The Team slug to perform the request on behalf of.

Example:

"my-team-url-slug"

Response

created
string<date-time>

The date when the Shared Env Var was created.

Example:

"2021-02-10T13:11:49.180Z"

key
string

The name of the Shared Env Var.

Example:

"my-api-key"

ownerId
string | null

The unique identifier of the owner (team) the Shared Env Var was created for.

Example:

"team_LLHUOMOoDlqOp8wPE4kFo9pE"

id
string

The unique identifier of the Shared Env Var.

Example:

"env_XCG7t7AIHuO2SBA8667zNUiM"

createdBy
string | null

The unique identifier of the user who created the Shared Env Var.

Example:

"2qDDuGFTWXBLDNnqZfWPDp1A"

deletedBy
string | null

The unique identifier of the user who deleted the Shared Env Var.

Example:

"2qDDuGFTWXBLDNnqZfWPDp1A"

updatedBy
string | null

The unique identifier of the user who last updated the Shared Env Var.

Example:

"2qDDuGFTWXBLDNnqZfWPDp1A"

createdAt
number

Timestamp for when the Shared Env Var was created.

Example:

1609492210000

deletedAt
number

Timestamp for when the Shared Env Var was (soft) deleted.

Example:

1609492210000

updatedAt
number

Timestamp for when the Shared Env Var was last updated.

Example:

1609492210000

value
string

The value of the Shared Env Var.

projectId
string[]

The unique identifiers of the projects which the Shared Env Var is linked to.

Example:
[
"prj_2WjyKQmM8ZnGcJsPWMrHRHrE",
"prj_2WjyKQmM8ZnGcJsPWMrasEFg"
]
type
enum<string>

The type of this cosmos doc instance, if blank, assume secret.

Available options:
encrypted,
sensitive,
system,
plain
Example:

"encrypted"

target
enum<string>[]

environments this env variable targets

Example:

"production"

applyToAllCustomEnvironments
boolean

whether or not this env varible applies to custom environments

decrypted
boolean

whether or not this env variable is decrypted

comment
string

A user provided comment that describes what this Shared Env Var is for.

lastEditedByDisplayName
string

The last editor full name or username.

I