Skip to content
Node.jsJavaScriptTutorial

Get TeraBox Direct Download Links with Node.js — Full Tutorial

July 19, 2026 · 7 min read · By AR Digital Services

The TeraBox API is a simple REST endpoint — making it easy to integrate in Node.js using native fetch, axios, or any HTTP client. This guide covers all three approaches plus Express and serverless function integration.

Option A — Native fetch (Node 18+)

const API_KEY = "tbx_your_api_key_here";
const SHARE_URL = "https://terabox.com/s/1LpQ_A-gXb5JSDhYmX9v2wA";

async function getTeraboxLink(shareUrl) {
  const res = await fetch("https://api.teraboxdl.site/v1/api", {
    method: "POST",
    headers: {
      "X-API-Key": API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ url: shareUrl }),
  });

  if (!res.ok) {
    throw new Error(`HTTP error ${res.status}`);
  }

  const data = await res.json();

  if (!data.ok) {
    throw new Error(data.error || "API returned error");
  }

  return data;
}

// Usage
const result = await getTeraboxLink(SHARE_URL);
console.log("Download:", result.download_url);
console.log("Stream:", result.stream_url);
console.log("File:", result.file_name, `(${(result.size / 1e6).toFixed(1)} MB)`);

Option B — axios

// npm install axios
import axios from "axios";

async function getTeraboxLink(shareUrl) {
  const { data } = await axios.post(
    "https://api.teraboxdl.site/v1/api",
    { url: shareUrl },
    { headers: { "X-API-Key": process.env.TERABOX_API_KEY } }
  );

  if (!data.ok) throw new Error(data.error);
  return data;
}

Express API Route Integration

// routes/download.js
import express from "express";
const router = express.Router();

router.post("/resolve", async (req, res) => {
  const { url } = req.body;

  if (!url || !url.includes("terabox.com")) {
    return res.status(400).json({ error: "Invalid TeraBox URL" });
  }

  try {
    const apiRes = await fetch("https://api.teraboxdl.site/v1/api", {
      method: "POST",
      headers: {
        "X-API-Key": process.env.TERABOX_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ url }),
    });

    if (apiRes.status === 429) {
      return res.status(429).json({ error: "Daily quota exceeded" });
    }

    const data = await apiRes.json();
    return res.json(data);
  } catch (err) {
    return res.status(500).json({ error: "Internal server error" });
  }
});

export default router;

Vercel / Netlify Serverless Function

// api/resolve.js (Vercel Edge Function)
export const config = { runtime: "edge" };

export default async function handler(req) {
  const { url } = await req.json();

  const apiRes = await fetch("https://api.teraboxdl.site/v1/api", {
    method: "POST",
    headers: {
      "X-API-Key": process.env.TERABOX_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ url }),
  });

  const data = await apiRes.json();
  return new Response(JSON.stringify(data), {
    headers: { "Content-Type": "application/json" },
    status: apiRes.status,
  });
}

TypeScript Types

interface TeraBoxResponse {
  ok: boolean;
  file_name: string;
  size: number;         // bytes
  download_url: string; // direct CDN link
  stream_url: string;   // HLS m3u8 URL
  thumbnail: string;    // thumbnail image URL
  error?: string;
}

Get Your TeraBox API Key

Works with Node.js, Deno, Bun, Vercel Edge, Netlify Functions. From ₹1,999/month.

View Pricing & Buy Now →