Files
e2b-dev--e2b/spec/openapi-volumecontent.yml
T
Mish Ushakov 4fcf7cb150 feat: sync API specs from infra and belt with Copybara (#1564)
The specs in `spec/` were copied from their source repos by hand and had
drifted ~2,400 lines behind infra, so they are now imported with
Copybara (`copy.bara.sky`, run in a pinned Docker image by
`scripts/fetch-spec.sh`): `make codegen` re-fetches them at the commits
pinned in `spec/infra-ref` and `spec/belt-ref` before generating, and
the generated-files CI check fails if the tracked copies don't match the
pins. Regenerating from the current pins picks up the accumulated spec
changes in the generated JS/Python clients (renamed request schemas,
`SandboxNetworkConfig`, `SandboxIam` workload identity,
`FILE_TYPE_SYMLINK`, access-token auth deprecation, volume path-metadata
tweaks). The one handwritten SDK change follows from that: the public
`FileType` enums gain a `SYMLINK` member (JS and both Python surfaces)
so entries envd reports as symlinks show up in `files.list()` and
`getInfo()`/`get_info()` instead of being silently skipped as unknown
types. The custom `spec/remove_extra_tags.py` tag-filtering script is
replaced by Redocly CLI's `filter-in` decorator (`redocly.yaml`), which
produces identical generated JS output; a `filter-out` decorator
additionally drops any operation or component schema the upstream specs
mark `x-not-implemented: true` (currently the SOCKS5
`SandboxEgressProxyConfig`/`egressProxy` surface, which infra flagged as
spec-only); each SDK's bundle now goes to its own gitignored
`spec/openapi_generated.<api>.yml` instead of both pipelines overwriting
one shared file; Python client models now list fields in spec order
instead of alphabetical (mechanical reordering only — construct models
with keyword args). Spec fetches try whatever GitHub token is available
and fall back to the tracked copies with a warning (the public infra
specs also fetch anonymously); in CI a short-lived belt-scoped token is
minted from the org-wide Autofixer GitHub App (no new secrets), so fork
PRs simply fall back for the belt spec; the CI workflows also cache the
Copybara image alongside the codegen image, and the previously ignored
`CODEGEN_IMAGE` env is honored by the Makefile.

## Usage

```sh
# update the specs: bump a pin, then regenerate
echo <infra-commit-sha> > spec/infra-ref
make codegen

# fetch a single spec without regenerating
pnpm fetch:api-spec     # spec/openapi.yml from infra
pnpm fetch:envd-spec    # spec/envd/ from infra
pnpm fetch:volume-spec  # spec/openapi-volumecontent.yml from belt

# try the latest spec without touching the pin
E2B_INFRA_REF=main pnpm fetch:api-spec

# change which endpoint tags an SDK exposes
$EDITOR redocly.yaml && make codegen
```

```ts
// symlinks are now visible in the filesystem API (JS; same shape in Python)
const entries = await sandbox.files.list('/home/user')
const link = entries.find((e) => e.type === FileType.SYMLINK)
console.log(link?.symlinkTarget)
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 16:37:02 +02:00

331 lines
8.1 KiB
YAML

openapi: 3.0.0
info:
version: 0.1.0
title: E2B API
security:
- VolumeJWT: [ ]
components:
securitySchemes:
VolumeJWT:
type: http
scheme: bearer
bearerFormat: JWT
parameters:
volumeID:
name: volumeID
in: path
required: true
schema:
type: string
path:
name: path
in: query
required: true
schema:
type: string
minLength: 1
responses:
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"401":
description: Authentication error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"403":
description: Forbidden
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"404":
description: Not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"409":
description: Conflict
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
schemas:
Error:
required:
- code
- message
properties:
code:
type: string
description: Error code
message:
type: string
description: Error message
VolumeEntryStat:
type: object
properties:
name:
type: string
type:
type: string
enum: [ unknown, file, directory, symlink ]
path:
type: string
size:
type: integer
format: int64
mode:
type: integer
format: uint32
uid:
type: integer
format: uint32
gid:
type: integer
format: uint32
atime:
type: string
format: date-time
mtime:
type: string
format: date-time
ctime:
type: string
format: date-time
target:
type: string
required:
- name
- type
- path
- size
- mode
- uid
- gid
- atime
- mtime
- ctime
VolumeDirectoryListing:
type: array
items:
$ref: "#/components/schemas/VolumeEntryStat"
paths:
/volumecontent/{volumeID}/path:
get:
description: Get path information
tags: [ volumes ]
parameters:
- $ref: "#/components/parameters/volumeID"
- $ref: "#/components/parameters/path"
responses:
"200":
description: Successfully retrieved path information
content:
application/json:
schema:
$ref: "#/components/schemas/VolumeEntryStat"
"404":
$ref: "#/components/responses/404"
patch:
description: Update path metadata
tags: [ volumes ]
parameters:
- $ref: "#/components/parameters/volumeID"
- $ref: "#/components/parameters/path"
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
uid:
type: integer
format: uint32
gid:
type: integer
format: uint32
mode:
type: integer
format: uint32
responses:
"200":
description: "Successfully updated a path's metadata"
content:
application/json:
schema:
$ref: "#/components/schemas/VolumeEntryStat"
"400":
description: "Invalid metadata provided"
"404":
description: "path not found"
"500":
description: "Internal server error"
delete:
description: Delete a path
tags: [ volumes ]
parameters:
- $ref: "#/components/parameters/volumeID"
- $ref: "#/components/parameters/path"
responses:
"204":
description: Successfully deleted a path
"404":
$ref: "#/components/responses/404"
/volumecontent/{volumeID}/dir:
get:
description: List directory contents
tags: [ volumes ]
parameters:
- $ref: "#/components/parameters/volumeID"
- $ref: "#/components/parameters/path"
- name: depth
in: query
description: Number of layers deep to recurse into the directory
schema:
type: integer
format: uint32
default: 1
responses:
"200":
description: "Successfully retrieved a directory listing"
content:
application/json:
schema:
$ref: "#/components/schemas/VolumeDirectoryListing"
"400":
description: "Invalid path provided"
"404":
description: "path not found"
"500":
$ref: "#/components/responses/500"
post:
description: "Create a directory"
tags: [ volumes ]
parameters:
- $ref: "#/components/parameters/volumeID"
- $ref: "#/components/parameters/path"
- name: uid
in: query
description: User ID of the created directory
schema:
type: integer
format: uint32
- name: gid
in: query
description: Group ID of the created directory
schema:
type: integer
format: uint32
- name: mode
in: query
description: Mode of the created directory
schema:
type: integer
format: uint32
- name: force
in: query
description: Create the parents of a directory if they don't exist
schema:
type: boolean
responses:
"201":
description: "Successfully created a directory"
content:
application/json:
schema:
$ref: "#/components/schemas/VolumeEntryStat"
"404":
description: "path not found"
"500":
$ref: "#/components/responses/500"
/volumecontent/{volumeID}/file:
get:
description: Download file
tags: [ volumes ]
parameters:
- $ref: "#/components/parameters/volumeID"
- $ref: "#/components/parameters/path"
responses:
"200":
description: "Successfully downloaded a file"
content:
application/octet-stream:
schema:
type: string
format: binary
"404":
description: "path not found"
"500":
$ref: "#/components/responses/500"
put:
description: Upload file
tags: [ volumes ]
parameters:
- $ref: "#/components/parameters/volumeID"
- $ref: "#/components/parameters/path"
- name: uid
in: query
description: User ID of the uploaded file
schema:
type: integer
format: uint32
- name: gid
in: query
description: Group ID of the uploaded file
schema:
type: integer
format: uint32
- name: mode
in: query
description: Mode of the uploaded file
schema:
type: integer
format: uint32
- name: force
in: query
description: Force overwrite of an existing file
schema:
type: boolean
requestBody:
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
"201":
description: "Successfully created a file"
content:
application/json:
schema:
$ref: "#/components/schemas/VolumeEntryStat"
"404":
description: "path not found"
"500":
$ref: "#/components/responses/500"