Accessors
sandboxId
Get Signature
Returns
string
status
Get Signature
Returns
"pending" | "running" | "stopping" | "stopped" | "failed"
timeout
Get Signature
Returns
number
Methods
list()
Parameters
| Parameter | Type |
|---|---|
params | { projectId: string; limit?: number; since?: number | Date; until?: number | Date; signal?: AbortSignal; } & Partial<Credentials> |
Returns
Promise<Parsed<{
sandboxes: {
id: string;
memory: number;
vcpus: number;
region: string;
runtime: string;
timeout: number;
status: "pending" | "running" | "stopping" | "stopped" | "failed";
requestedAt: number;
startedAt?: number;
requestedStopAt?: number;
stoppedAt?: number;
duration?: number;
createdAt: number;
cwd: string;
updatedAt: number;
}[];
pagination: {
count: number;
next: null | number;
prev: null | number;
};
}>>
create()
Parameters
| Parameter | Type | Description |
|---|---|---|
params? | WithPrivate< | { source?: | { type: "git"; url: string; depth?: number; revision?: string; } | { type: "git"; url: string; username: string; password: string; depth?: number; revision?: string; } | { type: "tarball"; url: string; }; ports?: number[]; timeout?: number; resources?: { vcpus: number; }; runtime?: | string & { } | "node22" | "python3.13"; signal?: AbortSignal; } | { source?: | { type: "git"; url: string; depth?: number; revision?: string; } | { type: "git"; url: string; username: string; password: string; depth?: number; revision?: string; } | { type: "tarball"; url: string; }; ports?: number[]; timeout?: number; resources?: { vcpus: number; }; runtime?: | string & { } | "node22" | "python3.13"; signal?: AbortSignal; } & Credentials> | Creation parameters and optional credentials. |
Returns
Promise<Sandbox>
A promise resolving to the created Sandbox.
get()
Parameters
| Parameter | Type | Description |
|---|---|---|
params | | { sandboxId: string; signal?: AbortSignal; } | { sandboxId: string; signal?: AbortSignal; } & Credentials | Get parameters and optional credentials. |
Returns
Promise<Sandbox>
A promise resolving to the Sandbox.
getCommand()
Parameters
| Parameter | Type | Description |
|---|---|---|
cmdId | string | ID of the command to retrieve |
opts? | { signal?: AbortSignal; } | Optional parameters. |
opts.signal? | AbortSignal | An AbortSignal to cancel the operation. |
Returns
Promise<Command>
A Command instance representing the command
runCommand()
Call Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
command | string | The command to execute. |
args? | string[] | Arguments to pass to the command. |
opts? | { signal?: AbortSignal; } | Optional parameters. |
opts.signal? | AbortSignal | An AbortSignal to cancel the command execution. |
Returns
Promise<CommandFinished>
A CommandFinished result once execution is done.
Call Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { cmd: string; args?: string[]; cwd?: string; env?: Record<string, string>; sudo?: boolean; detached?: boolean; stdout?: Writable; stderr?: Writable; signal?: AbortSignal; } & { detached: true; } | The command parameters. |
Returns
Promise<Command>
A Command instance for the running command.
Call Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { cmd: string; args?: string[]; cwd?: string; env?: Record<string, string>; sudo?: boolean; detached?: boolean; stdout?: Writable; stderr?: Writable; signal?: AbortSignal; } | The command parameters. |
params.cmd | string | The command to execute |
params.args? | string[] | Arguments to pass to the command |
params.cwd? | string | Working directory to execute the command in |
params.env? | Record<string, string> | Environment variables to set for this command |
params.sudo? | boolean | If true, execute this command with root privileges. Defaults to false. |
params.detached? | boolean | If true, the command will return without waiting for exitCode |
params.stdout? | Writable | A Writable stream where stdout from the command will be piped |
params.stderr? | Writable | A Writable stream where stderr from the command will be piped |
params.signal? | AbortSignal | An AbortSignal to cancel the command execution |
Returns
Promise<CommandFinished>
A CommandFinished result once execution is done.
_runCommand()
Internal
Internal helper to start a command in the sandbox.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { cmd: string; args?: string[]; cwd?: string; env?: Record<string, string>; sudo?: boolean; detached?: boolean; stdout?: Writable; stderr?: Writable; signal?: AbortSignal; } | Command execution parameters. |
params.cmd | string | The command to execute |
params.args? | string[] | Arguments to pass to the command |
params.cwd? | string | Working directory to execute the command in |
params.env? | Record<string, string> | Environment variables to set for this command |
params.sudo? | boolean | If true, execute this command with root privileges. Defaults to false. |
params.detached? | boolean | If true, the command will return without waiting for exitCode |
params.stdout? | Writable | A Writable stream where stdout from the command will be piped |
params.stderr? | Writable | A Writable stream where stderr from the command will be piped |
params.signal? | AbortSignal | An AbortSignal to cancel the command execution |
Returns
Promise<Command | CommandFinished>
A Command or CommandFinished, depending on detached.
mkDir()
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Path of the directory to create |
opts? | { signal?: AbortSignal; } | Optional parameters. |
opts.signal? | AbortSignal | An AbortSignal to cancel the operation. |
Returns
Promise<void>
readFile()
Parameters
| Parameter | Type | Description |
|---|---|---|
file | { path: string; cwd?: string; } | File to read, with path and optional cwd |
file.path | string | - |
file.cwd? | string | - |
opts? | { signal?: AbortSignal; } | Optional parameters. |
opts.signal? | AbortSignal | An AbortSignal to cancel the operation. |
Returns
Promise<null | ReadableStream>
A promise that resolves to a ReadableStream containing the file contents
writeFiles()
vercel-sandbox user.
Parameters
| Parameter | Type | Description |
|---|---|---|
files | { path: string; content: Buffer; }[] | Array of files with path and stream/buffer contents |
opts? | { signal?: AbortSignal; } | Optional parameters. |
opts.signal? | AbortSignal | An AbortSignal to cancel the operation. |
Returns
Promise<void>
A promise that resolves when the files are written
domain()
Parameters
| Parameter | Type | Description |
|---|---|---|
p | number | Port number to resolve |
Returns
string
A full domain (e.g. https://subdomain.vercel.run)
Throws
If the port has no associated routestop()
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | { signal?: AbortSignal; } | Optional parameters. |
opts.signal? | AbortSignal | An AbortSignal to cancel the operation. |
Returns
Promise<void>
A promise that resolves when the sandbox is stopped
extendTimeout()
Parameters
| Parameter | Type | Description |
|---|---|---|
duration | number | The duration in milliseconds to extend the timeout by |
opts? | { signal?: AbortSignal; } | Optional parameters. |
opts.signal? | AbortSignal | An AbortSignal to cancel the operation. |
Returns
Promise<void>
A promise that resolves when the timeout is extended