Media downloads for serverless
Your function sends a URL.
The file shows up in your bucket.
Downloading video or audio inside Lambda, Vercel or Cloud Functions means fighting blocked IPs, packaging ffmpeg, and racing a timeout. Queue one HTTP request instead - the download runs on our side and we call your webhook when it's done.
Sign up with Google, GitHub, or email — $3 in credits land instantly. No card. No trial-expiry email.
// A serverless handler (Lambda, Vercel, Cloud Functions).
// It queues the job and returns in milliseconds - the download runs on Importly.
export async function handler(event) {
const { url } = JSON.parse(event.body)
const res = await fetch("https://api.importly.io/import", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMPORTLY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url,
includeVideo: false, // audio only
webhookUrl: "https://your.app/webhooks/import",
store: true, // also copy it into your own S3 bucket
}),
})
const { data } = await res.json() // { jobId, status: "queued" }
return { statusCode: 202, body: JSON.stringify({ jobId: data.jobId }) }
}What breaks when you download inside a function
Cloud IPs get blocked
Serverless functions call out from AWS, Google Cloud or Vercel address ranges, and big platforms like YouTube treat those as bots. Importly fetches through rotating residential proxies, so the IP problem isn't yours.
No ffmpeg in the runtime
Merging streams or pulling out audio needs ffmpeg, which isn't in serverless runtimes and bloats your bundle. Ask for audio only with includeVideo: false and get an audio file back.
/tmp and response size limits
Functions get a small scratch disk and can't return big files in the response. You get a signed mediaUrl, or a copy written straight to your S3, R2 or B2 bucket with store: true.
Execution timeouts
Long videos don't fit in a function's time limit. Your handler only queues the job and returns; the download runs on Importly and the result arrives by webhook or polling.
Platform changes
When a site changes how it serves media, we ship the fix. You don't rebuild and redeploy a function image every time something upstream moves.
Transcripts in the same job
Need text too? Add includeTranscript: true and the result carries a transcript alongside the file.
How it works
1
Get a key
Sign up with Google or GitHub. Your API key and $3 free credit are ready in under a minute. No card.
2
Queue from your function
POST the URL to /import with a webhookUrl. The call returns a jobId right away, so your function stays well inside its limits.
3
Receive the file
We call your webhook with the mediaUrl, title and duration, or poll /import/status. Set store: true to also get a copy in your own bucket.
Common questions
- What does it cost?
- $0.01 per MB downloaded, rounded up, with a $0.03 minimum per import. A 3-minute 720p video (about 40 MB) is about $0.40; audio only is much less. New accounts get $3.00 in free credit, no card required.
- How do I get the file into my storage?
- Every completed job has a signed mediaUrl that's valid for 7 days. To keep it, either copy it from your webhook handler or connect an S3-compatible bucket (Amazon S3, Cloudflare R2, Backblaze B2) and pass store: true, and we upload it for you.
- What if a job fails?
- Webhooks fire on success. Failed jobs have status: "failed" and a message explaining why, which you can read from /import/status.
- Which sites does it support?
- YouTube, TikTok, podcasts and hundreds of other public media sites. Pass the page URL as you'd paste it in a browser.
- Can my AI agent use it too?
- Yes. Connect the hosted MCP server at https://mcp.importly.io/mcp in Claude, ChatGPT, Cursor or Claude Code and it can import, transcribe and inspect media with the same API key.
Take media downloads out of your functions.
Self-serve. Stop any time. Your $3 credit doesn't expire.