---
title: "Upload media by URL"
method: POST
path: "/upload_media_by_url"
tags: ["Media Upload"]
---

# Upload media by URL

`POST /upload_media_by_url`

## Request

- Base URL: `https://socialbu.com/api/v1`
- URL: `https://socialbu.com/api/v1/upload_media_by_url`
- Auth: HTTP bearer

Upload a media file by providing an HTTP(S) URL or a base64 data URL. The server downloads HTTP(S) URLs and stores data URLs directly, returning an `upload_token` in a single step.

This is simpler than the three-step signed URL flow — no separate upload or status check is needed. The `upload_token` returned can be used in `existing_attachments` when creating a post, the same as the token from the three-step flow.

Supported file types: jpg, jpeg, png, gif, webp, mp4, mov, avi, webm, mkv, pdf. The maximum decoded file size is about 56 MiB. Base64 data URL payloads are limited to 75 MiB.

## Request body

- object
  - `url` string, required: HTTP(S) URL to download or a base64 data URL. Base64 payloads are limited to 75 MiB.
  - `name` string: Custom filename for the stored file. If not provided, the filename is extracted from the URL.

## Response `200`

File uploaded successfully.

- object
  - `success` boolean: Indicates whether the file was uploaded successfully.
  - `message` string: A message confirming the media upload.
  - `name` string: File name e.g, ("document.pdf", "image.png")
  - `mime_type` string: File MIME type e.g, ("image/jpeg", "video/mp4")
  - `size` integer: File size in bytes.
  - `key` string: A unique storage key for the uploaded file.
  - `upload_token` string: Pass this token value in existing_attachments when creating a post.
  - `url` string: Preview URL of the uploaded file.

## Other responses

- `400`: Bad Request. Possible reasons — file too large (about 56 MiB decoded, or 75 MiB base64 payload), unsupported file type, empty file, invalid data URL, download failed, URL not found, or access denied.
- `422`: The given data was invalid. The `url` field is missing or malformed.
- `500`: Internal server error.

---

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