> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yumi.onl/llms.txt
> Use this file to discover all available pages before exploring further.

# API

> Authenticate with a Yumi API key and upload, list, retrieve, and delete files.

The Yumi API lets you manage hosted media from your own application. Requests use JSON unless you are sending file bytes to the temporary upload URL.

> [!NOTE]
>
> Create an API key from [Dashboard → API Keys](https://yumi.onl/dashboard/api-keys). Yumi shows the full key only once. Store it securely and send it as a bearer token.

## Base URL

```text theme={null}
https://yumi.onl/api/v1
```

## Authentication

Send your key in the `Authorization` header for every API request:

```http theme={null}
Authorization: Bearer yumi_your_api_key
```

Keep API keys on a trusted server. Do not expose them in browser code or public repositories. If a key is exposed, revoke it from the API Keys page and create another.

## Endpoints

### Check API health

`GET /health` checks that your API key is valid and the API is responding.

```bash theme={null}
curl https://yumi.onl/api/v1/health \
  -H "Authorization: Bearer $YUMI_API_KEY"
```

### List files

`GET /files` returns files in your account, newest first. Use `limit` to choose a page size from 1 to 100 (default: 25). When `nextCursor` is non-null, pass it back as `cursor` to fetch the next page.

```bash theme={null}
curl "https://yumi.onl/api/v1/files?limit=25" \
  -H "Authorization: Bearer $YUMI_API_KEY"
```

Each file includes its `id`, `originalName`, `mime`, `sizeBytes`, `status`, `visibility`, `url`, `rawUrl`, and `createdAt`.

### Upload a file

Uploads use a temporary direct-upload URL. First request the URL:

```bash theme={null}
curl -X POST https://yumi.onl/api/v1/files \
  -H "Authorization: Bearer $YUMI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"filename":"image.png","mime":"image/png","sizeBytes":12345}'
```

The JSON body requires:

| Field | Type | Description |
| - | - | - |
| `filename` | string | Name of the file, including its extension. |
| `mime` | string | File MIME type. Yumi accepts `image/*` and `video/*`. |
| `sizeBytes` | number | File size in bytes. The API also accepts `size`. |

The response contains `fileId`, `uploadUrl`, and `expiresIn` (600 seconds). Upload the bytes with a `PUT` request to `uploadUrl`, then finalize the upload:

```bash theme={null}
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/png" \
  --data-binary @image.png

curl -X POST "https://yumi.onl/api/v1/files/$FILE_ID/complete" \
  -H "Authorization: Bearer $YUMI_API_KEY"
```

The completion response includes the file details and its share URL.

### Get a file

`GET /files/{id}` returns one file belonging to your account.

```bash theme={null}
curl "https://yumi.onl/api/v1/files/$FILE_ID" \
  -H "Authorization: Bearer $YUMI_API_KEY"
```

### Delete a file

`DELETE /files/{id}` deletes one of your files.

```bash theme={null}
curl -X DELETE "https://yumi.onl/api/v1/files/$FILE_ID" \
  -H "Authorization: Bearer $YUMI_API_KEY"
```

## Rate limits

Rate limits are applied per API key in a one-minute window. The API includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` response headers on supported endpoints.

| Plan | Requests per minute |
| - | -: |
| Free | 60 |
| Premium | 180 |
| Pro | 600 |

## Errors

Errors use a JSON response with `ok: false` and an `error` code. For example:

```json theme={null}
{ "ok": false, "error": "missing_api_key" }
```

| Status | Error | Meaning |
| -: | - | - |
| 400 | `invalid_request` | The request body is missing required values or is invalid. |
| 400 | `unsupported_type` | The MIME type is not an image or video. |
| 400 | `invalid_id` | The file ID is not valid. |
| 401 | `missing_api_key` | The bearer token is missing or does not use the expected key format. |
| 401 | `invalid_api_key` | The key is unknown or its account could not be found. |
| 401 | `revoked_api_key` | The key has been revoked. |
| 401 | `expired_api_key` | The key has expired. |
| 403 | `account_unavailable` | The account is not active. |
| 403 | `file_limit_reached` | The account has reached its file limit. |
| 404 | `not_found` | The file does not exist or is not available to this account. |
| 413 | `file_too_large` | The file exceeds the maximum size for the account's plan. |
| 429 | `rate_limited` | The API key exceeded its per-minute request limit. |
| 500 | `server_misconfig` | Yumi could not process the request because of a server configuration issue. |

If you receive a `500` response, contact [Yumi Support](https://yumi.onl/support).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.