CLI HTTP API
What moddio login and moddio publish call.
All requests: Authorization: Bearer <CLI token>. Errors: { "error": "<what to fix>" }.
Sign in (device flow, RFC 8628 shape; no token needed)
POST /api/cli/auth/device { client_name? }
-> { device_code, user_code, verification_uri, verification_uri_complete, expires_in, interval }
POST /api/cli/auth/token { device_code }
-> 400 { error: "authorization_pending" | "slow_down" | "expired_token" | "access_denied" | "invalid_grant" }
-> 200 { access_token, token_type: "Bearer", scope: "publish", user: { username } }
Account
GET /api/cli/whoami -> { username, scope }
DELETE /api/cli/token revoke the token making the call
Games (your own only)
GET /api/cli/games -> { games: [...] }
POST /api/cli/games { title, template? } -> 201 { game }
GET /api/cli/games/:idOrSlug -> { game }
Publishing a version
POST /api/cli/blobs/missing { hashes: [sha256...] } -> { missing: [sha256...] }
PUT /api/cli/blobs/:sha256 (raw bytes, application/octet-stream, at most 10 MB) -> 201 or 200
POST /api/cli/games/:idOrSlug/releases { files: [{ path, hash, size }], notes? }
-> 201 { release: { id, version, status: "live" | "held" | "rejected", review }, game, playUrl, message }
-> 409 { missing: [...] } upload those first
-> 422 { errors: [...] } the sim or hooks import or use something forbidden
GET /api/cli/games/:idOrSlug/releases -> { releases: [...] }
Bundle paths: moddio.json, sim.js, server.js (optional), client/index.html, client/**, assets/**.