GrabbyAPI docs

Public API

One endpoint. Send a direct file link or supported platform URL, get a download URL back.

Endpoint

POST /api/public/download

Headers

  • X-API-Key: your key (set as DOWNLOADER_API_KEY in project secrets)
  • Content-Type: application/json

Body

{
  "url": "https://...",             // required
  "format": "video" | "audio",       // default "video"
  "quality": "auto" | "144" | "240" | "360" | "480"
           | "720" | "1080" | "1440" | "2160" | "max",  // video only
  "audioFormat": "mp3" | "opus" | "ogg" | "wav" | "best" // audio only
}

Example

curl -X POST https://id-preview--e4cffd2e-2549-4ea5-bd31-3c87b3087cca.lovable.app/api/public/download \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <your key>" \
  -d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","format":"video","quality":"1080"}'

Responses

200 { "status": "success", "type": "redirect"|"tunnel", "url": "...", "filename": "..." }
200 { "status": "success", "type": "picker", "items": [{ "type":"photo|video|gif", "url":"...", "thumb":"..." }] }
400 { "status": "error", "error": "..." }
401 { "error": "invalid api key" }

Telegram bot (Node.js)

وقتی کاربر یه لینک برات فرستاد، این endpoint رو صدا بزن و بسته به نوع خروجی، فایل رو با sendVideo / sendAudio/ sendMediaGroup بفرست.

const API = "https://id-preview--e4cffd2e-2549-4ea5-bd31-3c87b3087cca.lovable.app/api/public/download";
const KEY = process.env.DOWNLOADER_API_KEY;

async function resolve(url, format = "video", quality = "720") {
  const r = await fetch(API, {
    method: "POST",
    headers: { "Content-Type": "application/json", "X-API-Key": KEY },
    body: JSON.stringify({ url, format, quality }),
  });
  return r.json();
}

// در handler ربات:
bot.on("message", async (msg) => {
  const link = (msg.text || "").match(/https?:\/\/\S+/)?.[0];
  if (!link) return;
  const res = await resolve(link, "video", "720");
  if (res.status !== "success") return bot.sendMessage(msg.chat.id, res.error);

  if (res.type === "picker" && res.items?.length) {
    await bot.sendMediaGroup(msg.chat.id, res.items.slice(0, 10).map(it => ({
      type: it.type === "photo" ? "photo" : "video",
      media: it.url,
    })));
  } else if (res.url) {
    // تلگرام خودش از URL دانلود می‌کنه (تا 20MB برای bot API)
    await bot.sendVideo(msg.chat.id, res.url, { caption: res.filename });
  }
});

نکته: تلگرام حداکثر ۲۰ مگابایت رو با URL می‌پذیره. برای فایل بزرگ‌تر، اول URL رو stream کن و بعد به‌عنوان Buffer بفرست، یا از /api/public/download-proxy?url=...&name=... استفاده کن.

Supported sources

YouTube (چند لایه fallback)، SoundCloud، Instagram، TikTok، Twitter/X، و لینک‌های مستقیم فایل. Spotify فقط از طریق تطبیق با یوتیوب/ساندکلاد.