Option A — Using axios (Recommended)
Install axios and call the GET /instagram endpoint to extract any public Instagram Reel:
// npm install axios
const axios = require('axios');
const API_KEY = 'your_api_key';
const BASE_URL = 'https://api.teraboxdl.site/v1/instagram';
async function getInstagramReel(url) {
const response = await axios.post(
`${BASE_URL}/reel`,
{ url },
{ headers: { 'X-API-Key': API_KEY }, timeout: 30000 },
);
return response.data;
}
// Usage
const result = await getInstagramReel('https://www.instagram.com/reel/DeSX7IaAIUu/');
console.log('MP4 URL:', result.data.video_url);
console.log('Thumbnail:', result.data.thumbnail);
console.log('Caption:', result.data.caption);
console.log('Credits left:', result.credits_remaining);Option B — Native fetch (Node 18+)
No dependencies needed if you're on Node.js 18 or later:
// Node 18+ native fetch (no npm install needed)
const API_KEY = 'your_api_key';
const BASE_URL = 'https://api.teraboxdl.site/v1/instagram';
async function getInstagramReel(url) {
const res = await fetch(`${BASE_URL}/reel`, {
method: 'POST',
headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ url }),
signal: AbortSignal.timeout(30000),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
return res.json();
}
async function getInstagramProfile(username) {
const params = new URLSearchParams({ username });
const res = await fetch(`${BASE_URL}/profile?${params}`, {
headers: { 'X-API-Key': API_KEY },
signal: AbortSignal.timeout(30000),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const { data } = await res.json();
return data.user; // data.user.stats.followers_count, data.user.biography, data.user.profile_pic_url
}Express Backend Integration
Build a full Express endpoint that accepts Instagram URLs and returns structured download data for your frontend or Telegram bot:
const express = require('express');
const axios = require('axios');
const app = express();
const API_KEY = process.env.INSTAGRAM_API_KEY;
// POST /download { "url": "https://www.instagram.com/reel/..." }
app.post('/download', express.json(), async (req, res) => {
const { url } = req.body;
if (!url) return res.status(400).json({ error: 'url is required' });
try {
const { data } = await axios.post(
'https://api.teraboxdl.site/v1/instagram/reel',
{ url },
{ headers: { 'X-API-Key': API_KEY }, timeout: 30000 },
);
res.json({
videoUrl: data.data.video_url,
thumbnail: data.data.thumbnail,
caption: data.data.caption,
creditsLeft: data.credits_remaining,
});
} catch (err) {
const status = err.response?.status;
if (status === 402) return res.status(402).json({ error: 'Out of API credits' });
if (status === 404) return res.status(404).json({ error: 'Post not found, deleted or private' });
res.status(500).json({ error: 'Extraction failed' });
}
});
app.listen(3001, () => console.log('Server running on :3001'));API Response Structure
A successful response returns the following JSON structure:
{
"status": "success",
"cached": false,
"credits_remaining": 24987,
"data": {
"media_type": "video",
"video_url": "https://scontent.cdninstagram.com/...",
"thumbnail": "https://scontent.cdninstagram.com/...",
"caption": "Post caption text",
"username": "natgeo",
"like_count": 12400,
"media_list": [{ "type": "video", "url": "...", "thumbnail": "..." }]
}
}HTTP Status Codes
| Status | Meaning |
|---|---|
| 200 OK | Success — 1 credit deducted |
| 400 Bad Request | Invalid URL or missing parameters |
| 401 Unauthorized | Missing or malformed API key |
| 402 Payment Required | Insufficient credits — purchase more |
| 403 Forbidden | Invalid API key |
| 404 Not Found | Post deleted or private account |
| 429 Too Many Requests | Rate limit exceeded |
Get Your Instagram API Key
Sign up free: 100 requests are added to your account. Use the Node.js code above right away.
