# Session model

A device that is signed in, or an upload token. Never its token: only the response that creates it has that.

## Fields

| Field | Type | Present | Notes |
|---|---|---|---|
| `id` | `integer` |  |  |
| `userId` | `integer` |  |  |
| `type` | `enum` |  | One of `User`, `Upload`, `OAuth`, `Key`. |
| `publicId` | `string` |  | Names the session: safe to show and to say to support, and what its token starts with after its kind and environment. It proves nothing. |
| `createdAt` | `date-time` |  |  |
| `usedAt` | `date-time` |  |  |
| `expiresAt` | `date-time \| null` |  |  |
| `ip` | `string \| null` |  |  |
| `device` | `string \| null` |  |  |
| `note` | `string` |  |  |

## Extended by

The endpoints that return a Session with fields of their own, and the fields they add.

- [`POST /sessions`](https://hematite.gg/docs/developers/reference/sessions#post-sessions) adds `token`
- [`GET /users/:userId/sessions`](https://hematite.gg/docs/developers/reference/users#get-users-userid-sessions) adds `current` to each

## Example

```json
{
  "id": 1,
  "userId": 1,
  "type": "Upload",
  "publicId": "m0plGGtn67kMZy6D",
  "createdAt": "2026-11-10T18:24:00.000Z",
  "usedAt": "2026-11-10T18:24:00.000Z",
  "expiresAt": "2027-11-10T18:24:00.000Z",
  "ip": "203.0.113.7",
  "device": "Mozilla/5.0",
  "note": "ShareX"
}
```
