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/download

Send 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

NameDescription
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: bytes

Notes