On this page5 sections
If your app lets users paste a Facebook video link and you need the file, a transcript or just the title and length, you've probably run into these already:
- The official API only covers videos your app is allowed to read. Meta's Graph API gives you a video's file URL, but only with a token that has access to that video: typically a Page you manage, or a user who connected your app. A public video someone pastes from another Page usually isn't one of those.
- Scraping the page breaks on servers. From a laptop, the video page often loads. From a cloud server (AWS, GCP, Fly, Vercel functions, an agent sandbox) Facebook tends to answer with a login wall instead of the video.
- Links come in several shapes.
facebook.com/watch/?v=,/videos/, Reels, and mobilem.facebook.comlinks all point at the same kind of thing, and each needs handling before you reach the media.
The free route, if the videos are yours
If the videos live on a Facebook Page you manage, use the Graph API:
- Create a Meta app and get a Page access token for your Page.
- Request the video node with the
sourcefield:GET /<video-id>?fields=source,title,length.sourceis a URL to the playable video file. - Download that URL before it expires.
That's the right answer for your own Page's videos, and it's free. It doesn't help when the video belongs to someone else, which is the usual case when users paste links into your app.
One call with Importly
Importly takes the public Facebook video link your user pasted and returns the file, from servers and agent sandboxes where Facebook normally shows a login wall.
curl https://api.importly.io/import \
-H "Authorization: Bearer $IMPORTLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.facebook.com/watch/?v=<video-id>",
"webhookUrl": "https://example.com/webhooks/import"
}'When the job finishes, the webhook (or GET /import/status?id=<jobId>) gives you a link to the MP4, or puts it straight into your own S3, R2 or B2 bucket.
A few things worth knowing:
- Send the full link.
facebook.com/watch/?v=…andfacebook.com/<page>/videos/…links work, and so dom.facebook.commobile links. - Public videos only. Videos that are private, friends-only or in a closed group need a login to watch, so they fail. Failed imports aren't charged.
- Audio only: set
"includeVideo": falseto get just the soundtrack. - Transcript: add
"includeTranscript": trueto get a timestamped transcript in the same job. - Just the details: the metadata endpoint returns the title, duration and thumbnail without downloading the file.
What it costs
Downloads are $0.002 per MB, with a $0.01 minimum per import, so a 50 MB video costs about $0.10. Set maxCostDollars on a request and Importly checks the price before downloading anything. It's free to try, no card required. See pricing for the full list.
Have your AI agent build it in
Connect https://mcp.importly.io/mcp to Claude Code, Cursor or another coding agent and ask it to add Facebook video downloads to your app. It gets working code for your stack, writes the integration and tests real calls with your API key, and your backend uses the same key. The steps are in Have your agent build Importly into your app.
FAQ
Can I download any Facebook video with the Graph API?
No. The Graph API returns a video's file URL only when your token is allowed to read that video, such as videos on a Page you manage. It isn't a way to fetch arbitrary public videos your users paste.
Why does my Facebook download work locally but fail on my server?
Facebook treats requests from cloud and datacenter IPs with more suspicion and often shows a login wall instead of the video. The same code that works on your laptop can fail once it's deployed.
Can Importly download private or group videos?
No. Only videos anyone can watch without logging in. Private, friends-only and closed-group videos fail and aren't charged.
Can I get just the audio or a transcript?
Yes. Set includeVideo to false for the audio only, or add includeTranscript: true to get a transcript with the download.
Related: Video downloader API, Supported sites, Importly docs.