# Upload a file (image, video, or digital file)

> Eto API reference for `POST /api/v1/uploads`. Base URL `https://eto.tools/api/v1/`. Authenticate with the `X-Eto-API-Key` header.

Part of the [Eto API reference](https://eto.tools/dev/docs/). The full reference in one file is at [llms-full.txt](https://eto.tools/dev/docs/llms-full.txt); the machine-readable schema is at [openapi.json](https://eto.tools/dev/docs/openapi.json).

## POST /api/v1/uploads

Upload a file (image, video, or digital file)

- Operation ID: `file_upload`
- Slug: `file-upload`
- Category: Listing Builder
- Authentication: API key only. Reads or writes data Eto holds for your own account.
- HTML: https://eto.tools/dev/docs/#ep-file-upload
- Markdown: https://eto.tools/dev/docs/listing-builder/file-upload.md

Upload a local file to ETO for use in listing creation. Returns an eto-upload:// URL that you can use in images[].url, digital_files[].url, or videos[].url when calling POST /api/v1/listings/create. This is the way to use local files instead of remote URLs.

Send as multipart/form-data with a "file" field and optional "type" field.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | `file` | yes | The file to upload. Send as multipart/form-data. Constraints: max 100MB. |
| `type` | body | `string` | no | The type of file being uploaded. Default: `image`. One of: `image`, `video`, `digital`. |

### Request

```bash
curl -X POST -H "X-Eto-API-Key: eto_your_key" \
  -F "file=@my_product_photo.jpg" \
  -F "type=image" \
  "https://eto.tools/api/v1/uploads"
```

```python
import requests

url = "https://eto.tools/api/v1/uploads"
headers = {"X-Eto-API-Key": "eto_your_key"}
files = {"file": open("my_product_photo.jpg", "rb")}
data = {"type": "image"}

response = requests.post(url, headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
```

```javascript
const url = "https://eto.tools/api/v1/uploads";
const form = new FormData();
form.append("file", fileInput.files[0]);
form.append("type", "image");

const response = await fetch(url, {
  method: "POST",
  body: form,
  headers: {
    "X-Eto-API-Key": "eto_your_key",
  },
});
if (!response.ok) throw new Error(`Eto API ${response.status}`);
const data = await response.json();
```

### Response

```json
{
  "url": "eto-upload:///path/to/uploaded/file.jpg",
  "filename": "my_product_photo.jpg",
  "size": 102400,
  "content_type": "image/jpeg",
  "type": "image",
  "note": "Use this url value in images[].url when calling POST /api/v1/listings/create."
}
```

### Errors

Failures answer with the shared error body described in the Errors section: `{"error": {"code", "status", "message", "hint", "docs"}}`. Branch on `code`, not on the message.
