---
title: "Upload a file to the media library"
type: reference
method: POST
path: /rest-api/media-library/assets/upload.do
tag: "Media Library"
---

# Upload a file to the media library

`POST https://YOUR-NETWORK-DOMAIN/rest-api/media-library/assets/upload.do`

Stores a video, an image (JPG, PNG, GIF, WebP or SVG) or an HTML5 banner ZIP once, so any number of creatives can use it: a Local Video or Advanced Local Video(s) creative takes a video, a Local File creative an image, and a template creative's HTML5 ZIP property a ZIP — pass the file's id as 'mediaAssetId' when creating or updating the creative. The type is read from the file's content, not its name. Videos follow the network's video size limit and images its image limit; a ZIP follows the HTML5 archive limits. Videos are read with ffprobe, and a file that cannot be read is refused. When an identical file (same MD5) is already in the library and visible to the user, nothing is stored again: that file is returned with 'duplicate' true. 'advertiserId' labels the file for filtering; a user with shared advertisers must send one of theirs. Requires the MEDIA_LIBRARY permission and update rights on campaigns (on that advertiser when one is sent).

## Query params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `advertiserId` | integer | no | `1001` | Advertiser the file is for; a filter label |
| `name` | string | no | `Spring sale 30s` | Display name; the file name when empty |

## Body

A multipart form: `file` (file).

## Responses

- `200` — {success, duplicate, asset:{...}}
- `400` — Field errors under 'errors': 'file' missing, unsupported, unreadable or too large; 'advertiserId' required
- `401` — Authentication error
- `403` — The role lacks MEDIA_LIBRARY or campaign update rights, or no rights on the advertiser
- `404` — The advertiser does not exist or is deleted

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/media-library/assets/upload.do?advertiserId=1001&name=Spring%20sale%2030s' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --form 'file=@video.mp4'
```

Source: https://epom.com/ad-server/docs/api/media-library/post-media-library-assets-upload