# Upload images

> Hosts your own images so they can be referenced as `inputs` by an edit, review or rating task. Send them as multipart form fields named `images`. The whole body is capped at 100 MB.

The one endpoint that is not JSON. Send `multipart/form-data` with the files
under a repeated `images` field: up to 10 JPEG, PNG, or WEBP files, each 1 KB
to 10 MB, and at most 100 MB in total. Uploading is free, and the returned
URLs are served for 1 day.

Put the URLs in `inputs` on generate. If your images already have public URLs,
skip this and pass those. [Image to image](https://mynth.io/docs/guides/image-to-image.md) shows
both.

`POST /image/upload`

**Auth:** API key or OAuth token

## Request body

Sent as `multipart/form-data`.

- `images` (required, string[]) — The image files to host. Repeat the field for several.

## Response

### 200 — Images uploaded

- `data` (required, object)
  - `urls` (required, string[])

```json
{
  "data": {
    "urls": [
      "string"
    ]
  }
}
```

## Request samples

### cURL

```bash
curl -X POST https://api.mynth.io/image/upload \
  -H "Authorization: Bearer $MYNTH_API_KEY" \
  -F "images=@./photo.png"
```

### JavaScript

```ts
const response = await fetch("https://api.mynth.io/image/upload", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MYNTH_API_KEY}`,
  },
});

const { data } = await response.json();
```

The full schema for this endpoint is in the [OpenAPI document](https://api.mynth.io/openapi.json).
