Skip to content

Commit d4fa03b

Browse files
committed
Add snapshots endpoints and update auto-resume config in API reference
- Add POST /sandboxes/{sandboxID}/snapshots and GET /snapshots endpoints - Add SnapshotInfo schema and FILE_TYPE_SYMLINK enum value - Replace SandboxAutoResumePolicy enum with SandboxAutoResumeEnabled boolean - Stop filtering out snapshot paths in generate script
1 parent 35eb524 commit d4fa03b

File tree

2 files changed

+102
-15
lines changed

2 files changed

+102
-15
lines changed

openapi-public.yml

Lines changed: 99 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,47 @@ paths:
460460
summary: Refresh sandbox
461461
servers:
462462
- *id001
463+
/sandboxes/{sandboxID}/snapshots:
464+
post:
465+
description: Create a persistent snapshot from the sandbox's current state.
466+
Snapshots can be used to create new sandboxes and persist beyond the original
467+
sandbox's lifetime.
468+
tags:
469+
- Sandboxes
470+
security:
471+
- ApiKeyAuth: []
472+
parameters:
473+
- $ref: '#/components/parameters/sandboxID'
474+
requestBody:
475+
required: true
476+
content:
477+
application/json:
478+
schema:
479+
type: object
480+
properties:
481+
name:
482+
type: string
483+
description: Optional name for the snapshot template. If a snapshot
484+
template with this name already exists, a new build will be assigned
485+
to the existing template instead of creating a new one.
486+
responses:
487+
'201':
488+
description: Snapshot created successfully
489+
content:
490+
application/json:
491+
schema:
492+
$ref: '#/components/schemas/SnapshotInfo'
493+
'400':
494+
$ref: '#/components/responses/400'
495+
'401':
496+
$ref: '#/components/responses/401'
497+
'404':
498+
$ref: '#/components/responses/404'
499+
'500':
500+
$ref: '#/components/responses/500'
501+
operationId: postSandboxSnapshots
502+
servers:
503+
- *id001
463504
/v3/templates:
464505
post:
465506
description: Create a new template
@@ -1923,6 +1964,38 @@ paths:
19231964
operationId: uploadFile
19241965
servers:
19251966
- *id005
1967+
/snapshots:
1968+
get:
1969+
description: List all snapshots for the team
1970+
tags:
1971+
- snapshots
1972+
security:
1973+
- ApiKeyAuth: []
1974+
parameters:
1975+
- name: sandboxID
1976+
in: query
1977+
required: false
1978+
schema:
1979+
type: string
1980+
description: Filter snapshots by source sandbox ID
1981+
- $ref: '#/components/parameters/paginationLimit'
1982+
- $ref: '#/components/parameters/paginationNextToken'
1983+
responses:
1984+
'200':
1985+
description: Successfully returned snapshots
1986+
content:
1987+
application/json:
1988+
schema:
1989+
type: array
1990+
items:
1991+
$ref: '#/components/schemas/SnapshotInfo'
1992+
'401':
1993+
$ref: '#/components/responses/401'
1994+
'500':
1995+
$ref: '#/components/responses/500'
1996+
operationId: listSnapshots
1997+
servers:
1998+
- *id001
19261999
components:
19272000
securitySchemes:
19282001
AccessTokenAuth:
@@ -2322,6 +2395,7 @@ components:
23222395
- FILE_TYPE_UNSPECIFIED
23232396
- FILE_TYPE_FILE
23242397
- FILE_TYPE_DIRECTORY
2398+
- FILE_TYPE_SYMLINK
23252399
filesystem.FilesystemEvent:
23262400
type: object
23272401
properties:
@@ -3000,6 +3074,23 @@ components:
30003074
enum:
30013075
- running
30023076
- paused
3077+
SnapshotInfo:
3078+
type: object
3079+
required:
3080+
- snapshotID
3081+
- names
3082+
properties:
3083+
snapshotID:
3084+
type: string
3085+
description: Identifier of the snapshot template including the tag. Uses
3086+
namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default),
3087+
otherwise falls back to the raw template ID (e.g. abc123:default).
3088+
names:
3089+
type: array
3090+
items:
3091+
type: string
3092+
description: Full names of the snapshot template including team namespace
3093+
and tag (e.g. team-slug/my-snapshot:v2)
30033094
Mcp:
30043095
type: object
30053096
description: MCP configuration for the sandbox
@@ -3027,21 +3118,18 @@ components:
30273118
maskRequestHost:
30283119
type: string
30293120
description: Specify host mask which will be used for all sandbox requests
3030-
SandboxAutoResumePolicy:
3031-
type: string
3032-
description: Auto-resume policy for paused sandboxes. Default is off.
3033-
default: 'off'
3034-
enum:
3035-
- any
3036-
- 'off'
3121+
SandboxAutoResumeEnabled:
3122+
type: boolean
3123+
description: Auto-resume enabled flag for paused sandboxes. Default false.
3124+
default: false
30373125
SandboxAutoResumeConfig:
30383126
type: object
3039-
description: Auto-resume configuration for paused sandboxes. Default is off.
3127+
description: Auto-resume configuration for paused sandboxes.
30403128
required:
3041-
- policy
3129+
- enabled
30423130
properties:
3043-
policy:
3044-
$ref: '#/components/schemas/SandboxAutoResumePolicy'
3131+
enabled:
3132+
$ref: '#/components/schemas/SandboxAutoResumeEnabled'
30453133
SandboxLog:
30463134
description: Log entry with timestamp and line
30473135
required:

scripts/generate_openapi_reference.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,9 +1195,8 @@ def filter_paths(spec: dict[str, Any]) -> None:
11951195
- Removes Supabase and AdminToken securityScheme definitions
11961196
"""
11971197
# Remove excluded paths
1198-
excluded_prefixes = ("/access-tokens", "/api-keys", "/volumes", "/snapshots")
1199-
excluded_exact = {"/v2/sandboxes/{sandboxID}/logs", "/init",
1200-
"/sandboxes/{sandboxID}/snapshots"}
1198+
excluded_prefixes = ("/access-tokens", "/api-keys", "/volumes")
1199+
excluded_exact = {"/v2/sandboxes/{sandboxID}/logs", "/init"}
12011200
to_remove = [
12021201
p for p in spec["paths"]
12031202
if p.startswith(excluded_prefixes) or p in excluded_exact
@@ -1211,7 +1210,7 @@ def filter_paths(spec: dict[str, Any]) -> None:
12111210
for path in to_remove:
12121211
del spec["paths"][path]
12131212
if to_remove:
1214-
print(f"==> Removed {len(to_remove)} paths (volumes, snapshots, admin, internal)")
1213+
print(f"==> Removed {len(to_remove)} paths (volumes, admin, internal)")
12151214

12161215
# Strip supabase security entries from all operations
12171216
for path_item in spec["paths"].values():

0 commit comments

Comments
 (0)