Commit c0a60da
Add API Reference to docs navigation (#127)
* Add API Reference section to docs navigation
Add OpenAPI-based API Reference anchor to docs.json alongside the existing SDK Reference, pointing to openapi-public.yml spec.
* Add OpenAPI generation and validation scripts
- scripts/envd.py: Merges proto-generated and hand-written specs into a single openapi-public.yml
- scripts/validate_api_reference.py: Validates the spec against the live API across 12 phases
* Rename envd.py to generate_openapi_reference.py
* Refactor generate script to fetch specs from e2b-dev/infra
The script now clones e2b-dev/infra at specified commits inside Docker
instead of reading from local paths. Supports separate --envd-commit and
--api-commit flags (defaults to main). Regenerated openapi-public.yml
from latest main.
* Require sandbox access token auth on all envd endpoints
Sandbox endpoints always require Authorization: Bearer <token> using the
envdAccessToken from sandbox creation. Update generate script to set
required auth, update validate script to always pass token and create
sandboxes with secure: true.
* Fix auth schemes: restore AccessTokenAuth (Bearer), add E2B_ACCESS_TOKEN support
- Keep AccessTokenAuth (type: http, scheme: bearer) for platform endpoints
- Remove /files from AUTH_EXEMPT_ENDPOINTS (only /health is exempt)
- Add E2B_ACCESS_TOKEN env var to validate script for Bearer auth testing
- Pass sandbox access token to /files endpoints in validate script
- Fix sandboxID server variable default to $SANDBOX_ID
* Add E2B_ACCESS_TOKEN support and improve team ID discovery
- Add bearer_hdr() helper for AccessTokenAuth endpoints
- Read E2B_ACCESS_TOKEN env var for GET /teams and legacy template endpoints
- Discover team ID via GET /teams when Bearer token is available
* Fix spec validation findings: 20 critical → 0
Generate script (fix_spec_issues):
- Add 'uploaded' to TemplateBuildStatus enum
- Make 'volumeMounts' optional in SandboxDetail/ListedSandbox
- Remove strict LogLevel enum (server sends non-enum values)
- Add mem_used_mib/mem_total_mib to Metrics schema
Validate script:
- Fix /health expected status to 204
- Fix /init expected status to 401 (re-init rejected)
- Remove /v2/sandboxes/{id}/logs test (endpoint doesn't exist)
* Strip content blocks from 204 responses
204 means No Content — don't add application/json schema to these responses.
* Prefix auth description links with /docs
* Add success-path tests for all template write endpoints
- POST /v3/templates (202): create template, validate schema, clean up
- POST /v2/templates (202): create template, validate schema, clean up
- PATCH /v2/templates/{templateID} (200): update public field, validate schema
- PATCH /templates/{templateID} (200): deprecated endpoint success test
- POST /v2/.../builds/{buildID} (202): start build on created template
- POST /templates/tags (201): assign tag using existing name:tag target
- DELETE /templates/tags (204): remove test tag
- DELETE /templates/{templateID}: real cleanup of test templates
- GET /templates/{templateID}/tags: discover existing tags in phase 2
- Drop minor findings from report and exit code (CI-oriented)
* Fix 8 spec issues found during SDK testing
1. Streaming RPCs: content-type → application/connect+json, add
Connect-Protocol-Version and Connect-Timeout-Ms headers
2. EndEvent.exitCode: marked deprecated, document status string parsing
3. envdAccessToken: clarify only returned with secure: true, mark nullable
4. LogLevel: fix description ("State of the sandbox" → log severity)
5. Sandbox.domain: mark deprecated (always null)
6. GET /templates/{id}/files/{hash}: change 201 → 200 response
Issues 4 (pagination response) and 5 (DELETE with body) are upstream
API design decisions that cannot be fixed in the spec alone.
* Fix 12 spec inconsistencies from SDK testing report
Generation script fixes (fix_spec_issues):
- Generate operationId for all 52 platform endpoints
- Remove phantom /v2/sandboxes/{sandboxID}/logs deprecation reference
- Complete truncated 'start'/'end' parameter descriptions on metrics
- Fix sandboxId → sandboxID casing in 502 error schema
- Add security: [] and 'health' tag to GET /health
- Remove YAML anchor overlay on /files responses (DownloadSuccess/UploadSuccess)
- Add type: object to 53 schemas missing it
- Move 'end' param description out of schema to sibling level
Also fix fill_empty_responses to skip $ref responses.
Upstream issues not fixable in spec:
- allow_internet_access snake_case (server field name)
- Duplicate EntryInfo schemas (different APIs)
- Inconsistent error response coverage (API behavior)
- Auth inconsistency across template versions (intentional v1→v2/v3)
* Fix schema and consistency issues from second SDK testing round
Schema fixes:
- EntryInfo.type: add 'directory' to enum (was file-only)
- SandboxMetadata, EnvVars: add type: object (had only additionalProperties)
- TemplateLegacy: add missing 'names' and 'buildStatus' fields
- connect-protocol-version: remove redundant enum (const suffices)
- filesystem.EntryInfo.size: document int/string union type (int64)
Response fixes:
- PATCH /templates/{templateID}: return TemplateUpdateResponse (was empty)
- POST /sandboxes/{sandboxID}/refreshes: add missing 500 response
- GET /health 502: content-type → application/json (was connect+json)
Also fix fill_empty_responses to skip $ref responses.
* Fix duplicate and misspelled operationIds
- Rewrite operationId generator with proper singularization
(sandboxes→sandbox, not sandboxe)
- Use 'list' prefix for collection GETs (listSandboxes, listTemplates)
- Include version suffix for v2/v3 variants (postTemplatesV3)
- Singularize parent resource when followed by path param
(GET /sandboxes/{id}/logs → getSandboxLogs)
- Dedup check ensures all 52 platform operationIds are unique
* Exclude snapshots/volumes endpoints, merge auth tests into Teams phase
* Rename and reorder API reference tags for documentation sidebar
* Reorder paths by tag to match desired Mintlify sidebar order
* Tag untagged endpoints (/metrics, /envs) as Others so they appear in the correct section
* Add meaningful examples to error responses (400/401/403/404/409/500)
* Inline /files response definitions so Mintlify renders them correctly
* Move error example to Error schema so it applies to all references
* Add per-status error examples so each error response shows correct code and message
* Lowercase 'reference' in SDK reference and API reference anchors
* Add short summaries to all platform endpoints for readable Mintlify sidebar names
* Set format: int64 on Metrics memory/disk fields to prevent overflow
* Replace nullable: true with OpenAPI 3.1.0 type arrays on 14 properties
* Fix validation script: correct expected statuses, remove internal endpoints, add status mismatch catch-all
- Change DELETE /templates/{templateID} cleanup expected status from 200 to 204
- Remove POST /init test (internal endpoint, not in public spec)
- Remove unauthenticated 401 tests to avoid load balancer rate limiting
- Use account-owned template alias instead of hardcoded 'base' for alias test
- Send no-op Update to process instead of PTY resize (avoids 500 on non-PTY process)
- Add post-processing catch-all that flags any tested endpoint with unexpected status code
* Hide deprecated badges in sidebar to prevent endpoint name truncation
* Add API reference validation workflow (manual trigger only for now)
* Fix validation script: remove Bearer-only tests, move alias test to phase 3, update workflow
- Remove 3 endpoints that tested API key against Bearer-only endpoints (just confirmed 401)
- Move GET /templates/aliases/{alias} test to phase 3, use the test template we create there
- Update workflow to generate spec, diff, run validation, and create PR with status indicator
* Remove openapi-validation-report.md from repo
* Hide scrollbar on sidebar API endpoint rows with deprecated badges
* edit workflow
* test true
* works, back to false
* Make workflow run on schedule (disabled for now)
* 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
* Map snapshots tag to Sandboxes section in generate script
* Remove validation script and simplify workflow to generate-and-PR only
* Remove example fields from generate script and regenerate spec
* Update docs.json
* Reorder API reference sidebar: move Tags under Templates, rename Others to Envd, move /files to Filesystem, move Teams to end
---------
Co-authored-by: Jakub Novák <kubus.novak@gmail.com>1 parent 2f7a1d8 commit c0a60da
File tree
5 files changed
+5864
-0
lines changed- .github/workflows
- scripts
5 files changed
+5864
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3620 | 3620 | | |
3621 | 3621 | | |
3622 | 3622 | | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
3623 | 3631 | | |
3624 | 3632 | | |
3625 | 3633 | | |
| |||
0 commit comments