Files
Upload and share dev config files (.env, docker-compose.yml, CI configs, etc.) with your team. Files are stored in Cloudflare R2 with metadata tracked in D1.
Upload a file
Section titled “Upload a file”POST /machine/files
Roles: owner admin member
Upload a file via multipart/form-data. A SHA-256 checksum is computed automatically.
curl -X POST https://apis.jameslin.info/machine/files \ -H "X-API-Key: mk_..." \ -F "file=@.env.local"Response 201
Section titled “Response 201”{ "id": "a1b2c3d4-...", "filename": ".env.local", "size": 1234, "checksum": "e3b0c44298fc1c149afbf4c8...", "createdAt": "2026-02-07T12:00:00.000Z"}Returns 400 if the file field is missing. Returns 403 if the file count or storage quota is exceeded.
List files
Section titled “List files”GET /machine/files
| Param | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Max results (capped at 100) |
offset | number | 0 | Pagination offset |
Response
Section titled “Response”{ "files": [ { "id": "a1b2c3d4-...", "filename": ".env.local", "contentType": "application/octet-stream", "sizeBytes": 1234, "checksum": "e3b0c44298fc...", "createdAt": "2026-02-07T12:00:00.000Z" } ]}Download a file
Section titled “Download a file”GET /machine/files/:id
Returns the raw file content with Content-Type, Content-Disposition, and Content-Length headers.
Returns 404 if the file doesn’t exist.
Delete a file
Section titled “Delete a file”DELETE /machine/files/:id
Roles: owner admin member
Deletes the file from R2 storage and D1 metadata. Triggers the file.deleted webhook event.
Returns { "success": true } on success, 404 if not found.