Skip to main content
Upload a file to the room’s R2 object storage.

Endpoint

POST /v1/accounts/:accountId/upload

Authentication

Bearer token required.

Request Body

multipart/form-data with the following fields:
roomId
string
required
The room to associate the file with.
userId
string
required
The user uploading the file.
file
File
required
The file to upload.

Response

file
UploadResult
The uploaded file’s key and URL. See UploadResult.

Example

curl -X POST https://api.collab-kit.com/v1/accounts/${ACCOUNT_ID}/upload \
  -H "Authorization: Bearer ${TOKEN}" \
  -F "roomId=c3003c93-60cf-4184-b85f-20be14d26dac" \
  -F "userId=user-001" \
  -F "file=@./screenshot.png"
Response
{
  "type": "response",
  "success": true,
  "description": "File uploaded",
  "data": {
    "file": {
      "key": "c3003c93/uploads/screenshot.png",
      "url": "https://api.collab-kit.com/v1/accounts/${ACCOUNT_ID}/storage/c3003c93/uploads/screenshot.png"
    }
  },
  "error": null
}