# Utilities & Others API

The Utilities & Others API: ping the API to check it answers, with every endpoint's fields, who may call it, its rate limit and a curl example.

## Ping the server

`GET /ping`

Needs no token. Rate limit: 120 a minute, per address. Any app's token may call it.

### Query

| Field | Type | Required | Notes |
|---|---|---|---|
| `delay` | `number` |  | The delay in milliseconds to wait before returning the response. At most 10000. More than 0. |

### Response

Returns a `"pong"`.

```bash
curl 'https://api.hematite.gg/v1/ping'
```

Example `data`:

```json
"pong"
```

## Report something on hematite (docs/concepts/14-reports-and-moderation.md §2, §3; Art. 16 DSA): an image, a folder or a profile (or one of its parts), found from the address it was made from: a share page on any domain, a file on the cdn, a profile. Signed in or out: signed out, a `name` and an `email` for every reason but child sexual abuse material and a threat to someone's life. One report a person and thing: a second answers with the first (`duplicate: true`) and adds nothing. A receipt goes to the reporter's address at once (at most three a day to one address). A report hides nothing by itself: a person at hematite looks at it. Signed in, 10 an hour and 30 a day; signed out, 5 an hour from one address. Never an app's: a report is a person's, made on hematite.

`POST /reports`

Needs no token. Rate limit: 30 an hour, per address. Not open to apps or API keys: a report is a person's, made on hematite.

### Body

| Field | Type | Required | Notes |
|---|---|---|---|
| `location` | `string` | required | The address it's reported from: a share page (on any domain), a file on the cdn, a profile. 1 to 512 characters. |
| `part` | `enum \| null` |  | A profile's part, when only that's wrong. One of `name`, `picture`, `bio`. |
| `category` | `enum` | required | One of `Illegal`, `Pornography`, `Harassment`, `Spam`, `Impersonation`, `MisleadingPreview`, `ShouldBeNsfw`, `SomethingElse`. |
| `legalKind` | `enum \| null` |  | For `Illegal`: which kind. One of `ChildSexualAbuse`, `ThreatToLife`, `Terrorism`, `Hate`, `Privacy`, `Fraud`, `Copyright`, `OtherIllegal`. |
| `explanation` | `string` |  | What's wrong, in the reporter's words: required for illegal content but child sexual abuse material, impersonation (who) and something else. At most 2000 characters. |
| `name` | `string \| null` |  |  |
| `email` | `string \| null` |  |  |
| `goodFaith` | `boolean` |  | "I believe what I've said is accurate and complete": required for illegal content but child sexual abuse material. |

### Response

Returns an `object` with these fields:

| Field | Type | Present | Notes |
|---|---|---|---|
| `id` | `integer` |  | The report's number, `R-<id>`. |
| `duplicate` | `boolean` |  | You'd reported it already: this is your first report. |

```bash
curl -X POST 'https://api.hematite.gg/v1/reports' \
  -H "Content-Type: application/json" \
  -d '{"location":"string","category":"Illegal"}'
```

Example `data`:

```json
{
  "id": 1,
  "duplicate": false
}
```

## What a hematite address is, for `/report` (docs/concepts/14-reports-and-moderation.md §2): a share page on any domain, a file on the cdn, a profile. Only what the address shows to whoever asks: a private image's share, a held image or anything gone answers `found: false`; an uploader the image hides, or only a file's link, names nobody. Never a title or a picture.

`GET /reports/resolve`

Needs no token. Rate limit: 60 a minute, per address. Not open to apps or API keys: a report is a person's, made on hematite.

### Query

| Field | Type | Required | Notes |
|---|---|---|---|
| `url` | `string` | required | The address, as it was copied. 1 to 512 characters. |

### Response

Returns an `any`.

```bash
curl 'https://api.hematite.gg/v1/reports/resolve?url=https%3A%2F%2Fcdn.hematite.gg%2Fimages%2Fa1b2c3d4e5f6.png'
```

Example `data`:

```json
null
```
