Skip to content

Import a public or signed HTTPS media URL

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

Import a public or signed HTTPS media URL with 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 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 has each field’s type.

Examples

const intake = await workspace.media.importUrl(
  "https://cdn.example.com/launch.mp4",
);
intake = workspace.media.import_url(url="https://cdn.example.com/launch.mp4")
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"}'
pnio media import https://cdn.example.com/launch.mp4
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

It also declares the problems most operations 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.

Limits

Type to search…

↑↓ navigate↵ selectEsc close