DorkOS
ApiProfileAvatar

Set the operator's profile photo

POST
/api/profile/avatar

Multipart upload of a single image in the avatar field. The photo replaces whatever was there, in any format. Three refusals, all before anything is stored: over 2 MB (413), and anything whose MAGIC BYTES are not PNG, JPEG or WebP (415) — the filename and the Content-Type the client claims are not evidence, since both are written by whoever is uploading. SVG is therefore refused too, on purpose: it is a script vector, and a profile photo has no reason to be one. Nothing is re-encoded or resized. Only a person may call this; an agent presenting a valid identity token is refused (403), and one whose token this machine cannot verify is refused (401). The URL that comes back is written to BOTH the roster (authors.image_url) and the account record (user.image), so the two cannot disagree — and it is opaque: server-relative today, absolute the day a remote store backs it.

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/profile/avatar" \  -F avatar="string"
{  "imageUrl": "string"}