Skip to content
Docs

Retrieve custom environments

GEThttps://api.vercel.com/v9/projects/{idOrName}/custom-environments
Retrieve custom environments for the project. Must not be named 'Production' or 'Preview'.
Request
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.environment.getProjectsByIdOrNameCustomEnvironments({
idOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();
Response
{
"accountLimit": {
"total": "123"
},
"environments": [
{
"branchMatcher": {
"pattern": "string",
"type": "endsWith"
},
"createdAt": "123",
"currentDeploymentAliases": [],
"description": "string",
"domains": [
{
"apexName": "Example Name",
"createdAt": "123",
"customEnvironmentId": "example_id",
"gitBranch": "string",
"name": "Example Name",
"projectId": "example_id",
"redirect": "string",
"redirectStatusCode": "301",
"updatedAt": "123",
"verification": [
{
"domain": "string",
"reason": "Customer requested refund",
"type": "string",
"value": "string"
}
],
"verified": "false"
}
],
"id": "icfg_1234567890",
"slug": "string",
"type": "development",
"updatedAt": "123"
}
]
}
AuthorizationbearerToken

Default authentication mechanism

idOrNamestringRequired
The unique project identifier or the project name
gitBranchstringOptional
Fetch custom environments for a specific git branch
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
200Success
accountLimitobjectRequired
The maximum number of custom environments allowed either by the team's plan type or a custom override.
environmentsarrayRequired
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