Skip to content
Docs

Retrieve the environment variables of a project by id or name

GEThttps://api.vercel.com/v10/projects/{idOrName}/env
Retrieve the environment variables for a given project by passing either the project id or name in the URL.
Request
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.projects.filterProjectEnvs({
idOrName: "prj_XLKmu1DyR1eY7zq8UgeRKbA7yVLA",
gitBranch: "feature-1",
decrypt: "true",
source: "vercel-cli:pull",
customEnvironmentId: "env_123abc4567",
customEnvironmentSlug: "my-custom-env",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();
Response
{
"target": [],
"type": "encrypted",
"sunsetSecretId": "example_id",
"legacyValue": "string",
"decrypted": "false",
"value": "string",
"vsmValue": "string",
"id": "icfg_1234567890",
"key": "string",
"configurationId": "example_id",
"createdAt": "123",
"updatedAt": "123",
"createdBy": "string",
"updatedBy": "string",
"gitBranch": "string",
"visibility": "config",
"edgeConfigId": "example_id",
"edgeConfigTokenId": "example_id",
"contentHint": {
"type": "redis-url",
"storeId": "example_id"
},
"internalContentHint": {
"type": "flags-secret",
"encryptedValue": "string"
},
"comment": "string",
"customEnvironmentIds": [],
"system": "false"
}
AuthorizationbearerToken

Default authentication mechanism

idOrNamestringRequired
The unique project identifier or the project name
gitBranchstringOptional
If defined, the git branch of the environment variable to filter the results (must have target=preview)
decryptstringOptionalDeprecated
If true, the environment variable value will be decrypted
sourcestringOptional
The source that is calling the endpoint.
customEnvironmentIdstringOptional
The unique custom environment identifier within the project
customEnvironmentSlugstringOptional
The custom environment slug (name) within the project
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
200The list of environment variables for the given project
targetobjectOptional2 variants
typestringRequired
sunsetSecretIdstringOptional
This is used to identify variables that have been migrated from type secret to sensitive.
legacyValuestringOptional
Legacy now-encryption ciphertext, present after migration swaps value/vsmValue
decryptedbooleanOptional
valuestringRequired
vsmValuestringOptional
idstringOptional
keystringRequired
configurationIdstringOptional
createdAtnumberOptional
updatedAtnumberOptional
createdBystringOptional
updatedBystringOptional
gitBranchstringOptional
visibilitystringOptional
User-facing config/secret model. When set, authoritative for new code paths when the env-var-config-secret-ui flag is enabled. Legacy rows omit this field; legacy rows omit it and callers fall back to existing type behavior.
edgeConfigIdstringOptional
edgeConfigTokenIdstringOptional
contentHintobjectOptional17 variants
internalContentHintobjectOptional
Similar to contentHints, but should not be exposed to the user.
commentstringOptional
customEnvironmentIdsarrayOptional
systembooleanOptional
400One of the provided values in the request query is invalid.
401The request is not authorized.
403You do not have permission to access this resource.
410Error