Skip to main content

versions

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

Overview

Nameversions
TypeResource
Idvercel.project_routes.versions

Fields

The following fields are returned by SELECT queries:

A version of routing rules stored in S3.

NameDatatypeDescription
idstringUnique identifier for the version.
aliasstringThe staging alias for previewing this version.
created_bystringThe user who created this version. (wire: createdBy)
is_livebooleanWhether this version is currently live in production. (false, true) (wire: isLive)
is_stagingbooleanWhether this version is staged and not yet promoted to production. (false, true) (wire: isStaging)
last_modifiednumberTimestamp of when this version was last modified. (wire: lastModified)
rule_countnumberThe number of routing rules in this version. (wire: ruleCount)
s_3_keystringThe S3 key where the routing rules are stored. (wire: s3Key)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectproject_idteam_id, slugGet the version history for a project's routing rules. Returns the staging version (if one exists) followed by production versions, most recent first. The staging version has isStaging: true and the current production version has isLive: true.
updateexecproject_id, id, actionteamId, slugPromote staged routing rules to production, restore a previous production version, or discard staged changes. - promote: Publishes the staging version to production. - restore: Rolls back to a previous production version. - discard: Removes the staging version without publishing.

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
project_idstring
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

Get the version history for a project's routing rules. Returns the staging version (if one exists) followed by production versions, most recent first. The staging version has isStaging: true and the current production version has isLive: true.

SELECT
id,
alias,
created_by,
is_live,
is_staging,
last_modified,
rule_count,
s_3_key
FROM vercel.project_routes.versions
WHERE project_id = '{{ project_id }}' -- required
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;

Lifecycle Methods

EXEC variables use wire (API) names.

Promote staged routing rules to production, restore a previous production version, or discard staged changes. - promote: Publishes the staging version to production. - restore: Rolls back to a previous production version. - discard: Removes the staging version without publishing.

EXEC vercel.project_routes.versions.update
@project_id='{{ project_id }}' --required,
@teamId='{{ teamId }}',
@slug='{{ slug }}'
@@json=
'{
"id": "{{ id }}",
"action": "{{ action }}"
}'
;