---
title: "Upload media from URL"
method: POST
path: "/media/from-url"
tags: ["Media"]
---

# Upload media from URL

`POST /media/from-url`

## Request

- Base URL: `https://api.postplanify.com/api/v1`
- URL: `https://api.postplanify.com/api/v1/media/from-url`
- Auth: HTTP bearer

Download a file from a public URL and store it, the same as an upload. Use the returned `id` in `mediaIds` when creating posts.

**Allowed types:** JPEG, PNG, GIF, WebP, MP4, MOV, PDF

**Max file size:** 100 MB

## Request body

- object
  - `url` string, uri, required: Public http(s) URL of the file. Redirects are followed.
  - `filename` string: Optional file name. Defaults to the name in the URL.

## Response `201`

File uploaded successfully

- object
  - `ok` boolean
  - `data` MediaUpload
    - `id` string, uuid
    - `name` string: Original filename
    - `url` string: Public URL of the uploaded file
    - `type` string: MIME type
    - `size` number: File size in bytes
    - `createdAt` string, date-time
    - `source` 'upload' | 'library': Where the media lives: `upload` (added via the API) or `library` (the workspace's dashboard media library). Present on `GET /media` results.

## Other responses

- `400`: Missing or invalid URL, download failed, or file type not allowed
- `413`: File larger than 100 MB

---

[API](https://skmtc.dev/postplanify/apis/postplanify-api.md) · [All operations](https://skmtc.dev/postplanify/apis/postplanify-api/llms.txt) · [OpenAPI document](https://skmtc.dev/postplanify/apis/postplanify-api/revisions/9eae5f1faa56?raw)
