Skip to main content
Before you download a video link, you often want to know what you’ll get and what it will cost: which resolutions are available, whether the file plays everywhere, and the price of each. Importly’s POST /metadata returns that list for any link, so you can show a user the choices, or let an agent pick, and only then import the one you want. A metadata call is $0.003 and never downloads the media; you pay the download price only when you call POST /import. The same recipe in Python is Options and cost in Python.

The code

options.mjs
Create your key on the API key page (it’s shown once) and keep it on the server.

What comes back

The finished metadata job has a downloadOptions object with a video list and an audio list. Each row is one file you could import:
  • Send a row’s videoQuality to POST /import to get that file, or its audioQuality with includeVideo: false for audio only.
  • estimatedCost is the price you’d pay for that import, in dollars. It’s null when the source gives no size, so guard for it before sorting or displaying.
  • Rows that return the same file are folded into one: the others are listed in alsoMatches, and default: true marks what you get if you import without naming a quality. So a video that tops out at 1080p lists it once with 1440p, 2160p and best beside it.
  • h264: false means the file won’t play in Safari, on iOS or in QuickTime as is. Send compatibleCodecs: true with the import to get an H.264 version where the source has one (usually a larger file, so the cost goes up).
  • video is empty for audio-only sources such as podcasts, and downloadOptions is absent for a live stream that hasn’t ended.

Errors to handle

Every error has a documentationUrl with the fix. See Error handling.
Listing the options costs $0.003 per link, and status checks are free. You pay the download price only when you import. Try it free, no card required. See Pricing & credits.