# Profiles and follows

## The user object

`GET /v1/users/{handle}` answers with:

| Field | Type | About |
|---|---|---|
| `handle` | string | Their address, `alloymc.dev/@handle` |
| `displayName` | string | Up to 32 characters |
| `private` | boolean | When `true`, only the first fields here are present |
| `avatarUrl` | string | PNG, see [Images](https://api.alloymc.dev/docs/images) |
| `profileUrl` | string | The profile page |
| `bio` | string | Up to 200 characters, at most five lines |
| `pronouns` | string | Up to 24 characters, may be empty |
| `links` | string[] | Up to three `https` links |
| `accent` | string | Their profile colour: `gold`, `copper`, `redstone`, `emerald`, `diamond`, `lapis`, `amethyst` or `steel` |
| `followers`, `following` | number | Counts |
| `createdAt` | string | When they joined |
| `minecraft` | object[] | Linked Minecraft accounts they chose to show, see [Minecraft accounts](https://api.alloymc.dev/docs/minecraft) |

For your own account (`GET /v1/me`) you also get `email`, `emailVerified`, `hasPassword`, `hasGoogle`, `avatar` (`"sigil"` or `"minecraft:<uuid>"`) and hidden Minecraft accounts.

Text fields are plain text. Escape them when you put them in HTML.

### Accent colours

If you want to match someone's profile colour:

| `accent` | Hex |
|---|---|
| gold | `#f8c95a` |
| copper | `#e07a3f` |
| redstone | `#e5484d` |
| emerald | `#3fbf6f` |
| diamond | `#4fd1c5` |
| lapis | `#5b8def` |
| amethyst | `#a77bdb` |
| steel | `#8d969d` |

## Followers and following

```bash
curl https://api.alloymc.dev/v1/users/elchi/followers
curl https://api.alloymc.dev/v1/users/elchi/following
```

```json
{
  "users": [
    { "handle": "kestrel", "displayName": "Kestrel", "accent": "amethyst",
      "avatarUrl": "https://api.alloymc.dev/v1/users/kestrel/avatar.png?v=1a2b3c4d" }
  ],
  "next": 0
}
```

50 per page, newest first; see [pages of results](https://api.alloymc.dev/docs/conventions#pages-of-results).

## Following someone

With a token:

```bash
curl -X PUT    https://api.alloymc.dev/v1/users/elchi/follow -H "Authorization: Bearer <token>"
curl -X DELETE https://api.alloymc.dev/v1/users/elchi/follow -H "Authorization: Bearer <token>"
```

Both answer `204` and are safe to repeat.

## Changing your profile

`PATCH /v1/me` takes only the fields you want to change:

```bash
curl -X PATCH https://api.alloymc.dev/v1/me \
  -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \
  -d '{"bio": "Builds castles, breaks modpacks.", "accent": "emerald"}'
```

It answers with your updated account. The same limits apply as on the website: handles can change twice a day, links must be `https`, and the bio is at most 200 characters.
