Skip to main content

drives

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

Overview

Namedrives
TypeResource
Idvercel.sandboxes.drives

Fields

The following fields are returned by SELECT queries:

This object contains information related to a Vercel Sandbox Drive.

NameDatatypeDescription
idstringThe unique drive ID. (example: drive_abc123)
namestringThe unique drive name within the project. (example: workspace)
current_session_idstringCurrent session ID the drive is attached to, if any. (example: sbx_123) (wire: currentSessionId)
project_idstringThe project that owns the drive. (example: prj_abc123) (wire: projectId)
current_sandbox_namestringCurrent sandbox name the drive is attached to, if any. (example: my-sandbox) (wire: currentSandboxName)
created_atnumberThe time when the drive was created, in milliseconds since the epoch. (wire: createdAt)
max_size_bytesnumberThe maximum drive size in bytes. (wire: maxSizeBytes)
regionstringThe region where the drive is stored. (example: iad1)
updated_atnumberThe last time the drive was updated, in milliseconds since the epoch. (wire: updatedAt)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectproject_id, limit, cursor, sort_by, name_prefix, sort_order, team_id, slugRetrieves a paginated list of drives belonging to a specific project. Drives are in private beta. Register your interest to get access: https:​//vercel.com/changelog/drives-for-vercel-sandbox-in-private-beta
get_or_createinsertnameteam_id, slugGets an existing drive by project and name, or creates it when it does not exist. Drives are in private beta. Register your interest to get access: https:​//vercel.com/changelog/drives-for-vercel-sandbox-in-private-beta
deletedeletenameproject_id, team_id, slugDeletes a drive by project and name. Attached drives cannot be deleted. Stop or replace the session currently using the drive before retrying deletion. Drives are in private beta. Register your interest to get access: https:​//vercel.com/changelog/drives-for-vercel-sandbox-in-private-beta

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
namestringName for the drive. Must be unique per project and URL-safe (alphanumeric, hyphens, underscores).
cursorstringOpaque pagination cursor from a previous response.
limitnumberMaximum number of drives to return in the response. Used for pagination.
name_prefixstringFilter drives whose name starts with this prefix. Only valid when sortBy=name. (wire: namePrefix)
project_idstringThe project ID or name associated with the drive. Required unless using a Vercel OIDC token scoped to a project. (wire: projectId)
slugstringThe Team slug to perform the request on behalf of.
sort_bystringField to sort drives by. (wire: sortBy)
sort_orderstringSort direction for results. (wire: sortOrder)
team_idstringThe Team identifier to perform the request on behalf of. (wire: teamId)

SELECT examples

Retrieves a paginated list of drives belonging to a specific project. Drives are in private beta. Register your interest to get access: https://vercel.com/changelog/drives-for-vercel-sandbox-in-private-beta

SELECT
id,
name,
current_session_id,
project_id,
current_sandbox_name,
created_at,
max_size_bytes,
region,
updated_at
FROM vercel.sandboxes.drives
WHERE project_id = '{{ project_id }}'
AND limit = '{{ limit }}'
AND cursor = '{{ cursor }}'
AND sort_by = '{{ sort_by }}'
AND name_prefix = '{{ name_prefix }}'
AND sort_order = '{{ sort_order }}'
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;

INSERT examples

Gets an existing drive by project and name, or creates it when it does not exist. Drives are in private beta. Register your interest to get access: https://vercel.com/changelog/drives-for-vercel-sandbox-in-private-beta

INSERT INTO vercel.sandboxes.drives (
project_id,
max_size_bytes,
region,
name,
team_id,
slug
)
SELECT
'{{ project_id }}',
{{ max_size_bytes }},
'{{ region }}',
'{{ name }}',
'{{ team_id }}',
'{{ slug }}'
RETURNING
drive
;

DELETE examples

Deletes a drive by project and name. Attached drives cannot be deleted. Stop or replace the session currently using the drive before retrying deletion. Drives are in private beta. Register your interest to get access: https://vercel.com/changelog/drives-for-vercel-sandbox-in-private-beta

DELETE FROM vercel.sandboxes.drives
WHERE name = '{{ name }}' --required
AND project_id = '{{ project_id }}'
AND team_id = '{{ team_id }}'
AND slug = '{{ slug }}'
;