> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-mintlify-3249b1b7.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-3249b1b7/GQWCb0M6PGrgPm8j/icons/xds/icon-search.svg?fit=max&auto=format&n=GQWCb0M6PGrgPm8j&q=85&s=bfba2901eeb4c3d32bd53cde772f5ef1" 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-3249b1b7/fpkW3xmn3JWOHK4O/icons/xds/icon-microphone.svg?fit=max&auto=format&n=fpkW3xmn3JWOHK4O&q=85&s=5d92574023d41bf3de01050a218a0c75" 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-3249b1b7/Y3LbNgoanYhnz9oK/icons/xds/icon-brackets.svg?fit=max&auto=format&n=Y3LbNgoanYhnz9oK&q=85&s=86aab7c301f3e63788beb79de2f6b5aa" 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-3249b1b7/Q9EWTkMVzIj7Ms8u/icons/xds/icon-rocket.svg?fit=max&auto=format&n=Q9EWTkMVzIj7Ms8u&q=85&s=78ade4c1e2d7d01360f126c50061ba44" 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-3249b1b7/fpkW3xmn3JWOHK4O/icons/xds/icon-microphone.svg?fit=max&auto=format&n=fpkW3xmn3JWOHK4O&q=85&s=5d92574023d41bf3de01050a218a0c75" 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-3249b1b7/R41esbfzMAMKCGF_/icons/xds/icon-code.svg?fit=max&auto=format&n=R41esbfzMAMKCGF_&q=85&s=d75deeb9bdb453970756b7787ae16d40" href="/x-api/spaces/search-spaces" width="24" height="24" data-path="icons/xds/icon-code.svg">
    Full endpoint documentation
  </Card>
</CardGroup>
