Buddies API
Create and interact with virtual buddies. Each authenticated user can own up to 20 buddies. All endpoints require session authentication.List buddies
Response
Buddy object fields
| Field | Type | Description |
|---|---|---|
id | string | Unique buddy identifier |
userId | string | ID of the owning user |
name | string | Display name (max 30 characters) |
type | string | Buddy type: crab, robot, ghost, dragon, or alien |
level | integer | Current level (starts at 1) |
xp | integer | Experience points accumulated |
energy | integer | Energy level (0–100, starts at 50) |
happiness | integer | Happiness level (0–100, starts at 50) |
lastFed | string | ISO 8601 timestamp of last feed action |
lastPlayed | string | ISO 8601 timestamp of last play action |
createdAt | string | ISO 8601 timestamp when the buddy was created |
updatedAt | string | ISO 8601 timestamp of last update |
Errors
| Code | Description |
|---|---|
| 401 | Unauthorized — no valid session |
Hatch a buddy
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name for the buddy (max 30 characters) |
type | string | Yes | Buddy type: crab, robot, ghost, dragon, or alien |
Example request
Response (201)
Errors
| Code | Description |
|---|---|
| 400 | Invalid name (missing, non-string, or exceeds 30 characters) |
| 400 | Invalid buddy type (must be one of the valid types) |
| 400 | Maximum of 20 buddies reached |
| 400 | Invalid request body |
| 401 | Unauthorized — no valid session |
Perform an action on a buddy
feed, play, train, and rename.
Path parameters
| Parameter | Type | Description |
|---|---|---|
buddyId | string | The buddy’s unique identifier |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Action to perform: feed, play, train, or rename |
newName | string | Only for rename | New display name (1–30 characters) |
Action effects
| Action | Effect |
|---|---|
feed | Energy +20 (capped at 100), happiness +10 (capped at 100), XP +10, updates lastFed |
play | Happiness +15 (capped at 100), XP +25, updates lastPlayed |
train | Energy −30 (requires at least 30), happiness −10 (floored at 0), XP +50 |
rename | Changes the buddy’s display name (requires newName in the request body) |
Example requests
Feed a buddy:Response
Forfeed, play, and train actions the response includes a leveledUp boolean indicating whether the buddy gained a level from the action:
rename action, only the updated buddy object is returned (no leveledUp field):
Errors
| Code | Description |
|---|---|
| 400 | Invalid action (must be feed, play, train, or rename) |
| 400 | Not enough energy to train (requires at least 30) |
| 400 | Invalid name for rename (must be a non-empty string, 1–30 characters) |
| 400 | Invalid request body |
| 401 | Unauthorized — no valid session |
| 404 | Buddy not found or does not belong to the authenticated user |
Delete a buddy
Path parameters
| Parameter | Type | Description |
|---|---|---|
buddyId | string | The buddy’s unique identifier |
Response
Errors
| Code | Description |
|---|---|
| 401 | Unauthorized — no valid session |
| 404 | Buddy not found or does not belong to the authenticated user |