Skip to main content

custom_environments

Creates, updates, deletes, gets or lists a custom_environments resource.

Overview

Namecustom_environments
TypeResource
Idvercel.environments.custom_environments

Fields

The following fields are returned by SELECT queries:

Internal representation of a custom environment with all required properties

NameDatatypeDescription
idstringUnique identifier for the custom environment (format: env_*)
branch_matcherobjectConfiguration for matching git branches to this environment (wire: branchMatcher)
created_atnumberTimestamp when the environment was created (wire: createdAt)
current_deployment_aliasesarrayList of aliases for the current deployment (wire: currentDeploymentAliases)
descriptionstringOptional description of the environment's purpose
domainsarrayList of domains associated with this environment
slugstringURL-friendly name of the environment
typestringThe type of environment (production, preview, or development) (development, preview, production)
updated_atnumberTimestamp when the environment was last updated (wire: updatedAt)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid_or_name, environment_slug_or_idteam_id, slugRetrieve a custom environment for the project. Must not be named 'Production' or 'Preview'.
listselectid_or_namegit_branch, team_id, slugRetrieve custom environments for the project. Must not be named 'Production' or 'Preview'.
createinsertid_or_nameteam_idCreates a custom environment for the current project. Cannot be named 'Production' or 'Preview'.
updateupdateid_or_name, environment_slug_or_idteam_idUpdate a custom environment for the project. Must not be named 'Production' or 'Preview'.
deletedeleteid_or_name, environment_slug_or_idteam_id, slugRemove a custom environment for the project. Must not be named 'Production' or 'Preview'.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
environment_slug_or_idstringThe unique custom environment identifier within the project
id_or_namestringThe unique project identifier or the project name
git_branchstringFetch custom environments for a specific git branch (wire: gitBranch)
slugstringThe Team slug to perform the request on behalf of.
team_idstringThe Team identifier to perform the request on behalf of. (wire: teamId)

SELECT examples

Retrieve a custom environment for the project. Must not be named 'Production' or 'Preview'.

SELECT
id,
branch_matcher,
created_at,
current_deployment_aliases,
description,
domains,
slug,
type,
updated_at
FROM vercel.environments.custom_environments
WHERE id_or_name = '{{ id_or_name }}' -- required
AND environment_slug_or_id = '{{ environment_slug_or_id }}' -- required
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;

INSERT examples

Creates a custom environment for the current project. Cannot be named 'Production' or 'Preview'.

INSERT INTO vercel.environments.custom_environments (
slug,
description,
branch_matcher,
copy_env_vars_from,
id_or_name,
team_id
)
SELECT
'{{ slug }}',
'{{ description }}',
'{{ branch_matcher }}',
'{{ copy_env_vars_from }}',
'{{ id_or_name }}',
'{{ team_id }}'
RETURNING
id,
branch_matcher,
created_at,
current_deployment_aliases,
description,
domains,
slug,
type,
updated_at
;

UPDATE examples

Update a custom environment for the project. Must not be named 'Production' or 'Preview'.

UPDATE vercel.environments.custom_environments
SET
slug = '{{ slug }}',
description = '{{ description }}',
branch_matcher = '{{ branch_matcher }}'
WHERE
id_or_name = '{{ id_or_name }}' --required
AND environment_slug_or_id = '{{ environment_slug_or_id }}' --required
AND team_id = '{{ team_id}}'
RETURNING
id,
branch_matcher,
created_at,
current_deployment_aliases,
description,
domains,
slug,
type,
updated_at;

DELETE examples

Remove a custom environment for the project. Must not be named 'Production' or 'Preview'.

DELETE FROM vercel.environments.custom_environments
WHERE id_or_name = '{{ id_or_name }}' --required
AND environment_slug_or_id = '{{ environment_slug_or_id }}' --required
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;