custom_environments
Creates, updates, deletes, gets or lists a custom_environments resource.
Overview
| Name | custom_environments |
| Type | Resource |
| Id | vercel.environments.custom_environments |
Fields
The following fields are returned by SELECT queries:
- get
- list
Internal representation of a custom environment with all required properties
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the custom environment (format: env_*) |
branch_matcher | object | Configuration for matching git branches to this environment (wire: branchMatcher) |
created_at | number | Timestamp when the environment was created (wire: createdAt) |
current_deployment_aliases | array | List of aliases for the current deployment (wire: currentDeploymentAliases) |
description | string | Optional description of the environment's purpose |
domains | array | List of domains associated with this environment |
slug | string | URL-friendly name of the environment |
type | string | The type of environment (production, preview, or development) (development, preview, production) |
updated_at | number | Timestamp when the environment was last updated (wire: updatedAt) |
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the custom environment (format: env_*) |
branch_matcher | object | Configuration for matching git branches to this environment (wire: branchMatcher) |
created_at | number | Timestamp when the environment was created (wire: createdAt) |
current_deployment_aliases | array | List of aliases for the current deployment (wire: currentDeploymentAliases) |
description | string | Optional description of the environment's purpose |
domains | array | List of domains associated with this environment |
slug | string | URL-friendly name of the environment |
type | string | The type of environment (production, preview, or development) (development, preview, production) |
updated_at | number | Timestamp when the environment was last updated (wire: updatedAt) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | id_or_name, environment_slug_or_id | team_id, slug | Retrieve a custom environment for the project. Must not be named 'Production' or 'Preview'. |
list | select | id_or_name | git_branch, team_id, slug | Retrieve custom environments for the project. Must not be named 'Production' or 'Preview'. |
create | insert | id_or_name | team_id | Creates a custom environment for the current project. Cannot be named 'Production' or 'Preview'. |
update | update | id_or_name, environment_slug_or_id | team_id | Update a custom environment for the project. Must not be named 'Production' or 'Preview'. |
delete | delete | id_or_name, environment_slug_or_id | team_id, slug | Remove 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.
| Name | Datatype | Description |
|---|---|---|
environment_slug_or_id | string | The unique custom environment identifier within the project |
id_or_name | string | The unique project identifier or the project name |
git_branch | string | Fetch custom environments for a specific git branch (wire: gitBranch) |
slug | string | The Team slug to perform the request on behalf of. |
team_id | string | The Team identifier to perform the request on behalf of. (wire: teamId) |
SELECT examples
- get
- list
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 }}'
;
Retrieve custom environments 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 git_branch = '{{ git_branch }}'
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;
INSERT examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: custom_environments
props:
- name: id_or_name
value: "{{ id_or_name }}"
description: Required parameter for the custom_environments resource.
- name: slug
value: "{{ slug }}"
description: |
The slug of the custom environment to create.
- name: description
value: "{{ description }}"
description: |
Description of the custom environment. This is optional.
- name: branch_matcher
description: |
How we want to determine a matching branch. This is optional.
value:
type: "{{ type }}"
pattern: "{{ pattern }}"
- name: copy_env_vars_from
value: "{{ copy_env_vars_from }}"
description: |
Where to copy environment variables from. This is optional.
- name: team_id
value: "{{ team_id }}"
description: The Team identifier to perform the request on behalf of.
description: The Team identifier to perform the request on behalf of.
UPDATE examples
- update
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
- delete
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 }}'
;