Skip to main content
Upload File
Uploads a file directly to storage without processing. Suitable for PDFs, videos, Office documents, and other non-image assets. The file type is inferred automatically from the MIME type. This endpoint accepts multipart/form-data. Requires an authenticated user. Rate limit: 10 requests per 5 minutes.

Body Parameters

file
required
The file to upload. Maximum 50 MB.
array
required
JSON-encoded array of path segments. The file is stored under the joined path with a UUID sub-folder appended. Example: ["documents", "user-123"] → documents/user-123/<uuid>/<filename>. A part that is, or contains, a . or .. folder is refused with 400 storage/invalid-body.
string
Associates the file with an entity for cascade deletion. Only the entity’s author can attach to it (a service key can attach to any entity).
string
Associates the file with a comment for cascade deletion. Only the comment’s author can attach to it (a service key can attach to any comment).
string
Associates the file with a space.
number
Display order when a record has multiple attachments, from 0 to 10000. Defaults to 0.
object
Custom key-value data stored alongside the file record.
string
Attribute the upload to a specific user. With a user token the upload is already attributed to the caller; only service keys may name a different user. Omit for a backend/project-owned file (no owning user).

Response

The type field is one of: image, video, document, other. It is inferred from the MIME type.

Error Responses

The caller can’t update the record named by entityId or commentId: they aren’t the entity’s or comment’s author. The message names the record type. Nothing is stored.
The record named by entityId or commentId doesn’t exist, or counts as missing: a deleted record, an entity removed by moderation and a comment its author deleted all answer 404. The code is storage/entity-not-found or storage/comment-not-found. Nothing is stored.