# Shares API

The Shares API: find a share by its code, read and edit share links, with every endpoint's fields, who may call it, its rate limit and a curl example.

## Get a single share by ID

`GET /shares/:shareId`

Needs a session token. Rate limit: 120 a minute, per address. An app's token or an API key needs the `shares:read` scope.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `shareId` | `any` | required | The share's id. |

### Response

Returns a [Share](https://hematite.gg/docs/developers/models/share).

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

Example `data`:

```json
{
  "id": 1,
  "code": "x7Kp2QmA",
  "referenceType": "Image",
  "referenceId": 1,
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "reference": {
    "id": 1,
    "userId": 1,
    "createdAt": "2026-11-10T18:24:00.000Z",
    "updatedAt": "2026-11-10T18:24:00.000Z",
    "title": "Clutch on Ascent",
    "description": "1v4 on the last round",
    "visibility": "Unlisted",
    "folderId": 1,
    "views": 0,
    "downloads": 0,
    "favorite": false,
    "application": "VALORANT",
    "filename": "a1b2c3d4e5f6.png",
    "size": 2457600,
    "width": 1920,
    "height": 1080,
    "nsfw": false,
    "storageId": 1,
    "autoDeleteAt": null,
    "hideUser": false,
    "shield": false,
    "nsfwLockedAt": "2026-11-10T18:24:00.000Z",
    "privateLockedAt": "2026-11-10T18:24:00.000Z",
    "offlineAt": "2026-11-10T18:24:00.000Z",
    "storage": {
      "key": "images/a1b2c3d4e5f6.png"
    },
    "shareId": 1,
    "shareCode": "x7Kp2QmA",
    "likeCount": 0,
    "commentCount": 0,
    "meta": {
      "id": 1,
      "blurHash": "string",
      "dominantColor": "string",
      "palette": null,
      "hasAlpha": false,
      "animated": false,
      "orientation": 0
    },
    "treatment": "string",
    "burn": {
      "secondsPerView": 0,
      "viewsEach": 0,
      "viewsInAll": 0,
      "then": "Blur",
      "viewsUsed": 0,
      "burnedAt": "string"
    }
  }
}
```

## Edit a share

`PATCH /shares/:shareId`

Needs a session token. Rate limit: 120 a minute, per address. An app's token or an API key needs the `shares:write` scope.

### Path parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `shareId` | `any` | required | The share's id. |

### Body

| Field | Type | Required | Notes |
|---|---|---|---|
| `code` | `string` | required | The new share code: 4 to 64 characters, letters, digits, `-` and `_`, or the emoji style's emoji alone (an emoji is one character). Not one hematite keeps (its own pages and files, hosts, staff, payment and sign-in words, brands, offensive words: `SHARE_CODE_KEPT`), nor one another share has in any case (`Nova` is taken while `nova` exists) or had in the last year (`SHARE_CODE_TAKEN`); this share's own in another case is fine. Only this exact code opens it, and the old one is kept from everyone for a year. Ten changes an hour. 4 to 128 characters. |

### Response

Returns a [Share](https://hematite.gg/docs/developers/models/share).

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

Example `data`:

```json
{
  "id": 1,
  "code": "x7Kp2QmA",
  "referenceType": "Image",
  "referenceId": 1,
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "reference": {
    "id": 1,
    "userId": 1,
    "createdAt": "2026-11-10T18:24:00.000Z",
    "updatedAt": "2026-11-10T18:24:00.000Z",
    "title": "Clutch on Ascent",
    "description": "1v4 on the last round",
    "visibility": "Unlisted",
    "folderId": 1,
    "views": 0,
    "downloads": 0,
    "favorite": false,
    "application": "VALORANT",
    "filename": "a1b2c3d4e5f6.png",
    "size": 2457600,
    "width": 1920,
    "height": 1080,
    "nsfw": false,
    "storageId": 1,
    "autoDeleteAt": null,
    "hideUser": false,
    "shield": false,
    "nsfwLockedAt": "2026-11-10T18:24:00.000Z",
    "privateLockedAt": "2026-11-10T18:24:00.000Z",
    "offlineAt": "2026-11-10T18:24:00.000Z",
    "storage": {
      "key": "images/a1b2c3d4e5f6.png"
    },
    "shareId": 1,
    "shareCode": "x7Kp2QmA",
    "likeCount": 0,
    "commentCount": 0,
    "meta": {
      "id": 1,
      "blurHash": "string",
      "dominantColor": "string",
      "palette": null,
      "hasAlpha": false,
      "animated": false,
      "orientation": 0
    },
    "treatment": "string",
    "burn": {
      "secondsPerView": 0,
      "viewsEach": 0,
      "viewsInAll": 0,
      "then": "Blur",
      "viewsUsed": 0,
      "burnedAt": "string"
    }
  }
}
```

## Get a share by code

`GET /shares/by-code`

Needs no token. Rate limit: 120 a minute, per address. An app's token or an API key needs the `shares:read` scope.

### Query

| Field | Type | Required | Notes |
|---|---|---|---|
| `code` | `string` | required | The share code. At least 1 characters. |

### Response

Returns an `object` with these fields:

| Field | Type | Present | Notes |
|---|---|---|---|
| `id` | `integer` |  |  |
| `code` | `string` |  |  |
| `referenceType` | `enum` |  | One of `User`, `Image`, `File`, `Paste`, `Short`, `Bio`, `Folder`, `Comment`. |
| `referenceId` | `integer` |  |  |
| `updatedAt` | `date-time` |  |  |
| `reference` | object or [`Folder`](https://hematite.gg/docs/developers/models/folder) |  |  |
| `reference.id` | `integer` |  |  |
| `reference.userId` | `number \| null` |  | Who uploaded it; null when it hides its uploader (`hideUser`) and you aren't them. Its `folderId` is null then too: a folder names its owner. |
| `reference.createdAt` | `date-time` |  |  |
| `reference.updatedAt` | `date-time` |  |  |
| `reference.title` | `string` |  |  |
| `reference.description` | `string` |  |  |
| `reference.visibility` | `enum` |  | One of `Unlisted`, `Public`, `Private`. |
| `reference.folderId` | `integer \| null` |  |  |
| `reference.views` | `integer` |  |  |
| `reference.downloads` | `integer` |  |  |
| `reference.favorite` | `boolean` |  |  |
| `reference.application` | `string \| null` |  |  |
| `reference.filename` | `string` |  |  |
| `reference.size` | `number` |  |  |
| `reference.width` | `integer` |  |  |
| `reference.height` | `integer` |  |  |
| `reference.nsfw` | `boolean` |  |  |
| `reference.storageId` | `integer` |  |  |
| `reference.autoDeleteAt` | `date-time \| null` |  |  |
| `reference.hideUser` | `boolean` |  |  |
| `reference.shield` | `boolean` |  |  |
| `reference.nsfwLockedAt` | `date-time \| null` |  |  |
| `reference.privateLockedAt` | `date-time \| null` |  |  |
| `reference.offlineAt` | `date-time \| null` |  |  |
| `reference.storage` | `object` |  |  |
| `reference.storage.key` | `string` |  |  |
| `reference.shareId` | `number` |  |  |
| `reference.shareCode` | `string` |  |  |
| `reference.likeCount` | `number` |  |  |
| `reference.commentCount` | `number` |  |  |
| `reference.meta` | `object \| null` | optional |  |
| `reference.meta.id` | `number` |  |  |
| `reference.meta.blurHash` | `string \| null` |  |  |
| `reference.meta.dominantColor` | `string \| null` |  | The colour the picture has most of: `#` and six hex digits, lowercase. Null until it's worked out, just after the upload, or when it can't be. |
| `reference.meta.palette` | `any \| null` |  |  |
| `reference.meta.hasAlpha` | `boolean \| null` |  |  |
| `reference.meta.animated` | `boolean \| null` |  |  |
| `reference.meta.orientation` | `number \| null` |  |  |
| `reference.treatment` | `string \| null` |  | How the picture is served where others see it: its owner's watermark, as a token for the cdn's `t` parameter (`image.url()` in the sdk adds it). Null when nothing is drawn on it. Without it the cdn serves the picture as it's stored. |
| `reference.burn` | `object \| null` |  | Burn's limits, on a shielded image (`shield`); null without them. |
| `reference.burn.secondsPerView` | `number \| null` |  | The seconds each view shows the picture; null for no limit. |
| `reference.burn.viewsEach` | `number \| null` |  | The views each person gets (signed in by account, a guest by browser); null for no limit. |
| `reference.burn.viewsInAll` | `number \| null` |  | The views it has in all, by anyone but its owner; null for no limit. |
| `reference.burn.then` | `enum` |  | What happens once the views in all are used: Blur (burned for everyone but its owner), Private, or Delete (gone for everyone but its owner). One of `Blur`, `Private`, `Delete`. |
| `reference.burn.viewsUsed` | `number` | optional | The views in all used so far. Only its owner gets it. |
| `reference.burn.burnedAt` | `string \| null` | optional | When its last view in all was given; null until then. Only its owner gets it. |

```bash
curl 'https://api.hematite.gg/v1/shares/by-code?code=x7Kp2QmA'
```

Example `data`:

```json
{
  "id": 1,
  "code": "x7Kp2QmA",
  "referenceType": "Image",
  "referenceId": 1,
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "reference": {
    "id": 1,
    "userId": 1,
    "createdAt": "2026-11-10T18:24:00.000Z",
    "updatedAt": "2026-11-10T18:24:00.000Z",
    "title": "Clutch on Ascent",
    "description": "1v4 on the last round",
    "visibility": "Unlisted",
    "folderId": 1,
    "views": 0,
    "downloads": 0,
    "favorite": false,
    "application": "VALORANT",
    "filename": "a1b2c3d4e5f6.png",
    "size": 2457600,
    "width": 1920,
    "height": 1080,
    "nsfw": false,
    "storageId": 1,
    "autoDeleteAt": "2026-11-10T18:24:00.000Z",
    "hideUser": false,
    "shield": false,
    "nsfwLockedAt": "2026-11-10T18:24:00.000Z",
    "privateLockedAt": "2026-11-10T18:24:00.000Z",
    "offlineAt": "2026-11-10T18:24:00.000Z",
    "storage": {
      "key": "images/a1b2c3d4e5f6.png"
    },
    "shareId": 1,
    "shareCode": "x7Kp2QmA",
    "likeCount": 0,
    "commentCount": 0,
    "meta": {
      "id": 1,
      "blurHash": "string",
      "dominantColor": "string",
      "palette": null,
      "hasAlpha": false,
      "animated": false,
      "orientation": 0
    },
    "treatment": "string",
    "burn": {
      "secondsPerView": 0,
      "viewsEach": 0,
      "viewsInAll": 0,
      "then": "Blur",
      "viewsUsed": 0,
      "burnedAt": "string"
    }
  }
}
```

## Get what a share's link shows where it's pasted (Discord, X, Slack and the rest): its card, as hematite serves it in the share page's tags and its oEmbed answer. The same for everyone, its owner included, as for someone signed out who holds the link: an image marked NSFW or shielded shows no picture, an image that hides its uploader names nobody, and a folder shows up to four of the pictures its cover may show.

`GET /shares/by-code/embed`

Needs no token. Rate limit: 120 a minute, per address. An app's token or an API key needs the `shares:read` scope.

### Query

| Field | Type | Required | Notes |
|---|---|---|---|
| `code` | `string` | required | The share code. At least 1 characters. |

### Response

Returns an [Embed](https://hematite.gg/docs/developers/models/embed).

Error `403`.

Error `404`: There's no share with this code.

```bash
curl 'https://api.hematite.gg/v1/shares/by-code/embed?code=x7Kp2QmA'
```

Example `data`:

```json
{
  "title": "Clutch on Ascent",
  "description": "1v4 on the last round",
  "site": {
    "name": "Ranked",
    "url": "https://cdn.hematite.gg/images/a1b2c3d4e5f6.png"
  },
  "author": {
    "name": "Ranked",
    "url": "https://cdn.hematite.gg/images/a1b2c3d4e5f6.png"
  },
  "color": "#c4d4e0",
  "layout": "large",
  "pictures": [
    {
      "url": "https://cdn.hematite.gg/images/a1b2c3d4e5f6.png",
      "width": 1920,
      "height": 1080,
      "alt": "string",
      "type": "image/jpeg",
      "animated": false
    }
  ],
  "publishedAt": "string",
  "indexable": false
}
```
