# Sessions API

The Sessions API: make upload tokens for uploaders and delete sessions, with every endpoint's fields, who may call it, its rate limit and a curl example.

## Create an upload token. The response is the only time its token is shown: hematite keeps just its hash. It works until expiresAt, which is in the future and at most 366 days away.

`POST /sessions`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: signing in, sessions and upload tokens are the account's own.

### Body

| Field | Type | Required | Notes |
|---|---|---|---|
| `type` | `"Upload"` | required |  |
| `expiresAt` | `date-time` | required |  |

### Response

Returns a [Session](https://hematite.gg/docs/developers/models/session), plus this field:

| Field | Type | Present | Notes |
|---|---|---|---|
| `token` | `string` |  | The session's token (`hms_…` for a sign-in, `hmu_…` for an upload key). Shown only now; hematite keeps just a keyed hash of its secret. |

```bash
curl -X POST 'https://api.hematite.gg/v1/sessions' \
  -H "Authorization: $HEMATITE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"type":"Upload","expiresAt":"2026-11-10T18:24:00.000Z"}'
```

Example `data`:

```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",
  "token": "hms_live_m0plGGtn67kMZy6D_…"
}
```

## Delete a session

`DELETE /sessions/:sessionId`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: signing in, sessions and upload tokens are the account's own.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `sessionId` | `number` | required |  |

### Response

`data` is empty.

```bash
curl -X DELETE 'https://api.hematite.gg/v1/sessions/1' \
  -H "Authorization: $HEMATITE_TOKEN"
```
