# Search lists

`GET https://api.twittrapi.com/lists/search`

Public lists whose name or description matches a keyword.

HTML page: https://www.twittrapi.com/docs/reference/lists-search

## Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `query` | query | string | yes |  | Search words, up to 512 characters. |
| `count` | query | integer | no | 20 | Number of lists to ask X for, 1 to 100. Other values fall back to 20. X treats it as a hint. |
| `cursor` | query | string | no |  | Bottom cursor from the previous page. Leave it out for the first page. See Pagination. |

This endpoint also accepts `format=simple` (or the header `X-Response-Format: simple`) for compact, flat JSON with a fixed schema. Same price.

Paginated: pass the bottom cursor of one page as `cursor` to get the next. Each page is one billed call.

## Response

Raw JSON of X's ListSearchTimeline query: data.search_by_raw_query.list_search_timeline.timeline.instructions, the lists in one module (TimelineTwitterList items) plus a bottom cursor.

With `format=simple`: Collection of List objects, as /user/{userId}/lists.

## Errors

| Status | When |
| --- | --- |
| 400 | query is missing. |
| 422 | query is longer than 512 characters. |

Shared errors (401 missing key, 402 no balance, 429 rate limit, 5xx) are listed on https://www.twittrapi.com/docs/helpful-infos/error-handling. Calls that fail with 400, 407, 408, 409 or a 5xx error are refunded.

## Example request

curl:

```bash
curl 'https://api.twittrapi.com/lists/search?query=crypto' \
  --header 'X-API-KEY: YOUR_API_KEY'
```

Python:

```python
import httpx

# No SDK method for this endpoint yet, so this is a plain HTTP call.
resp = httpx.get(
    "https://api.twittrapi.com/lists/search",
    headers={"X-API-KEY": "YOUR_API_KEY"},
    params={
        "query": "crypto",
    },
    timeout=60,
)
data = resp.json()
```

Node.js:

```js
import { TwittrAPI } from "twittrapi";

const client = new TwittrAPI({ apiKey: process.env.TWITTRAPI_API_KEY });
// No wrapper method for this endpoint yet; client.get() sends the same authenticated GET.
const data = await client.get({
  path: "/lists/search",
  query: {
    query: "crypto",
  },
});
```

RapidAPI:

```bash
curl 'https://twitter-aio.p.rapidapi.com/lists/search?query=crypto' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY' \
  --header 'x-rapidapi-host: twitter-aio.p.rapidapi.com'
```

## Example response

Shortened: arrays keep their first items and long strings are cut.

Raw (default):

```json
{
  "data": {
    "search_by_raw_query": {
      "list_search_timeline": {
        "timeline": {
          "instructions": [
            {
              "type": "TimelineClearCache"
            },
            {
              "direction": "Top",
              "type": "TimelineTerminateTimeline"
            },
            {
              "entries": [
                {
                  "content": {
                    "__typename": "TimelineTimelineModule",
                    "clientEventInfo": {
                      "component": "list_search"
                    },
                    "displayType": "Vertical",
                    "entryType": "TimelineTimelineModule",
                    "items": [
                      {
                        "entryId": "list-search-0-list-1073407660337188865",
                        "item": {
                          "clientEventInfo": {
                            "component": "list_search",
                            "element": "list"
                          },
                          "itemContent": {
                            "__typename": "TimelineTwitterList",
                            "displayType": "ListWithSubscribe",
                            "itemType": "TimelineTwitterList",
                            "list": {
                              "…": "…"
                            }
                          }
                        }
                      },
                      "… 2 more"
                    ]
                  },
                  "entryId": "list-search-0",
                  "sortIndex": "2127343538160009216"
                },
                "… 1 more"
              ],
              "type": "TimelineAddEntries"
            }
          ]
        }
      }
    }
  }
}
```

Simple (`format=simple`):

```json
{
  "data": [
    {
      "id": "1900000000000000003",
      "name": "Crypto Core",
      "description": "",
      "createdAt": "2018-12-14T02:41:43Z",
      "memberCount": 136,
      "followerCount": 17024,
      "private": false,
      "bannerUrl": "https://pbs.twimg.com/media/GkIQ8I1XgAAKHEf.png",
      "owner": {
        "id": "1000000000000000003",
        "username": "example_user_3"
      }
    },
    "… 2 more"
  ],
  "nextCursor": "DAAHCgABHYXXrUM___8LAAIAAAAsV3pNeE15NDRNVFUyTkN3eE1qa3lOVGMzTXpneU5EZzJPRE14TVRBMFhRPT0IAAMAAAACAAA",
  "previousCursor": null,
  "hasNextPage": true
}
```
