# Apps API

The Apps API: register apps for Sign in with hematite, edit and delete them, with every endpoint's fields, who may call it, its rate limit and a curl example.

## Register an app that signs people in with hematite (D-34). It needs a confirmed email address. Each account can register up to 5 apps. A public app (in a browser or on a phone) proves itself with PKCE alone; a confidential one (on a server) also with its secret, which this response is the only time to see: hematite keeps just its hash.

`POST /apps`

Needs a session token. Rate limit: 10 a minute, per address. Not open to apps or API keys: apps are registered and managed by their makers, signed in to hematite.

### Body

| Field | Type | Required | Notes |
|---|---|---|---|
| `name` | `string` | required | 2 to 40 characters. Never "hematite" or anything that reads as it (case, spacing, accents and look-alike letters don't count), nor a name kept for hematite such as Support or Admin. |
| `type` | `enum` | required | Public: in a browser or on a phone, where no secret stays secret. confidential: on a server, which keeps a secret. One of `public`, `confidential`. |
| `redirectUris` | `string[]` | required | 1 to 10 exact addresses, each https:// (http:// only for localhost and 127.0.0.1, with the port you use), without a #fragment. 1 to 10 items. |

### Response

Returns an [App](https://hematite.gg/docs/developers/models/app), plus this field:

| Field | Type | Present | Notes |
|---|---|---|---|
| `clientSecret` | `string \| null` |  | A confidential app's secret (`hma_…`), shown only now: hematite keeps just a keyed hash of it. Null for a public app. |

Error `403`.

Error `409`.

```bash
curl -X POST 'https://api.hematite.gg/v1/apps' \
  -H "Authorization: $HEMATITE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Ranked","type":"public","redirectUris":["string"]}'
```

Example `data`:

```json
{
  "clientId": "string",
  "name": "Ranked",
  "type": "public",
  "redirectUris": [
    "string"
  ],
  "userCount": 0,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "clientSecret": "string"
}
```

## Rename one of your apps or change the addresses it may send people back to. The new name shows on the consent page and in people's connected apps at once, and an address taken out can't be asked for again. Its type can't change: register another app for that.

`PATCH /apps/:clientId`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: apps are registered and managed by their makers, signed in to hematite.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `clientId` | `any` | required | The client's id. |

### Body

| Field | Type | Required | Notes |
|---|---|---|---|
| `name` | `string` |  | 2 to 40 characters. Never "hematite" or anything that reads as it (case, spacing, accents and look-alike letters don't count), nor a name kept for hematite such as Support or Admin. |
| `redirectUris` | `string[]` |  | 1 to 10 exact addresses, each https:// (http:// only for localhost and 127.0.0.1, with the port you use), without a #fragment. 1 to 10 items. |

### Response

Returns an [App](https://hematite.gg/docs/developers/models/app).

Error `404`: There's no app of yours with this client id.

```bash
curl -X PATCH 'https://api.hematite.gg/v1/apps/1' \
  -H "Authorization: $HEMATITE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Ranked"}'
```

Example `data`:

```json
{
  "clientId": "string",
  "name": "Ranked",
  "type": "public",
  "redirectUris": [
    "string"
  ],
  "userCount": 0,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z"
}
```

## Delete one of your apps. Everyone who connected it is disconnected at once: every token it holds stops working, its codes not yet traded too, and its client id is known no more.

`DELETE /apps/:clientId`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: apps are registered and managed by their makers, signed in to hematite.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `clientId` | `any` | required | The client's id. |

### Response

`data` is empty.

Error `404`: There's no app of yours with this client id.

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

## Replace a confidential app's secret. The old one stops working at once, and this response is the only time to see the new one: hematite keeps just its hash. Nobody is signed out: the app's next token request needs the new secret. A public app has no secret.

`POST /apps/:clientId/secret`

Needs a session token. Rate limit: 10 a minute, per address. Not open to apps or API keys: apps are registered and managed by their makers, signed in to hematite.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `clientId` | `any` | required | The client's id. |

### Response

Returns an `object` with these fields:

| Field | Type | Present | Notes |
|---|---|---|---|
| `clientSecret` | `string` |  | The new secret (`hma_…`), shown only now: hematite keeps just a keyed hash of it. |

Error `404`: There's no app of yours with this client id.

Error `409`.

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

Example `data`:

```json
{
  "clientSecret": "string"
}
```
