> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Spaces Search

> The Spaces Search endpoint lets you search for live or scheduled Spaces by keyword. Reference for the X API v2 standard tier covering search.

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

The Spaces Search endpoint lets you search for live or scheduled Spaces by keyword. Find Spaces about topics of interest.

## Overview

<CardGroup cols={2}>
  <Card title="Keyword search" icon="magnifying-glass">
    Search Spaces by title
  </Card>

  <Card title="Discover Spaces" icon="microphone">
    Find live and upcoming Spaces
  </Card>
</CardGroup>

***

## Endpoint

| Method | Endpoint                                          | Description       |
| :----- | :------------------------------------------------ | :---------------- |
| GET    | [`/2/spaces/search`](/x-api/spaces/search-spaces) | Search for Spaces |

***

## Parameters

| Parameter      | Description                     |
| :------------- | :------------------------------ |
| `query`        | Search query (required)         |
| `state`        | Filter by `live` or `scheduled` |
| `space.fields` | Additional Space fields         |
| `expansions`   | Related objects to include      |

***

## Example request

```bash theme={null}
curl "https://api.x.com/2/spaces/search?\
query=AI&\
state=live&\
space.fields=title,host_ids,participant_count" \
  -H "Authorization: Bearer $BEARER_TOKEN"
```

## Example response

```json theme={null}
{
  "data": [
    {
      "id": "1DXxyRYNejbKM",
      "state": "live",
      "title": "Discussing AI and the Future",
      "host_ids": ["1234567890"],
      "participant_count": 245
    }
  ],
  "meta": {
    "result_count": 1
  }
}
```

***

## Getting started

<Note>
  **Prerequisites**

  * An approved [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * A [Project and App](/resources/fundamentals/developer-apps) in the Developer Console
  * Your App's [keys and tokens](/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/x-api/spaces/search/quickstart">
    Search for your first Space
  </Card>

  <Card title="Spaces lookup" icon="microphone" href="/x-api/spaces/lookup/introduction">
    Look up Spaces by ID
  </Card>

  <Card title="API Reference" icon="code" href="/x-api/spaces/search-spaces">
    Full endpoint documentation
  </Card>
</CardGroup>
