forked from opensandbox-group/OpenSandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsandbox-lifecycle.yml
More file actions
1588 lines (1476 loc) · 56.3 KB
/
sandbox-lifecycle.yml
File metadata and controls
1588 lines (1476 loc) · 56.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: OpenSandbox Lifecycle API
version: 0.1.0
description: |
The Sandbox Lifecycle API coordinates how untrusted workloads are created,
executed, paused, resumed, and finally disposed. This specification focuses on
the primary lifecycle flows for the `sandbox` domain concept. Sandboxes can
be provisioned directly from container images or restored from snapshots.
## Sandbox Lifecycle
A sandbox follows this lifecycle:
1. **Creation** → Sandbox enters `Pending` state (auto-starts)
2. **Execution** → Transitions to `Running` state
3. **Pause** (optional) → `Pausing` → `Paused` (asynchronous process)
4. **Resume** (optional) → `Resuming` → `Running` (asynchronous process)
5. **Termination** → `Stopping` → `Terminated` (can be triggered by kill action, TTL expiry, or error)
6. **Error** → Any state can transition to `Failed` on critical errors
The `status` field provides fine-grained details through `state`, `reason`, and `message`.
## Authentication
API Key authentication is required for all operations:
1. **HTTP Header**
```
OPEN-SANDBOX-API-KEY: your-api-key
```
2. **Environment Variable** (for SDK clients)
```
OPEN_SANDBOX_API_KEY=your-api-key
```
SDK clients will automatically pick up this environment variable.
servers:
- url: http://localhost:8080/v1
description: Local development
security:
- apiKeyAuth: []
tags:
- name: Sandboxes
description: Provision and transition sandboxes through their lifecycle
- name: Snapshots
description: Create, list, and delete persistent sandbox snapshots
paths:
/sandboxes:
get:
tags: [ Sandboxes ]
summary: List sandboxes
description: |
List all sandboxes with optional filtering and pagination using query parameters.
All filter conditions use AND logic. Multiple `state` parameters use OR logic within states.
parameters:
- name: state
in: query
description: |
Filter by lifecycle state. Pass multiple times for OR logic.
Example: `?state=Running&state=Paused`
schema:
type: array
items:
type: string
style: form
explode: true
- name: metadata
in: query
description: |
Arbitrary metadata key-value pairs for filtering,keys and values must be url encoded
Example: To filter by `project=Apollo` and `note=Demo Test`: `?metadata=project%3DApollo%26note%3DDemo%252520Test`
schema:
type: string
style: form
- name: page
in: query
description: Page number for pagination
schema:
type: integer
minimum: 1
default: 1
- name: pageSize
in: query
description: Number of items per page
schema:
type: integer
minimum: 1
default: 20
responses:
'200':
description: Paginated collection of sandboxes
content:
application/json:
schema:
$ref: '#/components/schemas/ListSandboxesResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
post:
tags: [Sandboxes]
summary: Create a sandbox
description: |
Creates a new sandbox from a container image or restores one from a
persistent sandbox snapshot with optional resource limits, environment
variables, and metadata.
Exactly one startup source must be provided:
- `image` to provision directly from a container image.
- `snapshotId` to restore from a previously created snapshot.
When `image` is provided, `entrypoint` is required. When `snapshotId` is
provided, `entrypoint` is optional. If omitted, the server defaults the
sandbox entrypoint to `["tail", "-f", "/dev/null"]`.
## Authentication
API Key authentication is required via:
- `OPEN-SANDBOX-API-KEY: <api-key>` header
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateSandboxRequest'
examples:
deny-with-allowlist:
summary: Deny by default with allowed domains
value:
image:
uri: python:3.11
timeout: 3600
resourceLimits:
cpu: "500m"
memory: "512Mi"
entrypoint: ["python", "/app/main.py"]
networkPolicy:
defaultAction: deny
egress:
- action: allow
target: "pypi.org"
allow-with-denylist:
summary: Allow by default with a deny rule
value:
image:
uri: python:3.11
timeout: 3600
resourceLimits:
cpu: "500m"
memory: "512Mi"
entrypoint: ["python", "/app/main.py"]
networkPolicy:
defaultAction: allow
egress:
- action: deny
target: "bad.example.com"
manual-cleanup:
summary: Manual cleanup without automatic expiration
value:
image:
uri: python:3.11
platform:
os: linux
arch: amd64
resourceLimits:
cpu: "500m"
memory: "512Mi"
entrypoint: ["python", "/app/main.py"]
secure-access:
summary: Enable secured access for sandbox endpoints in Kubernetes gateway mode
value:
image:
uri: python:3.11
timeout: 3600
resourceLimits:
cpu: "500m"
memory: "512Mi"
entrypoint: ["python", "/app/main.py"]
secureAccess: true
restore-snapshot:
summary: Restore from a snapshot
value:
snapshotId: snap_123
timeout: 3600
resourceLimits:
cpu: "500m"
memory: "512Mi"
restore-snapshot-with-entrypoint:
summary: Restore from a snapshot with a custom entrypoint
value:
snapshotId: snap_123
timeout: 3600
resourceLimits:
cpu: "500m"
memory: "512Mi"
entrypoint: ["python", "/workspace/app.py"]
responses:
'202':
description: |
Sandbox created and accepted for provisioning.
The returned sandbox includes:
- `id`: Unique sandbox identifier
- `status.state: "Pending"` (auto-starting provisioning or restore)
- `status.reason` and `status.message` indicating initialization stage
- `metadata`, `expiresAt`, `createdAt`: Core sandbox information
Note: startup source details and `updatedAt` are not included in the create response.
Use GET /sandboxes/{sandboxId} to retrieve the complete sandbox information.
To track provisioning progress, poll GET /sandboxes/{sandboxId}.
The sandbox will automatically transition to `Running` state once provisioning or restore completes.
content:
application/json:
schema:
$ref: '#/components/schemas/CreateSandboxResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
Location:
$ref: '#/components/headers/Location'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
/snapshots:
get:
tags: [Snapshots]
summary: List snapshots
description: |
List all snapshots with optional filtering and pagination using query parameters.
Snapshots are persistent captures of sandbox state and may outlive the source sandbox.
parameters:
- name: sandboxId
in: query
description: Filter snapshots by source sandbox identifier
schema:
type: string
- name: state
in: query
description: |
Filter by snapshot lifecycle state. Pass multiple times for OR logic.
Example: `?state=Ready&state=Failed`
schema:
type: array
items:
$ref: '#/components/schemas/SnapshotState'
style: form
explode: true
- name: page
in: query
description: Page number for pagination
schema:
type: integer
minimum: 1
default: 1
- name: pageSize
in: query
description: Number of items per page
schema:
type: integer
minimum: 1
default: 20
responses:
'200':
description: Paginated collection of snapshots
content:
application/json:
schema:
$ref: '#/components/schemas/ListSnapshotsResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
/snapshots/{snapshotId}:
parameters:
- $ref: '#/components/parameters/SnapshotId'
get:
tags: [Snapshots]
summary: Fetch a snapshot by id
description: Returns snapshot state and metadata.
responses:
'200':
description: Snapshot current state and metadata
content:
application/json:
schema:
$ref: '#/components/schemas/Snapshot'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
delete:
tags: [Snapshots]
summary: Delete a snapshot
description: |
Delete a persistent sandbox snapshot by id. Snapshots that are still
being created cannot be deleted.
For Kubernetes-backed snapshots, deletion removes OpenSandbox metadata
and Kubernetes coordination resources, but does not guarantee removal
of pushed OCI images from the configured registry. Use registry
retention or garbage collection policies for image lifecycle cleanup.
responses:
'204':
description: Snapshot successfully deleted
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
/sandboxes/{sandboxId}:
parameters:
- $ref: '#/components/parameters/SandboxId'
get:
tags: [Sandboxes]
summary: Fetch a sandbox by id
description: |
Returns the complete sandbox information including:
- `id`, `status`, `metadata`, `expiresAt`, `createdAt`: Core information
- `image` or `snapshotId`: Startup source information (not included in create response)
- `entrypoint`: Entry process specification
This is the complete representation of the sandbox resource.
responses:
'200':
description: Sandbox current state and metadata
content:
application/json:
schema:
$ref: '#/components/schemas/Sandbox'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'
delete:
tags: [Sandboxes]
summary: Delete a sandbox
description: Delete a sandbox, terminating its execution. The sandbox will transition through Stopping state to Terminated.
responses:
'204':
description: |
Sandbox successfully deleted.
Sandbox has been scheduled for termination and will transition to Stopping state, then Terminated.
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
/sandboxes/{sandboxId}/metadata:
parameters:
- $ref: '#/components/parameters/SandboxId'
patch:
tags: [Sandboxes]
summary: Patch sandbox metadata
description: |
Update sandbox metadata using JSON Merge Patch semantics (RFC 7396).
**Merge Patch rules:**
| Request body key/value | Behavior |
|---|---|
| `"key": "value"` | Add or replace the key |
| `"key": null` | Delete the key (silently ignored if key does not exist) |
| key absent | Keep current value (no change) |
| Empty `{}` | No-op, returns current metadata |
Metadata keys and values must comply with Kubernetes label rules:
- Keys must be valid DNS label names or prefixed DNS subdomains
- Keys with the `opensandbox.io/` prefix are reserved and rejected
- Values must be 63 characters or less, matching `[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?`
This operation does not restart or recreate the sandbox container/pod.
**Concurrency:** This endpoint uses read-modify-write without optimistic
locking (no `resourceVersion` check). Concurrent PATCH requests may
interleave and silently drop updates. Use a single writer or coordinate
out-of-band when concurrent modifications to the same key are expected.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PatchSandboxMetadataRequest'
examples:
add-and-replace:
summary: Add new keys and replace existing values
value:
team: "platform"
version: "2.0"
delete-key:
summary: Delete a metadata key
value:
deprecated-key: null
mixed-operations:
summary: Add, replace, and delete in a single request
value:
project: "new-project"
team: null
environment: "production"
empty-body:
summary: No-op (returns current metadata)
value: {}
responses:
'200':
description: |
Metadata patched successfully. Returns the complete sandbox resource
with updated metadata.
content:
application/json:
schema:
$ref: '#/components/schemas/Sandbox'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
/sandboxes/{sandboxId}/snapshots:
post:
tags: [Snapshots]
summary: Create a snapshot from a sandbox
description: |
Create a persistent point-in-time snapshot from the sandbox's current state.
The source sandbox must be `Running`. The returned snapshot id identifies
the created artifact. Snapshot creation may temporarily pause the sandbox
while the runtime captures provider-supported state, then the source
sandbox continues running.
parameters:
- $ref: '#/components/parameters/SandboxId'
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/CreateSnapshotRequest'
examples:
default:
summary: Create an unnamed snapshot
value: {}
named:
summary: Create a named snapshot
value:
name: checkpoint-before-import
responses:
'202':
description: |
Snapshot creation accepted.
The returned snapshot includes `status.state: "Creating"`.
Poll GET /snapshots/{snapshotId} to track progress until the snapshot
transitions to `Ready` or `Failed`.
content:
application/json:
schema:
$ref: '#/components/schemas/Snapshot'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
Location:
$ref: '#/components/headers/Location'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
/sandboxes/{sandboxId}/pause:
post:
tags: [Sandboxes]
summary: Pause execution while retaining state
description: Pause a running sandbox while preserving its state. Poll GET /sandboxes/{sandboxId} to track state transition through Pausing and eventually Paused.
parameters:
- $ref: '#/components/parameters/SandboxId'
responses:
'202':
description: |
Pause operation accepted.
Sandbox will transition to Pausing state and eventually Paused.
Poll GET /sandboxes/{sandboxId} to track progress.
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
/sandboxes/{sandboxId}/resume:
post:
tags: [Sandboxes]
summary: Resume a paused sandbox
description: Resume execution of a paused sandbox. Poll GET /sandboxes/{sandboxId} to track state transition through Resuming and eventually Running.
parameters:
- $ref: '#/components/parameters/SandboxId'
responses:
'202':
description: |
Resume operation accepted.
Sandbox will transition from Paused → Resuming → Running.
Poll GET /sandboxes/{sandboxId} to track progress.
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
/sandboxes/{sandboxId}/renew-expiration:
post:
tags: [Sandboxes]
summary: Renew sandbox expiration
description: Renew the absolute expiration time of a sandbox.
parameters:
- $ref: '#/components/parameters/SandboxId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RenewSandboxExpirationRequest'
responses:
'200':
description: |
Sandbox expiration updated successfully.
Returns only the updated expiresAt field.
content:
application/json:
schema:
$ref: '#/components/schemas/RenewSandboxExpirationResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalServerError'
/sandboxes/{sandboxId}/endpoints/{port}:
get:
tags: [Sandboxes]
summary: Get sandbox access endpoint
description: |
Get the public access endpoint URL for accessing a service running on a specific port
within the sandbox. The service must be listening on the specified port inside
the sandbox for the endpoint to be available.
parameters:
- $ref: '#/components/parameters/SandboxId'
- name: port
in: path
required: true
description: Port number where the service is listening inside the sandbox
schema:
type: integer
minimum: 1
maximum: 65535
- name: use_server_proxy
in: query
description: Whether to return a server-proxied URL. Cannot be combined with `expires`.
schema:
type: boolean
default: false
- name: expires
in: query
required: false
description: |
Optional. When set, the server **issues a signed** access route (OSEP-0011). The value
is **Linux / Unix epoch seconds** — a decimal `uint64` count of **whole seconds** since
the Unix epoch (`1970-01-01 00:00:00` UTC, same as POSIX / `time(2)`), not
milliseconds. Normalized to `expires_b36` for the four-segment route token. Omit to
get the unsigned/legacy response shape. Cannot be combined with `use_server_proxy=true`.
schema:
type: string
pattern: '^(0|[1-9][0-9]*)$'
minLength: 1
maxLength: 20
responses:
'200':
description: |
Endpoint retrieved successfully.
Returns the public URL for accessing the service on the specified port.
content:
application/json:
schema:
$ref: '#/components/schemas/Endpoint'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'
components:
securitySchemes:
apiKeyAuth:
type: apiKey
in: header
name: OPEN-SANDBOX-API-KEY
description: |
API Key for authentication. Can be provided via:
1. HTTP Header: OPEN-SANDBOX-API-KEY: your-api-key
2. Environment variable: OPEN_SANDBOX_API_KEY (for SDK clients)
parameters:
SandboxId:
name: sandboxId
in: path
required: true
description: Unique sandbox identifier
schema:
type: string
SnapshotId:
name: snapshotId
in: path
required: true
description: Unique snapshot identifier
schema:
type: string
headers:
XRequestId:
description: Unique request identifier for tracing
schema:
type: string
format: uuid
Location:
description: URI of the newly created or related resource
schema:
type: string
format: uri
RetryAfter:
description: Suggested delay in seconds before retrying
schema:
type: integer
minimum: 1
responses:
Error:
description: Error response envelope
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
BadRequest:
description: The request was invalid or malformed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
Unauthorized:
description: Authentication credentials are missing or invalid
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
Forbidden:
description: The authenticated user lacks permission for this operation
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
NotFound:
description: The requested resource does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
Conflict:
description: The operation conflicts with the current state
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
InternalServerError:
description: An unexpected server error occurred
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
headers:
X-Request-ID:
$ref: '#/components/headers/XRequestId'
schemas:
ListSandboxesResponse:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/Sandbox'
pagination:
$ref: '#/components/schemas/PaginationInfo'
required: [items, pagination]
ListSnapshotsResponse:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/Snapshot'
pagination:
$ref: '#/components/schemas/PaginationInfo'
required: [items, pagination]
PaginationInfo:
type: object
description: Pagination metadata for list responses
properties:
page:
type: integer
minimum: 1
description: Current page number
pageSize:
type: integer
minimum: 1
description: Number of items per page
totalItems:
type: integer
minimum: 0
description: Total number of items matching the filter
totalPages:
type: integer
minimum: 0
description: Total number of pages
hasNextPage:
type: boolean
description: Whether there are more pages after the current one
required: [page, pageSize, totalItems, totalPages, hasNextPage]
CreateSandboxResponse:
type: object
description: Response from creating a new sandbox. Contains essential information without startup source details and updatedAt.
properties:
id:
type: string
description: Unique sandbox identifier
status:
$ref: '#/components/schemas/SandboxStatus'
description: Current lifecycle status and detailed state information
metadata:
type: object
additionalProperties:
type: string
description: Custom metadata from creation request
platform:
$ref: '#/components/schemas/PlatformSpec'
description: |
Platform constraint echoed from request or workload template.
Null when no scheduling constraint is provided.
expiresAt:
type: string
format: date-time
description: Timestamp when sandbox will auto-terminate. Omitted when manual cleanup is enabled.
createdAt:
type: string
format: date-time
description: Sandbox creation timestamp
entrypoint:
type: array
items:
type: string
description: |
Entry process specification for the sandbox. For image-created sandboxes,
this is copied from the creation request. For snapshot-created sandboxes,
this is restored from the snapshot.
required:
- id
- status
- createdAt
- entrypoint
CreateSnapshotRequest:
type: object
description: Optional settings for creating a sandbox snapshot.
properties:
name:
type: string
description: Optional human-readable snapshot name.
minLength: 1
additionalProperties: false
Snapshot:
type: object
description: Persistent point-in-time capture of a sandbox.
properties:
id:
type: string
description: Unique snapshot identifier
sandboxId:
type: string
description: Source sandbox identifier used to create this snapshot
name:
type: string
description: Optional human-readable snapshot name
status:
$ref: '#/components/schemas/SnapshotStatus'
description: Current snapshot lifecycle status and detailed state information
createdAt:
type: string
format: date-time
description: Snapshot creation timestamp
required:
- id
- sandboxId
- status
- createdAt
additionalProperties: false
SnapshotState:
type: string
description: |
Snapshot lifecycle state.
Common state values:
- Creating: Snapshot creation has been accepted and runtime capture is in progress.
- Deleting: Snapshot deletion has been requested and cleanup is in progress.
- Ready: Snapshot is available for restoring sandboxes.
- Failed: Snapshot creation failed.
Note: New state values may be added in future versions.
Clients should handle unknown state values gracefully.
SnapshotStatus:
type: object
description: Detailed snapshot status information with lifecycle state and transition details.
properties:
state:
$ref: '#/components/schemas/SnapshotState'
description: Current lifecycle state of the snapshot
reason:
type: string
description: |
Short machine-readable reason code for the current state.
Examples: "snapshot_accepted", "snapshot_ready", "snapshot_capture_failed"
message:
type: string
description: Human-readable message describing the current state or failure reason
lastTransitionAt:
type: string
format: date-time
description: Timestamp of the last state transition
required: [state]
additionalProperties: false
Sandbox:
type: object
description: Runtime execution environment provisioned from a container image or restored from a snapshot
properties:
id:
type: string
description: Unique sandbox identifier
image:
$ref: '#/components/schemas/ImageSpec'
description: |
Container image specification used to provision this sandbox.
Present when the sandbox was created directly from a container image.
Not returned in createSandbox response.
snapshotId:
type: string
description: |
Snapshot identifier used to restore this sandbox.
Present when the sandbox was restored from a snapshot.
Not returned in createSandbox response.
platform:
$ref: '#/components/schemas/PlatformSpec'
description: |
Platform constraint echoed from request or workload template.
Null when no scheduling constraint is provided.
status:
$ref: '#/components/schemas/SandboxStatus'
description: Current lifecycle status and detailed state information
metadata:
type: object
additionalProperties:
type: string
description: Custom metadata from creation request
entrypoint: