{"openapi":"3.1.0","info":{"title":"clubsandwich storage","description":"File uploads for clubsandwich, a private-server reimplementation of the Rec Room\nbackend. The client posts room saves, holotars, images, videos, inventions and\nroom metadata here; each lands in the shared CDN R2 bucket under a folder chosen\nby its `FileType`, and the `cdn` worker serves them back from the same bucket.","version":"1.0.0"},"servers":[{"url":"https://storage.clubsandwich.dev","description":"Production"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"An `access_token` from the auth worker’s `POST /connect/token`."}}},"paths":{"/":{"get":{"operationId":"getIndex","tags":["Meta"],"summary":"Health check","description":"Plain-text liveness probe. No auth.","responses":{"200":{"description":"Service is up (`hello, world!`)","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/upload/video":{"post":{"operationId":"postUploadVideo","tags":["Upload"],"summary":"Get a presigned upload for a developer video","security":[{"bearerAuth":[]}],"description":"Developer-only. Takes `{ filename }` and returns a short-lived presigned `PUT` URL for the CDN R2 bucket, the `key` it lands under (`video/<name>-<id>.<ext>`, served by the `cdn` worker at `/video/<name>`) and the `Content-Type` the `PUT` must send. The file itself goes browser → R2, never through this worker. `.mp4`, `.m4v`, `.webm` and `.mov` are accepted. 503 until the operator configures the R2 credentials.","requestBody":{"description":"The name of the file about to be uploaded","content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","description":"The file name, e.g. `intro.mp4`; its extension picks the type"}},"required":["filename"]}}}},"responses":{"200":{"description":"The presigned upload","content":{"application/json":{"schema":{"type":"object","properties":{"uploadUrl":{"type":"string","description":"A presigned `PUT` URL for the R2 bucket, valid for `expiresIn`"},"key":{"type":"string","description":"The object key, `video/<name>-<id>.<ext>`; the `cdn` serves `/<key>`"},"contentType":{"type":"string","description":"The `Content-Type` the `PUT` must send — the signature binds it"},"expiresIn":{"type":"number","description":"Seconds the URL stays valid"}},"required":["uploadUrl","key","contentType","expiresIn"]}}}},"400":{"description":"A filename that is not an accepted video type","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing or invalid bearer token (empty body)"},"403":{"description":"A valid token without the `developer` role","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"503":{"description":"The R2 credentials are not configured","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/upload":{"post":{"operationId":"postUpload","tags":["Upload"],"summary":"Upload a file","description":"Stores the posted file in the shared CDN R2 bucket under `<type-subfolder>/<upload-date>/<random-name>` and returns the `<upload-date>/<random-name>` part the client references it by (the same name the `cdn` worker serves back). The subfolder comes from `FileType`; RoomSave (1) lands under `room/` so the cdn worker’s `GET /room/:dataBlob` finds it, and an Invention (5) keeps a `.inv` extension on both the key and the returned name. A Data (2) upload may also send a `name` of `{guid}.htr` so a recovered holotar lands at the key room blobs already reference (`data/{guid}.htr`). Auth-gated — any valid account token is allowed, no role check. A post with no binary part but an explicit `imageName` / `filename` / `name` just echoes that name back. Mirrors the reference server’s `Upload`.","security":[{"bearerAuth":[]}],"requestBody":{"description":"The FileType and the file to store","content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"FileType":{"type":"string","description":"The client’s UploadFileType enum as a string: 1 RoomSave, 2 Holotar, 3 Image, 4 Video, 5 Invention, 6 RoomMetadata. 0 (Unknown) and unrecognized values have no destination folder and are rejected."},"imageName":{"description":"Name-only post: with no binary part, an explicit `imageName` / `filename` / `name` is echoed straight back as `filename`.","type":"string"},"File":{"type":"string","format":"binary","description":"The file to store. Matched by being a file part, not by this field name. Omit it to make a name-only post."}},"required":["FileType"]}},"multipart/form-data":{"schema":{"type":"object","properties":{"FileType":{"type":"string","description":"The client’s UploadFileType enum as a string: 1 RoomSave, 2 Holotar, 3 Image, 4 Video, 5 Invention, 6 RoomMetadata. 0 (Unknown) and unrecognized values have no destination folder and are rejected."},"imageName":{"description":"Name-only post: with no binary part, an explicit `imageName` / `filename` / `name` is echoed straight back as `filename`.","type":"string"},"File":{"type":"string","format":"binary","description":"The file to store. Matched by being a file part, not by this field name. Omit it to make a name-only post."}},"required":["FileType"]}}}},"responses":{"200":{"description":"The stored (or echoed) file name","content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","description":"`<YYYY-MM-DD>/<uuid>[.ext]`, or the posted name on a name-only upload"}},"required":["filename"]}}}},"400":{"description":"Unknown/missing FileType, or neither a file nor a name","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing or invalid bearer token (empty body)"},"413":{"description":"The binary file exceeds the configured upload limit","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/upload/unityassets":{"post":{"operationId":"postUploadUnityassets","tags":["Upload"],"summary":"Upload Rec Room Studio source files","description":"Multipart, one `file` part per Unity project file. Each is stored under `studio-source/<name>`, where `<name>` is the editor’s content name (SHA-256 in base 36, 40 digits), and served back by the cdn as `unityasset/<name>`. Answers `[{ filename, hash }]`, one entry per part in posted order. Auth-gated.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"One stored name per posted part","content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","description":"`<YYYY-MM-DD>/<uuid>[.ext]`, or the posted name on a name-only upload"}},"required":["filename"]}}}},"400":{"description":"No file parts","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing or invalid bearer token (empty body)"},"413":{"description":"A file exceeds the configured upload limit","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}}}}