PATCH
/
v9
/
projects
/
{idOrName}
/
custom-environments
/
{environmentSlugOrId}
updateCustomEnvironment
import { Vercel } from "@vercel/sdk";

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

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

  console.log(result);
}

run();
{
  "id": "<string>",
  "slug": "<string>",
  "type": "preview",
  "description": "<string>",
  "branchMatcher": {
    "type": "endsWith",
    "pattern": "<string>"
  },
  "domains": [
    {
      "name": "<string>",
      "apexName": "<string>",
      "projectId": "<string>",
      "redirect": "<string>",
      "redirectStatusCode": 307,
      "gitBranch": "<string>",
      "customEnvironmentId": "<string>",
      "updatedAt": 123,
      "createdAt": 123,
      "verified": true,
      "verification": [
        {
          "type": "<string>",
          "domain": "<string>",
          "value": "<string>",
          "reason": "<string>"
        }
      ]
    }
  ],
  "currentDeploymentAliases": [
    "<string>"
  ],
  "createdAt": 123,
  "updatedAt": 123
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

idOrName
string
required

The unique project identifier or the project name

environmentSlugOrId
string
required

The unique custom environment identifier within the project

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"

Body

application/json
slug
string

The slug of the custom environment.

Maximum length: 32
description
string

Description of the custom environment. This is optional.

Maximum length: 256
branchMatcher
object | null

How we want to determine a matching branch. This is optional.

Response

Internal representation of a custom environment with all required properties

id
string
required

Unique identifier for the custom environment (format: env_*)

slug
string
required

URL-friendly name of the environment

type
enum<string>
required

The type of environment (production, preview, or development)

Available options:
preview,
production,
development
createdAt
number
required

Timestamp when the environment was created

updatedAt
number
required

Timestamp when the environment was last updated

description
string

Optional description of the environment's purpose

branchMatcher
object

Configuration for matching git branches to this environment

domains
object[]

List of domains associated with this environment

currentDeploymentAliases
string[]

List of aliases for the current deployment