Get or create a drive
POST
https://api.vercel.com/v2/sandboxes/drives/{name}Gets an existing drive by project and name, or creates it when it does not exist.
Request
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({ bearerToken: "<YOUR_BEARER_TOKEN_HERE>",});
async function run() { const result = await vercel.sandboxes.getOrCreateDrive({ name: "workspace", teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l", slug: "my-team-url-slug", requestBody: { projectId: "prj_abc123", }, });
console.log(result);}
run();Response
{ "drive": { "createdAt": "1750344501629", "currentSandboxName": "my-sandbox", "currentSessionId": "sbx_123", "id": "drive_abc123", "maxSizeBytes": "1099511627776", "name": "workspace", "parentDriveId": "example_id", "projectId": "prj_abc123", "region": "iad1", "rootDriveId": "example_id", "updatedAt": "1750344501629", "v0": "false" }}AuthorizationbearerToken
Default authentication mechanism
application/json
The project ID or name to associate the drive with. Required unless using a Vercel OIDC token scoped to a project.
Maximum drive size in bytes. Must be a multiple of 4096 bytes. Defaults to 1 TiB when omitted (1 GiB for Hobby). The maximum quota is 16 TiB. Request a quota above 16 TiB at https://vercel.com/help.
400One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.
401The request is not authorized.
402The account is missing a payment so payment method must be updated
403You do not have permission to access this resource.
404Error
409Error
410Error
429Error