---
title: "Import a public or signed HTTPS media URL"
description: "PubNio API media.import: import a public or signed HTTPS media URL. Request fields, examples in five clients, errors, and idempotency."
---

> Documentation Index
> Fetch the complete documentation index at: https://pubnio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Import a public or signed HTTPS media URL

Import a public or signed HTTPS media URL with [`POST /api/v1/media/import`](https://pubnio.com/api/v1/docs#tag/media/POST/api/v1/media/import). Requires an API key with the `read` scope or a signed-in workspace member.

## Request

The URL must be public HTTPS, at most 8,192 characters, with no `#` fragment. Any other URL fails with `bad-request`. While fetching, PubNio follows up to 3 redirects and checks each target by the same rules.

A new import answers `processing` at once and PubNio fetches the file in the background, storing the source URL encrypted. Poll [`GET /api/v1/media/{mediaId}/status`](https://pubnio.com/api/v1/docs#tag/media/GET/api/v1/media/{mediaId}/status) until `ready` or `failed`. Reusing an `Idempotency-Key` with a different URL fails with `idempotency-conflict`.

| Parameter     | In    | Type | Required |
| ------------- | ----- | ---- | -------- |
| `workspaceId` | query | UUID | Yes      |

| Body field | Type   | Required |
| ---------- | ------ | -------- |
| `url`      | string | Yes      |

## Response

- HTTP 202: `MediaIntake` with `mediaId`, `status`, `asset`, `issue`, `upload`, `idempotencyKey`, `retryAfterSeconds`.
  - `status`: `awaiting_upload`, `processing`, `ready`, `failed`

The [OpenAPI document](https://pubnio.com/api/v1/openapi) has each field's type.

## Examples

### TypeScript

```ts
const intake = await workspace.media.importUrl(
  "https://cdn.example.com/launch.mp4",
);
```

### Python

```python
intake = workspace.media.import_url(url="https://cdn.example.com/launch.mp4")
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/media/import?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://cdn.example.com/launch.mp4"}'
```

### CLI

```sh
pnio media import https://cdn.example.com/launch.mp4
```

### MCP execute

```js
async () => {
  // One key per intent; reuse it only to retry this same request.
  const idempotencyKey = crypto.randomUUID();
  const response = await codemode.request({
    method: "POST",
    path: "/api/v1/media/import",
    query: { workspaceId: codemode.workspaceId },
    headers: { "Idempotency-Key": idempotencyKey },
    body: { url: "https://cdn.example.com/launch.mp4" },
  });
  return response.data;
};
```

## Errors

- [`idempotency-conflict`](https://pubnio.com/docs/problems/idempotency-conflict/): HTTP 409, Idempotency key already used

It also declares the problems [most operations](https://pubnio.com/docs/reference/#shared-problems) declare.

## Idempotency

Required. A retry with the same `Idempotency-Key` returns the first result for 24 hours. Make one key per intent, such as `crypto.randomUUID()` or Python's `uuid4()`, and reuse it only to retry the same request. The TypeScript SDK makes a key for each call unless you pass `idempotencyKey`. See [Idempotency](https://pubnio.com/docs/concepts/idempotency/).

## Limits

- Field lengths and ranges are in the [OpenAPI document](https://pubnio.com/api/v1/openapi).

## Related

- [Media operations](https://pubnio.com/docs/reference/#media)
- [Publishing](https://pubnio.com/docs/publishing/)

Source: https://pubnio.com/docs/reference/media-import/index.mdx
