Uploads a new profile picture and sets it on your account. The previous uploaded picture is deleted.
Note
Requires a session JWT — a dashboard session or an stx login token. API keys are rejected with 401. Any plan.
Request Body
Send the image either way:
•
multipart/form-data with the image in a field named file (avatar is also accepted).
•
A raw body with Content-Type: image/png, image/jpeg, image/gif or image/webp.
PNG, JPEG, GIF and WebP are accepted, up to 2 MB. The type is read from the file's bytes, not its name or Content-Type. SVG is refused.
Serving avatars
avatarUrl points at a public endpoint, GET /v1/auth/avatars/{userId}/{file}. It needs no credential — the random file name is what makes the URL hard to guess — so you can use it directly in an <img> tag. Responses are cached for a year (Cache-Control: public, max-age=31536000, immutable) and served with X-Content-Type-Options: nosniff and Content-Security-Policy: default-src 'none'; sandbox. A new upload gets a new URL. An unknown or deleted file returns 404 not_found, and 503 storage_unavailable when avatar storage is unavailable.
Error Responses
400 Bad Request
bad_request — no image was sent: a multipart body without a file field, or a body that is neither multipart nor image/*:
json
{
"error": {
"code": "bad_request",
"message": "Send the image as multipart/form-data (field \"file\") or as a raw image body.",