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

# Add a file to the media library by link

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

Downloads a public http(s) link and stores the file as the upload operation does, with the same type, size and duplicate rules. Private and internal addresses are refused, and a download stops at 100 MB or the network's limit, whichever is lower. The file name is the last part of the link's path. Requires the MEDIA_LIBRARY permission and update rights on campaigns (on that advertiser when one is sent).

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `url` | string | yes | `https://cdn.example.com/spring_sale_30.mp4` | Public http(s) link to the file |
| `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 |

## Responses

- `200` — {success, duplicate, asset:{...}}
- `400` — Field errors under 'errors': 'url' missing, unreachable or refused; 'file' unsupported, unreadable or too large
- `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-from-url.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'url=https://cdn.example.com/spring_sale_30.mp4' \
  --data-urlencode 'advertiserId=1001' \
  --data-urlencode 'name=Spring sale 30s'
```

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