---
title: "Upload or import"
description: "Upload a local file or import a remote URL into Dravo media storage."
section: "API reference"
url: https://dravo.dev/docs/api/media/create
---
# Upload or import

Three ways to send media, all returning the same asset:

- **multipart/form-data** with a `file` field (local upload).
- **JSON** with `source_url` (import a remote file).
- **JSON** with `file_base64` + `content_type` (Base64 upload).

The returned `public_url` is what you pass in `media_urls` when creating a post.
Hosting is temporary: assets are deleted 60 days after upload (`expires_at`), so
publish before then — see [media handling](/docs/concepts/media#retention).

#### `POST /v1/media`

Upload a file or import a remote image/video URL into Dravo media storage.

**Auth:** API key (`dra_…`) or dashboard JWT

| Field | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `source_url` | body | string (URL) | no | Remote image or video to fetch when sending JSON. Provide exactly one of source_url or file_base64. |
| `file_base64` | body | string (Base64) | no | Base64-encoded file when sending JSON (data: URI prefix allowed). Requires content_type. |
| `content_type` | body | string | no | MIME type of file_base64, e.g. image/png. Required with file_base64. |
| `filename` | body | string | no | Optional original filename for a Base64 upload. |
| `file` | body | binary | no | Image or video file when sending multipart/form-data. |

Request:

```json
{
  "source_url": "https://example.com/promo.jpg"
}
```

Response `201`: Media stored.

```json
{
  "id": "media_8f2c1d",
  "public_url": "https://cdn.dravo.dev/u/abc/2f1c....jpg",
  "kind": "image",
  "content_type": "image/jpeg",
  "size_bytes": 84211,
  "status": "ready",
  "created_at": "2026-06-27T10:00:00Z",
  "expires_at": "2026-08-26T10:00:00Z"
}
```

Errors:

- `400`: Could not fetch source_url.
- `413`: File exceeds the upload/import limit.
- `415`: Unsupported media type.
- `502`: Upload to storage failed.
