403 or a bot check, or the request hangs until it times out. Files the app wrote to disk are gone after a restart.
- A TikTok, YouTube, Instagram or X link is a web page, not a file, so
fetchgets HTML back. - Many sites block requests from cloud servers, so a download that works from your laptop fails from the published app.
- Autoscale deployments scale to zero when idle and restart regularly by design, so a file written to the deployment’s disk isn’t kept. Files belong in App Storage.
How App Storage works
From Replit’s App Storage and JavaScript SDK pages, checked November 27, 2026:- Buckets are always private. There is no public URL, so your app serves files to the users it has authorized.
- Your app reaches its bucket through Replit’s SDK (
@replit/object-storagefor JavaScript, also one for Python), with no access keys to manage. - The app can upload, download, list and delete objects, but not change bucket settings.
- There are no lifecycle rules. To clean up old files, run a Scheduled deployment that deletes them.
store: true delivery doesn’t apply here. Your backend copies the finished file into the bucket itself, server to server, as shown below.
Free fix for direct file links
If the link points straight at a file (an.mp4 on a CDN or in another bucket), don’t read it into memory or write it to disk. Stream it into App Storage:
uploadFromStream resolves when the upload finishes and throws if it fails.
Where the free fix stops
Users rarely paste a file URL. They paste the page they watched the video on:- Getting the video out of a TikTok, YouTube or X page takes a downloader, and keeping one working means updating it every time a site changes.
- The published app runs on datacenter IPs, which many sites block, so the downloader that works in the preview gets errors in production.
- Long videos keep the request open the whole time, with the user waiting on it.
Send the link, copy the finished file
With Importly, your backend only sends the link. Importly downloads the video and calls your webhook when the file is ready, then your webhook copies it into App Storage. The tested Express server below has three routes:POST /api/videosstarts the import and returns at once.POST /api/webhooks/importlycopies the finished file into App Storage.GET /api/videos/:jobId/filestreams the file back to your users from the private bucket.
IMPORTLY_API_KEY, and your published app’s URL (for example https://your-app.replit.app) as APP_URL. Install the SDK with npm install @replit/object-storage, and create a bucket in the App Storage tool. new Client() uses the app’s default bucket.
server/index.ts
- It takes only the
jobIdfrom the request and reads the result from the API with your key, so a forged request can’t put a file into your bucket. To reject forged requests earlier, also check theImportly-Signatureheader as shown in Verify signatures. - It answers
200after the copy, and500if the copy fails. Importly waits 10 seconds for an answer and retries a delivery that fails or times out, with the sameImportly-Webhook-Id. A long video can take longer than 10 seconds to copy, so a retry may arrive for a file that’s already saved; theexistscheck skips it. - The retries back off to hours apart, so also check records that have been pending for a few minutes with
GET /import/statusand run the samesaveFile. The webhook URL must be public, so while you work in the workspace, poll the status endpoint instead.
mediaUrl stays valid for 7 days, so the copy can also run later from a status check. Set includeVideo: false for audio only. For a transcript instead of the file, see Use Importly from Lovable, Bolt or Replit; there’s no file to move.
We ran this server against the live API with a TikTok link: the webhook copied the 1.5 MB video in under a second, a repeated delivery was skipped, and the file route returned the same bytes. App Storage itself was replaced by a local stand-in for the test, since it only runs on Replit.
A 10-minute 720p video costs about $0.15 to import, and
maxCostDollars stops a long one before it’s charged. Try it free, no card required. See Pricing & credits.