Stream Url

GET/tw-v2/space/stream-url

Description

Get the audio stream URL for a Twitter Space. Returns an HLS stream URL that can be used to listen to the Space audio. The mediaKey can be obtained from the Space details endpoint.

Parameters

ParameterTypeRequiredDescription
mediaKeystringrequiredMedia key of the Space (obtained from the space by-id endpoint's mediaKey field)

Code Examples

const params = new URLSearchParams({
  mediaKey: '28_1991353658102149130'
});

const response = await fetch(`https://api.tweetapi.com/tw-v2/space/stream-url?${params}`, {
  method: 'GET',
  headers: {
    'X-API-Key': 'YOUR_API_KEY'
  }
});

const data = await response.json();
console.log(data);

Response

Success Response (200 OK)

200
{
  "data": {
    "hlsUrl": "https://prod-fastly-us-east-1.video.pscp.tv/Transcoding/v1/hls/0FoQIv-FMaRuteEiaTO7zltaOMy0F03j6OUIXN1b7jD4Pc3vSRQAHHBAShS4U2EKz_rhb7pRmCWzrHXHUHmMgg/non_transcode/us-east-1/periscope-replay-direct-prod-us-east-1-public/audio-space/playlist_16683092921815562133.m3u8?type=replay",
    "status": "LIVE_PUBLIC",
    "streamType": "HLS",
    "shareUrl": "https://x.com/i/broadcasts/1MnxnPmLRQBGO"
  }
}

API Playground

GET/tw-v2/space/stream-url

Press ⌘ + Enter to execute

curl -X GET "https://api.tweetapi.com/tw-v2/space/stream-url" \
  -H "X-API-Key: YOUR_API_KEY"
Response

Click "Try It!" to see the response