Upload or replace the avatar (PNG/JPEG/WebP, up to 2 MB).
POST
/v1/account/avatar
const url = 'https://api.share2.us/v1/account/avatar';const form = new FormData();form.append('file', 'file');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.share2.us/v1/account/avatar \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form file=@fileStores the avatar and charges its bytes to the account storage quota (net of any existing avatar). Requires an interactive login.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typemultipart/form-data
object
file
string format: binary
Responses
Section titled “Responses”The updated profile.
Media typeapplication/json
object
profile
The account owner’s editable profile.
object
display_name
required
string
username
required
Public handle (a-z 0-9 _ -, 3-30). Empty if unclaimed.
string
has_avatar
required
boolean
visibility
required
string
username_change_available_at
Present when the username is within its 30-day change cooldown.
string format: date-time
Example
{ "profile": { "visibility": "public" }}Not enough storage quota (storage_quota_exceeded).
Avatar exceeds 2 MB (avatar_too_large).
default
Section titled “default”Standard error envelope.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
request_id
required
string
Example
{ "error": { "code": "quota_exceeded" }}