> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-mintlify-e5f79cbf.mintlify.site/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">
    <a href={href}>
      <button className="x-btn">
        <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="https://mintcdn.com/x-preview-mintlify-e5f79cbf/8YY47gv4T-fnQISQ/icons/xds/icon-search.svg?fit=max&auto=format&n=8YY47gv4T-fnQISQ&q=85&s=170566abe50bd3283e01a376c35ff259" width="24" height="24" data-path="icons/xds/icon-search.svg">
    Search Spaces by title
  </Card>

  <Card title="Discover Spaces" icon="https://mintcdn.com/x-preview-mintlify-e5f79cbf/p3V4NSxfDsGyiKvl/icons/xds/icon-microphone.svg?fit=max&auto=format&n=p3V4NSxfDsGyiKvl&q=85&s=80d290370f5afb07d1d02d8cca78d96d" width="24" height="24" data-path="icons/xds/icon-microphone.svg">
    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 title="Example response" lines wrap icon="https://mintcdn.com/x-preview-mintlify-e5f79cbf/AyvG5Xch6HMK5lr_/icons/xds/icon-brackets.svg?fit=max&auto=format&n=AyvG5Xch6HMK5lr_&q=85&s=722ca0116a6a142b6cbbee564acec165" 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="https://mintcdn.com/x-preview-mintlify-e5f79cbf/bNtjyDkgI1KpTdXU/icons/xds/icon-rocket.svg?fit=max&auto=format&n=bNtjyDkgI1KpTdXU&q=85&s=3a152bcee6b8e05b69b2c375a6b92606" href="/x-api/spaces/search/quickstart" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    Search for your first Space
  </Card>

  <Card title="Spaces lookup" icon="https://mintcdn.com/x-preview-mintlify-e5f79cbf/p3V4NSxfDsGyiKvl/icons/xds/icon-microphone.svg?fit=max&auto=format&n=p3V4NSxfDsGyiKvl&q=85&s=80d290370f5afb07d1d02d8cca78d96d" href="/x-api/spaces/lookup/introduction" width="24" height="24" data-path="icons/xds/icon-microphone.svg">
    Look up Spaces by ID
  </Card>

  <Card title="API Reference" icon="https://mintcdn.com/x-preview-mintlify-e5f79cbf/S3yZx8XEPl5cyFW6/icons/xds/icon-code.svg?fit=max&auto=format&n=S3yZx8XEPl5cyFW6&q=85&s=63c71be221e15dc9a97ebf08edf7ce76" href="/x-api/spaces/search-spaces" width="24" height="24" data-path="icons/xds/icon-code.svg">
    Full endpoint documentation
  </Card>
</CardGroup>
