Skip to main content

shared_env_variables

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

Overview

Nameshared_env_variables
TypeResource
Idvercel.environments.shared_env_variables

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier of the Shared Env Var. (example: env_XCG7t7AIHuO2SBA8667zNUiM)
owner_idstringThe unique identifier of the owner (team) the Shared Env Var was created for. (example: team_LLHUOMOoDlqOp8wPE4kFo9pE) (wire: ownerId)
project_idarrayThe unique identifiers of the projects which the Shared Env Var is linked to. (wire: projectId)
last_edited_by_display_namestringThe last editor full name or username. (wire: lastEditedByDisplayName)
apply_to_all_custom_environmentsbooleanwhether or not this env varible applies to custom environments (false, true) (wire: applyToAllCustomEnvironments)
commentstringA user provided comment that describes what this Shared Env Var is for.
createdstring (date-time)The date when the Shared Env Var was created. (example: 2021-02-10T13:11:49.180Z)
created_atnumberTimestamp for when the Shared Env Var was created. (wire: createdAt)
created_bystringThe unique identifier of the user who created the Shared Env Var. (example: 2qDDuGFTWXBLDNnqZfWPDp1A) (wire: createdBy)
custom_environment_idsarrayThe custom environment IDs that this Shared Env Var is scoped to. (wire: customEnvironmentIds)
decryptedbooleanwhether or not this env variable is decrypted (false, true)
deleted_atnumberTimestamp for when the Shared Env Var was (soft) deleted. (wire: deletedAt)
deleted_bystringThe unique identifier of the user who deleted the Shared Env Var. (example: 2qDDuGFTWXBLDNnqZfWPDp1A) (wire: deletedBy)
keystringThe name of the Shared Env Var. (example: my-api-key)
targetarrayenvironments this env variable targets (example: production)
typestringThe type of this cosmos doc instance, if blank, assume secret. (encrypted, plain, sensitive, system) (example: encrypted)
updated_atnumberTimestamp for when the Shared Env Var was last updated. (wire: updatedAt)
updated_bystringThe unique identifier of the user who last updated the Shared Env Var. (example: 2qDDuGFTWXBLDNnqZfWPDp1A) (wire: updatedBy)
valuestringThe value of the Shared Env Var.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectidteam_id, slugRetrieve the decrypted value of a Shared Environment Variable by id.
listselectsearch, project_id, ids, exclude_ids, exclude-ids, exclude_projectId, exclude-project_id, team_id, slugLists all Shared Environment Variables for a team, taking into account optional filters.
createinsertevs, target, applyToAllCustomEnvironments, customEnvironmentIdsteam_id, slugCreates shared environment variable(s) for a team.
updateupdateupdatesteam_id, slugUpdates a given Shared Environment Variable for a Team.
deletedeleteteam_id, slugDeletes one or many Shared Environment Variables for a given team.
unlinkexecid, project_idteamId, slugDisconnects a shared environment variable for a given project

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
idstringThe unique ID for the Shared Environment Variable to unlink from the project.
project_idstring
exclude-idsstringFilter SharedEnvVariables based on comma separated ids
exclude-project_idstringFilter SharedEnvVariables that belong to a project (wire: exclude-projectId)
exclude_idsstringFilter SharedEnvVariables based on comma separated ids
exclude_projectIdstringFilter SharedEnvVariables that belong to a project
idsstringFilter SharedEnvVariables based on comma separated ids
project_idstringFilter SharedEnvVariables that belong to a project (wire: projectId)
slugstringThe Team slug to perform the request on behalf of.
teamIdstringThe Team identifier to perform the request on behalf of.
team_idstringThe Team identifier to perform the request on behalf of. (wire: teamId)

SELECT examples

Retrieve the decrypted value of a Shared Environment Variable by id.

SELECT
id,
owner_id,
project_id,
last_edited_by_display_name,
apply_to_all_custom_environments,
comment,
created,
created_at,
created_by,
custom_environment_ids,
decrypted,
deleted_at,
deleted_by,
key,
target,
type,
updated_at,
updated_by,
value
FROM vercel.environments.shared_env_variables
WHERE id = '{{ id }}' -- required
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;

INSERT examples

Creates shared environment variable(s) for a team.

INSERT INTO vercel.environments.shared_env_variables (
evs,
type,
target,
project_id,
team_id,
slug
)
SELECT
'{{ evs }}' /* required */,
'{{ type }}',
'{{ target }}' /* required */,
'{{ project_id }}',
'{{ team_id }}',
'{{ slug }}'
RETURNING
created,
failed
;

UPDATE examples

Updates a given Shared Environment Variable for a Team.

UPDATE vercel.environments.shared_env_variables
SET
updates = '{{ updates }}'
WHERE
updates = '{{ updates }}' --required
AND team_id = '{{ team_id}}'
AND slug = '{{ slug}}'
RETURNING
failed,
updated;

DELETE examples

Deletes one or many Shared Environment Variables for a given team.

DELETE FROM vercel.environments.shared_env_variables
WHERE team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;

Lifecycle Methods

EXEC variables use wire (API) names.

Disconnects a shared environment variable for a given project

EXEC vercel.environments.shared_env_variables.unlink
@id='{{ id }}' --required,
@project_id='{{ project_id }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
;