Sandboxes

September 5, 2026 ยท View on GitHub

Overview

Available Operations

listNamedSandboxes

Retrieves a paginated list of named sandboxes belonging to a specific project. Results can be sorted by creation time or name, and optionally filtered by name prefix or status.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.listNamedSandboxes({
    project: "prj_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesListNamedSandboxes } from "@vercel/sdk/funcs/sandboxesListNamedSandboxes.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesListNamedSandboxes(vercel, {
    project: "prj_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesListNamedSandboxes failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.ListNamedSandboxesRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.ListNamedSandboxesResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

listDrives

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

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.listDrives({
    projectId: "prj_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesListDrives } from "@vercel/sdk/funcs/sandboxesListDrives.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesListDrives(vercel, {
    projectId: "prj_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesListDrives failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.ListDrivesRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.ListDrivesResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

getOrCreateDrive

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

Example Usage

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();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesGetOrCreateDrive } from "@vercel/sdk/funcs/sandboxesGetOrCreateDrive.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesGetOrCreateDrive(vercel, {
    name: "workspace",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      projectId: "prj_abc123",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesGetOrCreateDrive failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.GetOrCreateDriveRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetOrCreateDriveResponse>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

deleteDrive

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

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.deleteDrive({
    name: "workspace",
    projectId: "prj_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesDeleteDrive } from "@vercel/sdk/funcs/sandboxesDeleteDrive.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesDeleteDrive(vercel, {
    name: "workspace",
    projectId: "prj_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesDeleteDrive failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.DeleteDriveRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.DeleteDriveResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

listSessionSnapshots

Retrieves a paginated list of snapshots for a specific project.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.listSessionSnapshots({
    project: "prj_abc123",
    name: "my-sandbox",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesListSessionSnapshots } from "@vercel/sdk/funcs/sandboxesListSessionSnapshots.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesListSessionSnapshots(vercel, {
    project: "prj_abc123",
    name: "my-sandbox",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesListSessionSnapshots failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.ListSessionSnapshotsRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.ListSessionSnapshotsResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

getSessionSnapshot

Retrieves detailed information about a specific snapshot, including its creation time, size, expiration date, and the source session it was created from.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.getSessionSnapshot({
    snapshotId: "snap_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesGetSessionSnapshot } from "@vercel/sdk/funcs/sandboxesGetSessionSnapshot.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesGetSessionSnapshot(vercel, {
    snapshotId: "snap_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesGetSessionSnapshot failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.GetSessionSnapshotRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetSessionSnapshotResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

deleteSessionSnapshot

Permanently deletes a snapshot and frees its associated storage. This action cannot be undone. After deletion, the snapshot can no longer be used to create new sessions.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.deleteSessionSnapshot({
    snapshotId: "snap_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesDeleteSessionSnapshot } from "@vercel/sdk/funcs/sandboxesDeleteSessionSnapshot.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesDeleteSessionSnapshot(vercel, {
    snapshotId: "snap_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesDeleteSessionSnapshot failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.DeleteSessionSnapshotRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.DeleteSessionSnapshotResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

listSessions

Retrieves a paginated list of sessions belonging to a specific sandbox. Results are sorted by creation time and paginated using an opaque cursor.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.listSessions({
    project: "prj_abc123",
    name: "my-sandbox",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesListSessions } from "@vercel/sdk/funcs/sandboxesListSessions.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesListSessions(vercel, {
    project: "prj_abc123",
    name: "my-sandbox",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesListSessions failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.ListSessionsRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.ListSessionsResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

getSession

Retrieves detailed information about a specific session, including its current status, resource configuration, and exposed routes.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.getSession({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesGetSession } from "@vercel/sdk/funcs/sandboxesGetSession.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesGetSession(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesGetSession failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.GetSessionRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetSessionResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

getNamedSandbox

Retrieves a named sandbox by name, including its current sandbox and routes. If the sandbox is stopped and resume is true, a new sandbox will be created from the most recent snapshot.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.getNamedSandbox({
    name: "my-sandbox",
    projectId: "prj_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesGetNamedSandbox } from "@vercel/sdk/funcs/sandboxesGetNamedSandbox.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesGetNamedSandbox(vercel, {
    name: "my-sandbox",
    projectId: "prj_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesGetNamedSandbox failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.GetNamedSandboxRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetNamedSandboxResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

deleteSandbox

Deletes a sandbox by name. If sandboxes are currently running, they will be stopped first. This operation deletes all sandbox entities with the given name and the named sandbox metadata.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.deleteSandbox({
    name: "my-sandbox",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesDeleteSandbox } from "@vercel/sdk/funcs/sandboxesDeleteSandbox.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesDeleteSandbox(vercel, {
    name: "my-sandbox",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesDeleteSandbox failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.DeleteSandboxRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.DeleteSandboxResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

listSessionCommands

Retrieves a list of all commands that have been executed in a session, including their current status, exit codes, and execution times, ordered from the most recent to the oldest.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.listSessionCommands({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesListSessionCommands } from "@vercel/sdk/funcs/sandboxesListSessionCommands.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesListSessionCommands(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesListSessionCommands failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.ListSessionCommandsRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.ListSessionCommandsResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

getSessionCommand

Retrieves the current status and details of a command executed in a session. Use the wait parameter to block until the command finishes execution.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.getSessionCommand({
    sessionId: "sbx_abc123",
    cmdId: "cmd_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesGetSessionCommand } from "@vercel/sdk/funcs/sandboxesGetSessionCommand.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesGetSessionCommand(vercel, {
    sessionId: "sbx_abc123",
    cmdId: "cmd_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesGetSessionCommand failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.GetSessionCommandRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetSessionCommandResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

killSessionCommand

Sends a signal to terminate a running command in a session. The signal can be used to gracefully stop (SIGTERM) or forcefully kill (SIGKILL) the process. The command must still be running for this operation to succeed.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.killSessionCommand({
    cmdId: "cmd_abc123",
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      signal: 15,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesKillSessionCommand } from "@vercel/sdk/funcs/sandboxesKillSessionCommand.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesKillSessionCommand(vercel, {
    cmdId: "cmd_abc123",
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      signal: 15,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesKillSessionCommand failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.KillSessionCommandRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.KillSessionCommandResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

stopSession

Stops a running session and releases its allocated resources. All running processes within the session will be terminated. This action cannot be undone. A stopped session cannot be restarted.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.stopSession({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesStopSession } from "@vercel/sdk/funcs/sandboxesStopSession.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesStopSession(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesStopSession failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.StopSessionRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.StopSessionResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

extendSessionTimeout

Extends the maximum execution time of a running session. The session must be active and able to accept commands. The total timeout cannot exceed the maximum allowed limit for your account.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.extendSessionTimeout({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      duration: 300000,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesExtendSessionTimeout } from "@vercel/sdk/funcs/sandboxesExtendSessionTimeout.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesExtendSessionTimeout(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      duration: 300000,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesExtendSessionTimeout failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.ExtendSessionTimeoutRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.ExtendSessionTimeoutResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

updateSessionNetworkPolicy

Replaces the network access policy of a running session. Use this to control which external hosts the session can communicate with. This is a full replacement. Any previously configured network rules will be overwritten.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.updateSessionNetworkPolicy({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      mode: "custom",
      allowedDomains: [
        "api.github.com",
        "*.npmjs.org",
      ],
      allowedCIDRs: [
        "35.192.0.0/12",
        "104.16.0.0/12",
      ],
      deniedCIDRs: [
        "35.192.0.0/12",
      ],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesUpdateSessionNetworkPolicy } from "@vercel/sdk/funcs/sandboxesUpdateSessionNetworkPolicy.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesUpdateSessionNetworkPolicy(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      mode: "custom",
      allowedDomains: [
        "api.github.com",
        "*.npmjs.org",
      ],
      allowedCIDRs: [
        "35.192.0.0/12",
        "104.16.0.0/12",
      ],
      deniedCIDRs: [
        "35.192.0.0/12",
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesUpdateSessionNetworkPolicy failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.UpdateSessionNetworkPolicyRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.UpdateSessionNetworkPolicyResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

readSessionFile

Downloads the contents of a file from a session's filesystem. The file content is returned as a binary stream with appropriate Content-Disposition headers for file download.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.readSessionFile({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      cwd: "/home/vercel-sandbox",
      path: "dist/agent-output.md",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesReadSessionFile } from "@vercel/sdk/funcs/sandboxesReadSessionFile.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesReadSessionFile(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      cwd: "/home/vercel-sandbox",
      path: "dist/agent-output.md",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesReadSessionFile failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.ReadSessionFileRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<ReadableStream>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

createSessionDirectory

Creates a new directory in a session's filesystem. By default, parent directories are created recursively if they don't exist (similar to mkdir -p).

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.createSessionDirectory({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      cwd: "/home/vercel-sandbox",
      path: "src/components",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesCreateSessionDirectory } from "@vercel/sdk/funcs/sandboxesCreateSessionDirectory.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesCreateSessionDirectory(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      cwd: "/home/vercel-sandbox",
      path: "src/components",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesCreateSessionDirectory failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.CreateSessionDirectoryRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.CreateSessionDirectoryResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

writeSessionFiles

Uploads and extracts files to a session's filesystem. Files must be uploaded as a gzipped tarball (.tar.gz) with the Content-Type header set to application/gzip. The tarball contents are extracted to the session's working directory, or to a custom directory specified via the x-cwd header.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.writeSessionFiles({
    xCwd: "/home/vercel-sandbox",
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesWriteSessionFiles } from "@vercel/sdk/funcs/sandboxesWriteSessionFiles.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesWriteSessionFiles(vercel, {
    xCwd: "/home/vercel-sandbox",
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesWriteSessionFiles failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.WriteSessionFilesRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.WriteSessionFilesResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

createSandboxesSessionsBySessionIdSnapshotV2

Creates a point-in-time snapshot of a running session's filesystem. Snapshots can be used to quickly restore a session to a previous state or to create new sessions with pre-configured environments. The session must be running and able to accept commands for a snapshot to be created. The session will be terminated after the snapshot is created.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.createSandboxesSessionsBySessionIdSnapshotV2({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesCreateSandboxesSessionsBySessionIdSnapshotV2 } from "@vercel/sdk/funcs/sandboxesCreateSandboxesSessionsBySessionIdSnapshotV2.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesCreateSandboxesSessionsBySessionIdSnapshotV2(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesCreateSandboxesSessionsBySessionIdSnapshotV2 failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.CreateSandboxesSessionsBySessionIdSnapshotV2Request:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.CreateSandboxesSessionsBySessionIdSnapshotV2ResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

createSandboxesSessionsBySessionIdSnapshotV3

Creates a point-in-time snapshot of a running session's filesystem. Snapshots can be used to quickly restore a session to a previous state or to create new sessions with pre-configured environments. The session must be running and able to accept commands for a snapshot to be created. The session will be terminated after the snapshot is created. Unlike v2, snapshots expire after 7 days when neither the request nor the sandbox configuration specifies an expiration.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.sandboxes.createSandboxesSessionsBySessionIdSnapshotV3({
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { sandboxesCreateSandboxesSessionsBySessionIdSnapshotV3 } from "@vercel/sdk/funcs/sandboxesCreateSandboxesSessionsBySessionIdSnapshotV3.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await sandboxesCreateSandboxesSessionsBySessionIdSnapshotV3(vercel, {
    sessionId: "sbx_abc123",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sandboxesCreateSandboxesSessionsBySessionIdSnapshotV3 failed:", res.error);
  }
}

run();

Parameters

ParameterTypeRequiredDescription
requestmodels.CreateSandboxesSessionsBySessionIdSnapshotV3Request:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit:heavy_minus_sign:Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.CreateSandboxesSessionsBySessionIdSnapshotV3ResponseBody>

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*