Skip to main content
Your users paste a TikTok link and your Node backend needs the video file. Fetching TikTok yourself works on a laptop and gets blocked from servers, so this sends the link to Importly and saves the finished MP4. It runs on Node 18 or later with no dependencies.

The code

download-tiktok.mjs
Share links such as vm.tiktok.com/... work as they are, so you can pass on whatever your users paste.

What comes back

The finished job from GET /import/status:
TikTok videos are portrait, so 720p means 720 pixels on the short side (720×1280). Set includeVideo: false for the audio only. All options are in Downloads.

Errors to handle

Every error has a documentationUrl with the fix. See Error handling.

In production

  • Don’t make a web request wait on the loop above. Pass webhookUrl and save the file when Importly calls you back (Webhooks), and keep a status check as a fallback.
  • Copy the file somewhere permanent, or set store: true to have every import land in your own bucket (recipe).
  • For many links at once, see Batch imports.
Downloads cost $0.002 per MB, with a $0.01 minimum, so a short TikTok is usually about a cent. Try it free, no card required. See Pricing & credits.