Blog

How to Access Twitter Spaces Data Programmatically

Learn how to access Twitter/X Spaces data including live audio rooms, speaker lists, and listener counts through shadow APIs discovered from browsing traffic.

Lewis Tham
April 3, 2026

How to Access Twitter Spaces Data Programmatically

Twitter Spaces (now X Spaces) has become a major platform for live audio conversations. Tech leaders, crypto communities, political commentators, and media personalities host Spaces that attract thousands of listeners. The data around these events — who is speaking, how many listeners, what topics are trending, scheduled upcoming Spaces — is valuable for media monitoring, audience research, and community analytics.

But accessing Spaces data programmatically is nearly impossible through official channels. The X API v2 has limited Spaces endpoints that require elevated access (the $100/month Basic tier or higher). Even with paid access, the API only returns basic metadata — space ID, title, state, and host. It does not return listener counts over time, speaker participation history, or the rich metadata visible in the X client.

The X web client loads all of this data through internal GraphQL endpoints. These shadow APIs return detailed Spaces information that the official API withholds. Unbrowse discovers them from normal browsing traffic.

What Are Shadow APIs?

Shadow APIs are the undocumented internal endpoints that power a web application's frontend. They are not available in any developer portal but carry the actual data the interface displays.

When you view a Space on X in your browser, the client makes GraphQL calls to:

  • A Space metadata endpoint that returns the title, state, host, scheduled start time, and topic tags
  • A participants endpoint that returns the full list of speakers, listeners, and their roles
  • A listener count endpoint that returns real-time and peak listener numbers
  • A scheduled Spaces endpoint that returns upcoming Spaces from accounts you follow or by topic
  • A search endpoint that returns Spaces matching a keyword query
  • A recording endpoint that returns playback URLs for recorded Spaces

These are GraphQL operations with specific operation names and variable schemas. They return comprehensive JSON payloads that the X web client renders.

What Unbrowse Discovers on X Spaces

Unbrowse captures all HTTP traffic during browsing and indexes the API routes. When you browse X Spaces through Unbrowse, it discovers:

  • Space detail endpoints — full metadata including title, description, state, host info, topic labels, and creation time
  • Participant endpoints — speakers with their usernames, follower counts, and speaking duration; listeners with join timestamps
  • Listener analytics endpoints — current listeners, peak listeners, and listener count over time
  • Scheduled Spaces endpoints — upcoming Spaces with scheduled times, hosts, and RSVP counts
  • Space search endpoints — find Spaces by keyword, topic, or host
  • Recording endpoints — playback URLs and metadata for completed Spaces that were recorded
  • Related Spaces endpoints — recommended Spaces based on your interests and follow graph

Each endpoint is stored with its GraphQL operation name, variable schema, and authentication requirements.

Getting Started

Install Unbrowse:

npm install -g unbrowse

Browse X Spaces to discover the internal APIs:

unbrowse browse "https://x.com/i/spaces"

Navigate through live Spaces, scheduled Spaces, and Space search. Unbrowse captures every GraphQL call.

Resolve a discovered endpoint:

unbrowse resolve "twitter spaces search"

Execute the route:

unbrowse execute "twitter spaces search" --params '{"query": "AI agents", "state": "live"}'

Code Example: Spaces Monitor for Community Intelligence

Here is a Node.js script that monitors live and upcoming Spaces for specific topics:

import Unbrowse from 'unbrowse';

const unbrowse = new Unbrowse();

// Resolve X Spaces endpoints
const searchSkill = await unbrowse.resolve('x spaces search');
const detailSkill = await unbrowse.resolve('x space details');

// Find live Spaces about AI
const liveSpaces = await unbrowse.execute(searchSkill, {
  query: 'artificial intelligence',
  state: 'live'
});

console.log(`Found ${liveSpaces.spaces.length} live AI Spaces:\n`);

for (const space of liveSpaces.spaces) {
  // Get detailed info for each Space
  const details = await unbrowse.execute(detailSkill, {
    spaceId: space.id
  });

  console.log(`"${details.title}"`);
  console.log(`  Host: @${details.host.username} (${details.host.followers} followers)`);
  console.log(`  Listeners: ${details.listenerCount} (peak: ${details.peakListeners})`);
  console.log(`  Speakers: ${details.speakers.map(s => '@' + s.username).join(', ')}`);
  console.log(`  Started: ${details.startedAt}`);
  console.log();
}

This returns data that would cost $100/month or more through the official API — and includes fields the official API does not expose at all.

Performance Comparison

Method Setup Time Avg Response Time Listener Counts Speaker History Cost
X API v2 (Basic) 30 min 200-500ms No No $100/mo
X API v2 (Pro) 30 min 200-500ms Limited No $5,000/mo
HTML Scraping Not practical N/A N/A N/A N/A
Unbrowse (Shadow API) 2 minutes 100-400ms Yes Yes Free

X Spaces is built entirely on client-side rendering with GraphQL. There is no meaningful HTML to scrape. The only ways to get Spaces data are the official API (expensive, limited) or the internal GraphQL endpoints that Unbrowse discovers.

Understanding X's GraphQL Layer

X (formerly Twitter) rebuilt its web client on a GraphQL API layer. Every piece of data visible in the web client — tweets, profiles, Spaces, DMs, notifications — is loaded through GraphQL operations. Each operation has a name (like AudioSpaceById or SpacesByCreatorIds) and a specific variable schema.

Unbrowse captures these operations with their full schemas, making it possible to call them directly. The GraphQL layer is more stable than X's HTML structure, which changes frequently, and more comprehensive than the official API, which deliberately restricts access to drive paid tier adoption.

FAQ

Is this legal? Unbrowse accesses the same GraphQL endpoints your browser calls when you view Spaces on X. It does not bypass authentication or access restricted data. Review X's Terms of Service for your specific use case.

Do I need an X account? Yes. X requires authentication to view Spaces. You need to be logged into X in the Unbrowse browser session.

Can I access audio recordings? Unbrowse can discover the playback URL endpoints for recorded Spaces. The audio itself is served from X's CDN and may have its own access restrictions.

How do I handle X's rate limits? X rate-limits per user and per IP. The internal API has different (often more generous) limits than the official API, but aggressive calling will still trigger throttling. Space your requests and cache results.

What about real-time updates? Unbrowse captures HTTP API calls, not WebSocket connections. For real-time listener count updates during a live Space, you would need to poll the detail endpoint. Unbrowse is best for on-demand data retrieval rather than real-time streaming.