# Integrations

Use the CDN with screenshot-basic, ox_inventory, the NUI and the loading screen, and upload files from any script through the HTTP API.

Source: https://fivedash.fivex.gg/docs/en/cdn/integrations

The CDN is the warehouse for everything the city shows: inventory icons, the loading screen, scripts' NUI and the screenshots the game takes. This page shows the integrations the FiveDash panel already has ready and, for everything else, how to upload files through the HTTP API. It's for whoever sets up the server's scripts.

## Before you start

* **CDN created:** see [CDN](https://fivedash.fivex.gg/docs/en/cdn/overview).
* **To upload from scripts:** an [upload key](https://fivedash.fivex.gg/docs/en/cdn/upload-keys), created with **Settings** (CDN) at **Configure**.
* **To copy links:** **Files** at **View**.

## screenshot-basic (game screenshots)

The panel generates ready screenshot-basic code when you create a key.

### Create the screenshots folder

In **CDN → Files**, create (or use) the `screenshots` folder.

### Create the key

In **CDN → Settings → Upload keys**, click **New key**, pick the `screenshots` folder in **Uploads to** and click **Create key**.

### Copy the code

In the **Key created** window, open the **screenshot-basic (Lua)** tab and click **Copy code**. The code already has the upload address and the key.

### Paste it in the script

Paste the code on the client side of the script that takes the screenshot and restart the script.

The code the panel generates looks like this:

```lua
exports['screenshot-basic']:requestScreenshotUpload('https://cdn.fivex.sh/api/v1/upload', 'file', {
  headers = { ['Authorization'] = 'Bearer fdm_xxxxxxxx' },
  encoding = 'webp'
}, function(data)
  local res = json.decode(data)
  print(res.url) -- cdn.fivex.sh/example-city/screenshots/print-….webp
end)
```

`res.url` is the screenshot's public link, ready to send in a log or a webhook.

> With screenshot-basic the key ships with the client-side script, and players can see it. That's why the key only uploads to its own folder. Use a folder just for screenshots and don't tick **Can also delete** on that key.

## ox_inventory (item icons)

### Upload the icons

Upload the icons to a folder, like `itens`. Each item uses a file with its name, like `item-name.png`.

### Copy the line

In **CDN → Files**, select the folder to see its details. Under **Inventory images**, copy the ready line.

### Paste it in server.cfg

Paste the line into `server.cfg` and restart the server.

The line looks like this:

```bash
setr inventory:imagepath "https://cdn.fivex.sh/example-city/itens"
```

## NUI, loading screen and Discord

To use a file in HTML, CSS, Lua or on Discord, open the file's menu and use **Copy as**:

| Option           | Where to use it                  | What it copies                                                                 |
| ---------------- | -------------------------------- | ------------------------------------------------------------------------------ |
| **Lua**          | `config.lua` and scripts         | `"https://cdn.fivex.sh/example-city/itens/agua.png"`                           |
| **HTML** (image) | The NUI and the loading screen   | `<img src="https://cdn.fivex.sh/…" alt="agua">`                                |
| **HTML** (video) | Loading screen video background  | `<video src="https://cdn.fivex.sh/…" autoplay muted loop playsinline></video>` |
| **HTML** (audio) | Loading screen music             | `<audio src="https://cdn.fivex.sh/…" preload="auto"></audio>`                  |
| **CSS**          | NUI or loading screen background | `background-image: url("https://cdn.fivex.sh/…");`                             |
| **Markdown**     | Discord messages                 | `![agua](https://cdn.fivex.sh/…)`                                              |

> The game, the NUI and the loading screen can always use the files, even with **Only the city uses the files** on in **CDN → Settings → Protection**. For other sites (like the store and the rules website), add the domain under **Allowed sites**.

## Upload from any script (HTTP API)

Phone scripts, cameras, report attachments and any other tool that can make an HTTP request can upload files with an upload key.

### Upload a file

```bash
curl -X POST https://cdn.fivex.sh/api/v1/upload \
  -H "Authorization: Bearer fdm_xxxxxxxx" \
  -F "file=@print.png"
```

| Part                         | Value                                                                                                                                             |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method and address           | `POST https://cdn.fivex.sh/api/v1/upload`                                                                                                         |
| `Authorization`              | `Bearer` followed by the key (`fdm_…`)                                                                                                            |
| Body                         | `multipart/form-data` with **one** file in the `file` field (or `files[]`)                                                                        |
| Size                         | Up to 20 MiB per file                                                                                                                             |
| Formats                      | PNG, JPEG, WebP, GIF, SVG, MP4, WebM, MOV, MP3, OGG, WAV, M4A                                                                                     |
| Folder                       | Always the key's folder. You can't pick another one in the form.                                                                                  |
| `Idempotency-Key` (optional) | 8 to 128 characters (letters, numbers, `_`, `.`, `-`). Repeating the same upload with the same key for up to 24 hours doesn't duplicate the file. |

The file name comes from the uploaded file. If one with the same name is already in the folder, the new one gets a number (`print-1.png`). The CDN's **Images** settings (optimization, max width, metadata) also apply to API uploads.

The response has the public link in `url`:

```json
{
  "ok": true,
  "id": "a1b2c3d4-…",
  "url": "https://cdn.fivex.sh/example-city/screenshots/print.png",
  "file": {
    "id": "a1b2c3d4-…",
    "name": "print.png",
    "kind": "image",
    "mime": "image/webp",
    "size": 482133,
    "width": 1920,
    "height": 1080,
    "uploadedBy": "Chave: Game camera",
    "createdAt": "2026-11-09T14:28:00.000Z"
  }
}
```

### Delete a file

Only with a key that has **Can also delete**, and only files that same key uploaded:

```bash
curl -X DELETE https://cdn.fivex.sh/api/v1/files/a1b2c3d4-… \
  -H "Authorization: Bearer fdm_xxxxxxxx"
```

The response is `{"ok":true}`.

### Errors

Errors come as `{"ok": false, "code": "…", "message": "…"}`, with the message in Portuguese.

| Status | When                                                                                            |
| ------ | ----------------------------------------------------------------------------------------------- |
| `400`  | Invalid form, no file in the `file` field, more than one file, or an invalid `Idempotency-Key`. |
| `401`  | Missing, invalid or revoked key.                                                                |
| `403`  | The key can't delete files.                                                                     |
| `404`  | The key's folder isn't available, or the file to delete doesn't exist (or isn't this key's).    |
| `409`  | Same `Idempotency-Key` with a different file.                                                   |
| `413`  | File larger than allowed.                                                                       |
| `429`  | A plan allowance was reached, or too many attempts.                                             |
| `503`  | The CDN is unavailable. Try again.                                                              |

Full technical details in [CDN API](https://fivedash.fivex.gg/docs/en/developers/cdn-api).

## FAQ

**Can I use ShareX or another screenshot app?**
FiveDash doesn't ship a ready config for them. Any app that can `POST` `multipart/form-data` with the `file` field and the `Authorization: Bearer fdm_…` header works with the API above. The response has the link in `url`.

**Does the uploaded screenshot show in the panel?**
Yes. It lands in the key's folder, with **Uploaded by** "Chave: …", and counts toward storage and allowances.

**Can I send the screenshot's link in a FiveDash log?**
Yes. With the export, use the `image` option with the link. See [FiveM resource](https://fivedash.fivex.gg/docs/en/developers/fivem-resource).

## Next steps

[Upload keys](https://fivedash.fivex.gg/docs/en/cdn/upload-keys)Create and revoke keys.
[CDN API](https://fivedash.fivex.gg/docs/en/developers/cdn-api)Full reference for developers.
[Upload files](https://fivedash.fivex.gg/docs/en/cdn/upload-files)Organize folders and copy links.
[Usage and limits](https://fivedash.fivex.gg/docs/en/cdn/usage-and-limits)Upload and traffic allowances.
