# User model

Someone with an account: their username, avatar, badges, counts and profile. The rest is only on your own user: your email and when you confirmed it, your plan, role, storage and billing.

## Fields

| Field | Type | Present | Notes |
|---|---|---|---|
| `id` | `integer` |  |  |
| `username` | `string` |  |  |
| `email` | `string` | optional | Only on your own user; left out of anyone else's. |
| `emailConfirmedAt` | `date-time \| null` | optional | When you confirmed your email address; null until you have. Only on your own user; left out of anyone else's. Apps get it only with the `email` scope, as the address. |
| `createdAt` | `date-time` |  |  |
| `updatedAt` | `date-time` | optional | When your account last changed. Only on your own user; left out of anyone else's. |
| `permissionGroupId` | `integer` | optional | The permission group you're in. It means nothing any more: staff roles aren't groups, and the field goes in a later release. Only on your own user; left out of anyone else's. |
| `subscriptionGroupId` | `integer` | optional | Your plan. Only on your own user; left out of anyone else's. |
| `stripeSubscriptionId` | `string \| null` | optional | Only on your own user; left out of anyone else's. |
| `domainId` | `integer` | optional | The domain your share links use. Only on your own user; left out of anyone else's. |
| `avatarId` | `integer \| null` | optional | Your avatar's stored file; `avatar` is how to load it. Only on your own user; left out of anyone else's. |
| `stripeCustomerId` | `string \| null` | optional | Only on your own user; left out of anyone else's. |
| `inviteId` | `integer \| null` | optional | The invite you signed up with, when sign-up still took one. Only on your own user; left out of anyone else's. |
| `timeZone` | `string \| null` | optional | Your time zone, as your browser reported it: the calendar your achievements count days by. Only on your own user; left out of anyone else's. Apps never get it. |
| `avatar` | `object \| null` |  |  |
| `avatar.key` | `string` |  |  |
| `badgeIds` | `number[]` |  |  |
| `storageUsed` | `number` | optional | Bytes of all the user's images. Only on your own user; left out of anyone else's. |
| `storageLimit` | `number` | optional | Bytes the user's plan holds. Only on your own user; left out of anyone else's. |
| `imageCount` | `number` |  | How many images the user has: all of them on your own user, and to anyone else when the user's `profile.activityVisibility` is `All`; otherwise only their public ones that show who uploaded them. |
| `folderCount` | `number` |  | How many folders the user has: all of them on your own user, and to anyone else when the user's `profile.activityVisibility` is `All`; otherwise only their public ones. |
| `publicImageCount` | `number` | optional | Your public images that show who uploaded them: the `imageCount` anyone else gets unless your `profile.activityVisibility` is `All`. Only on your own user; left out of anyone else's. |
| `publicFolderCount` | `number` | optional | Your public folders: the `folderCount` anyone else gets unless your `profile.activityVisibility` is `All`. Only on your own user; left out of anyone else's. |
| `profile` | [`UserProfile`](https://hematite.gg/docs/developers/models/user-profile) |  |  |

## Returned by

The endpoints whose `data` holds a User as it is, and where.

- [`POST /auth/login`](https://hematite.gg/docs/developers/reference/auth#post-auth-login), in `data.user`
- [`POST /auth/login/second-factor`](https://hematite.gg/docs/developers/reference/auth#post-auth-login-second-factor), in `data.user`
- [`GET /users/:userId`](https://hematite.gg/docs/developers/reference/users#get-users-userid), in `data`
- [`PATCH /users/:userId`](https://hematite.gg/docs/developers/reference/users#patch-users-userid), in `data`
- [`GET /users/@me`](https://hematite.gg/docs/developers/reference/users#get-users-me), in `data`
- [`GET /users/bulk`](https://hematite.gg/docs/developers/reference/users#get-users-bulk), in `data[]`
- [`POST /users/search`](https://hematite.gg/docs/developers/reference/users#post-users-search), in `data.results[]`

## Example

```json
{
  "id": 1,
  "username": "nova",
  "email": "nova@example.com",
  "emailConfirmedAt": "2026-11-10T18:24:00.000Z",
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "permissionGroupId": 1,
  "subscriptionGroupId": 1,
  "stripeSubscriptionId": "string",
  "domainId": 1,
  "avatarId": 1,
  "stripeCustomerId": "string",
  "inviteId": 1,
  "timeZone": "string",
  "avatar": {
    "key": "images/a1b2c3d4e5f6.png"
  },
  "badgeIds": [
    1
  ],
  "storageUsed": 2457600,
  "storageLimit": 1073741824,
  "imageCount": 1,
  "folderCount": 0,
  "publicImageCount": 0,
  "publicFolderCount": 0,
  "profile": {
    "bio": "Screenshots from ranked nights",
    "hideProfile": false,
    "activityVisibility": "All"
  }
}
```
