Skip to content

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.

POST /machine/files

Roles: owner admin member

Upload a file via multipart/form-data. A SHA-256 checksum is computed automatically.

Terminal window
curl -X POST https://apis.jameslin.info/machine/files \
-H "X-API-Key: mk_..." \
-F "file=@.env.local"
{
"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.

GET /machine/files

ParamTypeDefaultDescription
limitnumber50Max results (capped at 100)
offsetnumber0Pagination offset
{
"files": [
{
"id": "a1b2c3d4-...",
"filename": ".env.local",
"contentType": "application/octet-stream",
"sizeBytes": 1234,
"checksum": "e3b0c44298fc...",
"createdAt": "2026-02-07T12:00:00.000Z"
}
]
}

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 /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.