Skip to content
Docs

Remove a custom environment

DELhttps://api.vercel.com/v9/projects/{idOrName}/custom-environments/{environmentSlugOrId}
Remove a custom environment 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.removeCustomEnvironment({
idOrName: "<value>",
environmentSlugOrId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();
Response
{
"id": "icfg_1234567890",
"slug": "string",
"type": "development",
"description": "string",
"branchMatcher": {
"type": "endsWith",
"pattern": "string"
},
"domains": [
{
"name": "Example Name",
"apexName": "Example Name",
"projectId": "example_id",
"redirect": "string",
"redirectStatusCode": "301",
"gitBranch": "string",
"customEnvironmentId": "example_id",
"updatedAt": "123",
"createdAt": "123",
"verified": "false",
"verification": [
{
"type": "string",
"domain": "string",
"value": "string",
"reason": "Customer requested refund"
}
]
}
],
"currentDeploymentAliases": [],
"createdAt": "123",
"updatedAt": "123"
}
AuthorizationbearerToken

Default authentication mechanism

idOrNamestringRequired
The unique project identifier or the project name
environmentSlugOrIdstringRequired
The unique custom environment identifier 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.
application/json
deleteUnassignedEnvironmentVariablesbooleanOptional
Delete Environment Variables that are not assigned to any environments.
200Success
idstringRequired
Unique identifier for the custom environment (format: env_*)
slugstringRequired
URL-friendly name of the environment
typestringRequired
The type of environment (production, preview, or development)
descriptionstringOptional
Optional description of the environment's purpose
branchMatcherobjectOptional
Configuration for matching git branches to this environment
domainsarrayOptional
List of domains associated with this environment
currentDeploymentAliasesarrayOptional
List of aliases for the current deployment
createdAtnumberRequired
Timestamp when the environment was created
updatedAtnumberRequired
Timestamp when the environment was last updated
400One of the provided values in the request body is invalid. One 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