API & MCP
Extract and download Twitter/X media programmatically. There's a JSON REST API and a Model Context Protocol (MCP) server so AI agents can do it directly.
Authentication & rate limits
Auth is optional. Without a key you get 30 requests/hour and 100/day per IP. Send an API key for higher limits. Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset; exceeding the limit returns 429 with a Retry-After header.
Authorization: Bearer YOUR_API_KEY
# or
X-API-Key: YOUR_API_KEYExtract media
Returns author, text, thumbnail, and every media variant with direct URLs.
curl "https://download-twitter-video.drummerduck.com/api/extract?url=https://x.com/SpaceX/status/1919172303709184350"const res = await fetch("https://download-twitter-video.drummerduck.com/api/extract", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ url: "https://x.com/i/status/1919172303709184350" }),
});
const { ok, data } = await res.json();
const best = data.media[0].variants[0]; // highest quality
console.log(best.quality, best.url);{
"ok": true,
"data": {
"source": "twitter",
"id": "1919172303709184350",
"url": "https://x.com/SpaceX/status/1919172303709184350",
"author": { "name": "SpaceX", "handle": "SpaceX", "avatar": "https://…" },
"text": "…",
"thumbnail": "https://pbs.twimg.com/…",
"media": [
{
"type": "video",
"durationMs": 30000,
"variants": [
{ "quality": "1080p", "width": 1920, "height": 1080,
"container": "mp4", "url": "https://video.twimg.com/…1920x1080….mp4" },
{ "quality": "720p", "container": "mp4", "url": "https://video.twimg.com/…" }
]
}
],
"engine": "syndication"
}
}Download a file
Streams the chosen variant as an attachment (correct filename + Content-Disposition). Use quality to pick a resolution and n for the media index.
curl -L -o video.mp4 \
"https://download-twitter-video.drummerduck.com/api/download?url=https://x.com/SpaceX/status/1919172303709184350&quality=1080p"MCP server (for AI agents)
A Streamable-HTTP MCP endpoint. Point any MCP client at it to give your assistant two tools: extract_twitter_video and get_tweet_info.
https://download-twitter-video.drummerduck.com/api/mcp{
"mcpServers": {
"twitter-video": {
"url": "https://download-twitter-video.drummerduck.com/api/mcp"
}
}
}{
"mcpServers": {
"twitter-video": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://download-twitter-video.drummerduck.com/api/mcp"]
}
}
}Errors
Failures return { "ok": false, "error": { "code", "message" } }. Codes: INVALID_URL, NOT_FOUND, NO_MEDIA, PROTECTED, RATE_LIMITED, UPSTREAM_ERROR.