X (Twitter)
Download file
Stream a video, photo or audio file through the API. Use it for large files (Facebook HD videos are often 50–100 MB) or when your servers can’t reach the platform’s CDN.
Endpoint
GET
/s/twitter/downloadSend your API key in the X-API-Key header. twitter is the usual service slug; use the one shown on your subscription if it differs.
Query parameters
| Name | Description |
|---|---|
urlrequired | A media URL from a previous answer (media[].url or a variant URL). Links to any other site are refused.Example: https://video.twimg.com/ext_tw_video/1834567890123456789/pu/vid/1280x720/video.mp4 |
filenameoptional | Name to save the file as. The extension is added from the file type if missing.Example: x-video |
Example request
# -o writes the file as it arrives; -C - resumes a broken download.
curl -C - -o video.mp4 '/s/twitter/download?url=https%3A%2F%2Fvideo.twimg.com%2Fext_tw_video%2F1834567890123456789%2Fpu%2Fvid%2F1280x720%2Fvideo.mp4&filename=x-video' \
-H 'X-API-Key: YOUR_API_KEY'Response
The body is the file itself, not JSON. Errors still come back as JSON with a message.
HTTP/1.1 200 OK
Content-Type: video/mp4
Content-Length: 73400320
Content-Disposition: attachment; filename=facebook-video.mp4
Accept-Ranges: bytesNotes
- The file is streamed as it arrives, so you can start writing it to disk (or playing it) right away. Read it in chunks rather than loading it into memory.
- Range requests work: send Range: bytes=START- to resume a broken download, or let a video player seek.
- A 404 means the media link expired. Call the post endpoint again for fresh links.
- Each download counts as one request on your plan, whatever the file size.