Skip to content
Docs

Create a snapshot

POSThttps://api.vercel.com/v2/sandboxes/sessions/{sessionId}/snapshot
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.
Request
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();
Response
{
"session": {
"abortedAt": "1750344501629",
"activeCpuDurationMs": "42",
"architecture": "amd64",
"createdAt": "1750344501629",
"cwd": "/vercel/sandbox",
"duration": "3600000",
"id": "sbx_123a6c5209bc3778245d011443644c8d27dc2c50",
"memory": "2048",
"networkPolicy": {
"allowedCIDRs": [],
"allowedDomains": [],
"deniedCIDRs": [],
"injectionRules": [
{
"domain": "api.vercel.com",
"headerNames": []
}
],
"mode": "custom"
},
"networkTransfer": {
"egress": "123",
"ingress": "123"
},
"projectId": "prj_123a6c5209bc3778245d011443644c8d27dc2c50",
"region": "iad1",
"requestedAt": "1750344501629",
"requestedStopAt": "1750344501629",
"runtime": "node22",
"snapshottedAt": "1750344501629",
"sourceSandboxName": "my-sandbox",
"sourceSnapshotId": "snap_123a6c5209bc3778245d011443644c8d27dc2c50",
"startedAt": "1750344501629",
"status": "running",
"stoppedAt": "1750344501629",
"timeout": "3600000",
"updatedAt": "1750344501629",
"v0": "false",
"vcpus": "2"
},
"snapshot": {
"architecture": "amd64",
"createdAt": "1750344501629",
"creationMethod": "manual",
"expiresAt": "1750344501629",
"id": "snap_123a6c5209bc3778245d011443644c8d27dc2c50",
"lastUsedAt": "1750344501629",
"parentId": "snap_parent123",
"region": "iad1",
"regions": [],
"sizeBytes": "104857600",
"sourceSessionId": "sbx_123a6c5209bc3778245d011443644c8d27dc2c50",
"status": "created",
"updatedAt": "1750344501629",
"v0": "false"
}
}
AuthorizationbearerToken

Default authentication mechanism

sessionIdstringRequired
The unique identifier of the session to snapshot.
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
application/json
expirationobjectOptional2 variants
201Success
sessionobjectRequired
This object contains information related to a Vercel Sandbox Session. v2 endpoints return "session" instead of "sandbox" as the response wrapper key.
snapshotobjectRequired
This object contains information related to a Snapshot of a Vercel Sandbox session (v2 API).
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
410Error
422Error
429Error
500Error