Get Avatar Thumbnail
GET /api/avatar/{username}
Retrieves or waits for a user’s avatar thumbnail image (head or body shot).
The username to get avatar for. Append
-body suffix for full body shot instead of head shot.If present, waits for the avatar image to be created or updated before responding
Shot Types
The endpoint supports two shot types based on the username parameter:Default behavior - returns head thumbnail from
{userId}-head.pngAppend
-body to username - returns full body thumbnail from {userId}-body.pngResponse
Returns a PNG image file. If the avatar doesn’t exist, returns a placeholder image (static/dots.png).
Wait Mode
When thewait parameter is present:
- If file doesn’t exist: waits for it to be created
- If file exists: waits for it to be modified
- Uses filesystem watching to detect changes
- Returns immediately if watching fails
Example Requests
Storage Location
Avatar images are stored at:- Head shots:
../data/avatars/{userId}-head.png - Body shots:
../data/avatars/{userId}-body.png
Implementation
Source:api/avatar/[username]/+server.ts:5
Render Character (Base)
GET /api/render/character
Returns base body colors XML for character rendering. Used as a foundation for avatar rendering.
Response
Returns XML with all body colors set to value1:
Example Request
Implementation
Source:api/render/character/+server.ts:1
Render Character with Asset
GET /api/render/characterasset
Returns a character appearance URL that combines base body colors with a specific asset. Used for generating avatar renders with clothing or accessories.
Asset ID to apply to the character
Response
Returns a plain text string with semicolon-delimited URLs:Set to
no-cacheURL Format
The response contains two parts:- Base character render endpoint
- Asset endpoint for the specified asset ID
Example Request
Example Response
Implementation
Source:api/render/characterasset/+server.ts:5