REST API · GET
X (Twitter) Media API
Download videos, GIFs, and photos from X (Twitter) posts via x.com or twitter.com links.
https://api.interapi.dev/api/v1/x
Price: 5 credits per successful response. 5xx is free, 4xx costs at most 1 credit. Pricing
What it does
Accepts post links in the x.com/…/status/… and twitter.com/…/status/… form, including posts with several attachments. For videos it returns every MP4 variant from best to worst with a quality label and frame height; GIFs come back as short MP4 videos with quality GIF, photos in their original size. video_hd_url is the best quality, video_url a variant up to 720p, title holds the post text and author the account handle. The same endpoint also answers at /api/v1/twitter.
- Videos, GIFs, and photos
- Every MP4 quality, up to 1080p
- x.com and twitter.com
- Multiple attachments per post
- Alias /api/v1/twitter
How to use it
- Copy a link to an X post (x.com or twitter.com).
- GET /api/v1/x?url=…
- Response: media[] with MP4 variants, GIFs, or photos, plus video_hd_url and thumbnail.
Parameters
urlstringrequired- Link to a public post: x.com/<account>/status/<id> or twitter.com/<account>/status/<id>.
Request example
curl -G "https://api.interapi.dev/api/v1/x" \
-H "X-API-Key: YOUR_API_KEY" \
--data-urlencode "url=https://x.com/elonmusk/status/1585341984679469056"import requests
resp = requests.get(
"https://api.interapi.dev/api/v1/x",
params={"url": "https://x.com/elonmusk/status/1585341984679469056"},
headers={"X-API-Key": "YOUR_API_KEY"},
timeout=60,
)
resp.raise_for_status()
print(resp.json())const params = new URLSearchParams({ url: "https://x.com/elonmusk/status/1585341984679469056" });
const resp = await fetch(`https://api.interapi.dev/api/v1/x?${params}`, {
headers: { "X-API-Key": "YOUR_API_KEY" },
});
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
console.log(await resp.json());<?php
$query = http_build_query(["url" => "https://x.com/elonmusk/status/1585341984679469056"]);
$ch = curl_init("https://api.interapi.dev/api/v1/x?" . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-API-Key: YOUR_API_KEY"],
CURLOPT_TIMEOUT => 60,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);
Response example
{
"status": "success",
"platform": "InterAPI",
"title": "Entering Twitter HQ – let that sink in!",
"description": "Entering Twitter HQ – let that sink in!",
"author": "elonmusk",
"media": [
{
"type": "video",
"url": "https://video.twimg.com/…/vid/1920x1080/aeoVUvTgj4wHShhN.mp4",
"quality": "1080p",
"download_url": "https://video.twimg.com/…/vid/1920x1080/aeoVUvTgj4wHShhN.mp4",
"height": 1080,
"ext": "mp4"
},
{
"type": "video",
"url": "https://video.twimg.com/…/vid/1280x720/cwj11yOgYZ05R_sY.mp4",
"quality": "720p",
"download_url": "https://video.twimg.com/…/vid/1280x720/cwj11yOgYZ05R_sY.mp4",
"height": 720,
"ext": "mp4"
}
],
"video_url": "https://video.twimg.com/…/vid/1280x720/cwj11yOgYZ05R_sY.mp4",
"video_hd_url": "https://video.twimg.com/…/vid/1920x1080/aeoVUvTgj4wHShhN.mp4",
"music_url": null,
"thumbnail": "https://pbs.twimg.com/ext_tw_video_thumb/…/DwJ7wlGIe9iryk6N.jpg",
"duration_sec": 9,
"channel_url": null,
"duration_ms": 1140
}duration_ms is server processing time. URLs in the example are shortened.
Test a request
Without a key — up to 30 requests per hour per IP. With your key, each request costs the API price in credits.
Paste a link and press Send. The response shows up here.