# Domains API

The Domains API: add a domain, check its nameservers, edit or delete it, with every endpoint's fields, who may call it, its rate limit and a curl example.

## Create a new domain. It's Public, but one whose name reads as a payment, a sign-in, a brand or hematite's staff (`paypal-support.example`) is Private, and stays so.

`POST /domains`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Body

| Field | Type | Required | Notes |
|---|---|---|---|
| `name` | `string` | required | At least 3 characters. |

### Response

Returns a [Domain](https://hematite.gg/docs/developers/models/domain).

Error `409`: Domain already exists.

Error `422`: Cloudflare rejected the request.

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

Example `data`:

```json
{
  "id": 1,
  "name": "yourdomain.com",
  "userId": 1,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "cloudflareZoneId": "string",
  "status": "AwaitingNameservers",
  "availability": "Public",
  "supportsSubdomain": false,
  "supportsPath": false,
  "official": false,
  "failedAt": null,
  "uses": 0
}
```

## Get a single domain by ID

`GET /domains/:domainId`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `domainId` | `any` | required | The domain's id. |

### Response

Returns a [Domain](https://hematite.gg/docs/developers/models/domain).

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

Example `data`:

```json
{
  "id": 1,
  "name": "yourdomain.com",
  "userId": 1,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "cloudflareZoneId": "string",
  "status": "AwaitingNameservers",
  "availability": "Public",
  "supportsSubdomain": false,
  "supportsPath": false,
  "official": false,
  "failedAt": null,
  "uses": 0
}
```

## Edit a domain

`PATCH /domains/:domainId`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `domainId` | `any` | required | The domain's id. |

### Body

Send at least one field.

| Field | Type | Required | Notes |
|---|---|---|---|
| `availability` | `enum` |  | One of `Public`, `Premium`, `Private`. |
| `supportsSubdomain` | `boolean` |  |  |
| `supportsPath` | `boolean` |  |  |

### Response

Returns a [Domain](https://hematite.gg/docs/developers/models/domain).

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

Example `data`:

```json
{
  "id": 1,
  "name": "yourdomain.com",
  "userId": 1,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "cloudflareZoneId": "string",
  "status": "AwaitingNameservers",
  "availability": "Public",
  "supportsSubdomain": false,
  "supportsPath": false,
  "official": false,
  "failedAt": null,
  "uses": 0
}
```

## Delete a domain

`DELETE /domains/:domainId`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `domainId` | `any` | required | The domain's id. |

### Response

`data` is empty.

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

## Ask Cloudflare to look at your domain's nameservers again now, after you changed them at your registrar, instead of waiting for its own next look. Only while the domain waits for its nameservers. Cloudflare takes this once an hour for a zone on its free plan; hematite's own check, every minute, then sets the domain up as soon as Cloudflare has seen them.

`POST /domains/:domainId/activation-check`

Needs a session token. Rate limit: 5 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `domainId` | `any` | required | The domain's id. |

### Response

`data` is empty.

Error `403`: Only its owner can ask.

Error `404`: There's no domain with this id.

Error `409`.

Error `422`: Cloudflare didn't take the request.

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

## Get the DNS records of your domain's Cloudflare zone, and what setting it up does to each: hematite replaces only an A, AAAA or CNAME on the domain itself and on its wildcard with its own two records, and every other record stays. These are what the domain answers with once its nameservers point at Cloudflare. Only its owner can ask.

`GET /domains/:domainId/dns`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `domainId` | `any` | required | The domain's id. |

### Response

Returns an `object` with these fields:

| Field | Type | Present | Notes |
|---|---|---|---|
| `records` | `object[]` |  | The zone's records now: the apex first, then by name and type. |
| `records.type` | `string` |  | The record's type: `A`, `AAAA`, `CNAME`, `MX`, `TXT` and so on. |
| `records.name` | `string` |  | Its complete name, the domain itself for the apex. |
| `records.content` | `string` |  | What it answers with. |
| `records.proxied` | `boolean` |  | Whether Cloudflare answers for it and passes requests on. |
| `records.priority` | `number \| null` |  | An MX record's priority, or null. |
| `records.change` | `enum` |  | `keep`: it stays. `replace`: setting the domain up removes it for hematite's own. `hematite`: one of hematite's two. One of `keep`, `replace`, `hematite`. |
| `add` | `object[]` |  | Hematite's records still to be added: both until the domain is set up, none after. |
| `add.type` | `string` |  | The record's type: `A`, `AAAA`, `CNAME`, `MX`, `TXT` and so on. |
| `add.name` | `string` |  | Its complete name, the domain itself for the apex. |
| `add.content` | `string` |  | What it answers with. |
| `add.proxied` | `boolean` |  | Whether Cloudflare answers for it and passes requests on. |

Error `403`: Only its owner can ask.

Error `404`: There's no domain with this id.

Error `409`: Domain does not have a Cloudflare zone ID.

Error `422`: Couldn't read the zone's records from Cloudflare.

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

Example `data`:

```json
{
  "records": [
    {
      "type": "string",
      "name": "Ranked",
      "content": "That last round",
      "proxied": false,
      "priority": 0,
      "change": "keep"
    }
  ],
  "add": [
    {
      "type": "string",
      "name": "Ranked",
      "content": "That last round",
      "proxied": false
    }
  ]
}
```

## Get the nameservers your domain should have, Cloudflare's two for its zone (`add`), and the ones Cloudflare found at your registrar when the zone was made (`remove`, null when it found none). Only its owner can ask. While the domain waits for its nameservers they're what to change; later, what to check when it stops answering.

`GET /domains/:domainId/nameservers`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `domainId` | `any` | required | The domain's id. |

### Response

Returns an `object` with these fields:

| Field | Type | Present | Notes |
|---|---|---|---|
| `add` | `string[]` |  |  |
| `remove` | `string[] \| null` |  |  |

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

Example `data`:

```json
{
  "add": [
    "string"
  ],
  "remove": [
    "string"
  ]
}
```

## Get a domain's stats

`GET /domains/:domainId/stats`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `domainId` | `any` | required | The domain's id. |

### Response

Returns an `any`.

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

Example `data`:

```json
null
```

## Get users that use this domain

`GET /domains/:domainId/users`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `domainId` | `any` | required | The domain's id. |

### Response

Returns a list, each item an `object` with these fields:

| Field | Type | Present | Notes |
|---|---|---|---|
| `id` | `integer` |  |  |
| `username` | `string` |  |  |
| `avatar` | `object \| null` | optional | The user's avatar, or null without one. Left out of a user who hides their page, unless it's you: anyone else gets only their id and username. |
| `avatar.key` | `string` |  |  |
| `domainId` | `integer` |  | This domain's id: the domain the user's share links use. |

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

Example `data`:

```json
[
  {
    "id": 1,
    "username": "nova",
    "avatar": {
      "key": "images/a1b2c3d4e5f6.png"
    },
    "domainId": 1
  }
]
```

## Get all discoverable domains

`GET /domains/discovery`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: domains change DNS records at Cloudflare; hematite's website manages them.

### Response

Returns a list of [Domains](https://hematite.gg/docs/developers/models/domain).

```bash
curl 'https://api.hematite.gg/v1/domains/discovery' \
  -H "Authorization: $HEMATITE_TOKEN"
```

Example `data`:

```json
[
  {
    "id": 1,
    "name": "yourdomain.com",
    "userId": 1,
    "createdAt": "2026-11-10T18:24:00.000Z",
    "updatedAt": "2026-11-10T18:24:00.000Z",
    "cloudflareZoneId": "string",
    "status": "AwaitingNameservers",
    "availability": "Public",
    "supportsSubdomain": false,
    "supportsPath": false,
    "official": false,
    "failedAt": null,
    "uses": 0
  }
]
```
