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.
https://api.vercel.com/v10/projects/{idOrName}/env
const response = await fetch('https://api.vercel.com/v10/projects/idOrName/env?gitBranch=string&decrypt=string&source=string&customEnvironmentId=string&customEnvironmentSlug=string&teamId=string&slug=string', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
});
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",
"key": "string",
"securityIssues": [],
"sunsetSecretId": "example_id",
"system": "false",
"target": [],
"type": "encrypted",
"updatedAt": "123",
"updatedBy": "string",
"value": "string",
"visibility": "config"
}
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
commentstringOptional
configurationIdstringOptional
contentHintobjectOptional17 variants
createdAtnumberOptional
createdBystringOptional
customEnvironmentIdsarrayOptional
decryptedbooleanOptional
edgeConfigIdstringOptional
edgeConfigTokenIdstringOptional
gitBranchstringOptional
idstringOptional
keystringRequired
securityIssuesarrayRequired
sunsetSecretIdstringOptional
This is used to identify variables that have been migrated from type secret to sensitive.
systembooleanOptional
targetobjectOptional2 variants
typestringRequired
updatedAtnumberOptional
updatedBystringOptional
valuestringRequired
visibilitystringOptional
User-facing config/secret model. When set, authoritative for new code paths. Legacy rows omit this field and callers fall back to existing type behavior.
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.
404Error
410Error