# Downloads API

The Downloads API: get a ShareX config with a new upload token, with every endpoint's fields, who may call it, its rate limit and a curl example.

## Get an ishare configuration (`hematite-ishare.iscu`) for images: the file itself, saved rather than shown. Each one holds a new upload token, working for 90 days, that counts toward the upload token limit.

`GET /downloads/configs/ishare/images`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: an uploader's config, script or key carries a new upload token.

### Response

`data` is empty.

```bash
curl 'https://api.hematite.gg/v1/downloads/configs/ishare/images' \
  -H "Authorization: $HEMATITE_TOKEN"
```

## Get a ShareX configuration for images

`GET /downloads/configs/sharex/images`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: an uploader's config, script or key carries a new upload token.

### Response

`data` is empty.

```bash
curl 'https://api.hematite.gg/v1/downloads/configs/sharex/images' \
  -H "Authorization: $HEMATITE_TOKEN"
```

## Get a new upload token for a phone's uploader, set up by hand: the answer is the only time it's shown. It works for 90 days and counts toward the upload token limit; `url` is where it uploads.

`GET /downloads/keys/:uploader`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: an uploader's config, script or key carries a new upload token.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `uploader` | `enum` | required | One of `shortcut`, `http-shortcuts`. |

### Response

Returns an `object` with these fields:

| Field | Type | Present | Notes |
|---|---|---|---|
| `token` | `string` |  | The upload token, `hmu_…`, shown only now. |
| `note` | `string` |  | The name it's listed under in Settings → Security. |
| `expiresAt` | `string \| null` |  | When it stops working. |
| `url` | `string` |  | Where it uploads: `POST /images` on this api. |

```bash
curl 'https://api.hematite.gg/v1/downloads/keys/shortcut' \
  -H "Authorization: $HEMATITE_TOKEN"
```

Example `data`:

```json
{
  "token": "hms_live_m0plGGtn67kMZy6D_…",
  "note": "ShareX",
  "expiresAt": "string",
  "url": "https://cdn.hematite.gg/images/a1b2c3d4e5f6.png"
}
```

## Get hematite's upload script for a screenshot tool: the file itself, saved rather than shown. It uploads the image it's given and prints its link. Each one holds a new upload token, working for 90 days, that counts toward the upload token limit.

`GET /downloads/scripts/:uploader`

Needs a session token. Rate limit: 120 a minute, per address. Not open to apps or API keys: an uploader's config, script or key carries a new upload token.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `uploader` | `enum` | required | One of `flameshot`, `ksnip`, `greenshot`. |

### Query

| Field | Type | Required | Notes |
|---|---|---|---|
| `shell` | `enum` |  | `sh` for macOS and Linux (`hematite-upload.sh`), `powershell` for Windows (`hematite-upload.ps1`; ksnip's is `hematite-upload.cmd`, which it can start). Left out, the one the tool runs: sh, or PowerShell for Greenshot. One of `sh`, `powershell`. |

### Response

`data` is empty.

```bash
curl 'https://api.hematite.gg/v1/downloads/scripts/flameshot' \
  -H "Authorization: $HEMATITE_TOKEN"
```
