Skip to main content
Upload Image
Uploads an image, processes it with Sharp, and stores the original plus all requested variants. Returns proxy URLs for all variants immediately. This endpoint accepts multipart/form-data. Requires an authenticated user. Rate limit: 20 requests per 5 minutes.

Body Parameters

file
required
The image file to upload. Must be a valid image format recognized by Sharp (JPEG, PNG, WebP, AVIF, TIFF, GIF, SVG). Maximum 50 MB.
string
required
Processing mode. One of: exact-dimensions, aspect-ratio-width-based, aspect-ratio-height-based, original-aspect, multi-aspect-ratio.
object
Required for exact-dimensions mode. An object mapping variant names to { width, height } pairs.
object
Required for aspect-ratio-width-based and aspect-ratio-height-based modes. { width, height } ratio.
object
Required for aspect-ratio-width-based mode. An object mapping variant names to pixel widths.
object
Required for aspect-ratio-height-based mode. An object mapping variant names to pixel heights.
object
Required for original-aspect and multi-aspect-ratio modes. An object mapping variant names to longest-edge pixel sizes.
array
Required for multi-aspect-ratio mode. Array of { width, height } aspect ratio objects.
string
Sharp fit strategy. Defaults to cover. Valid values depend on the mode:
  • exact-dimensions, aspect-ratio-width-based, aspect-ratio-height-based, multi-aspect-ratio: cover, contain, inside, or outside
  • original-aspect: inside or outside only (cover/contain are not valid for this mode)
number
Output quality (1–100). Applies to JPEG and WebP. Defaults to 85.
string
Output format: webp, jpeg, png, or original. Defaults to webp.
boolean
Remove EXIF metadata from output. Defaults to true.
array
Folder segments for the stored image, as a JSON-encoded array. The new file’s id is always added after them, so the image and its sizes are stored under <pathParts>/<fileId>/. Example: ["avatars", "user-123"] → avatars/user-123/<fileId>/<filename>. Defaults to ["images"]. A part that is, or contains, a . or .. folder (also written %2e%2e), or that contains ?, # or an encoded slash (%2f, %5c), is refused with 400 storage/invalid-image-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.
string
Associates the image with an event. Only one of the event’s hosts can attach to it (a service key can attach to any event). Requires the events bundle: without it the upload is refused with 403 storage/events-bundle-required.
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

Error Responses

The caller can’t update the record named by entityId, commentId or eventId: they aren’t the entity’s or comment’s author, or a host of the event. The message names the record type. Nothing is stored.
The record named by entityId, commentId or eventId 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, storage/comment-not-found or storage/event-not-found. Nothing is stored.