# lichess.team_search

**stable** **Advanced**

Search Lichess teams by name.

`GET /v1/lichess/team_search`

## What you get

A list of Lichess results in Onekey's unified shape, in `data` (an array). An empty array is a normal, successful answer and is charged like any other; a source that reports "nothing found" as an error returns a free `404 not_found` instead.

## What it costs

- **Advanced · 5 credits** for a fresh fetch, charged only when it succeeds.
- **Free when served from cache (0.2 credit for a cached response over 100 KB).**
- **Free** if the request is invalid (never charged) or the source fails or reports not found (refunded).

## Parameters

| Name | Type | Required | Default | What it is | Constraints |
| --- | --- | --- | --- | --- | --- |
| `q` | string | yes | (required) | Search text | max 100 chars; must match `[^\x00-\x1f]{1,100}`; trimmed, repeated spaces collapsed |

## Request

```bash
curl "https://api.onekey.dev/v1/lichess/team_search?q=chess" \
  -H "x-api-key: YOUR_API_KEY"
```

```python
import requests

res = requests.get(
    "https://api.onekey.dev/v1/lichess/team_search",
    params={"q": "chess"},
    headers={"x-api-key": "YOUR_API_KEY"},
)
body = res.json()

if body["success"]:
    print(body["data"])
else:
    print(body["error"]["code"], body["error"]["message"])
```

```javascript
const params = new URLSearchParams({ q: "chess" });
const res = await fetch(`https://api.onekey.dev/v1/lichess/team_search?${params}`, {
  headers: { "x-api-key": "YOUR_API_KEY" },
});
const body = await res.json();

if (body.success) console.log(body.data);
else console.error(body.error.code, body.error.message);
```

## Recorded response

A real Lichess response, recorded and returned in Onekey's shape. Fields the platform does not provide are `null`.

```json
{
  "success": true,
  "data": [
    {
      "entity": {
        "id": "online-world-chess-lovers",
        "name": "Online World Chess Lovers",
        "description": "**Jai Jagannath**\n![](https://i.imgur.com/cI66TY6.jpeg)\n**Top 3rd Team In World**\n![](https://i.imgur.com/2R1xWvI.jpeg)\n**GP Chess Promotion**\n@gouravprithyani\nhttps://wa.me/918871232674\n**Join Whatsapp Group**\nhttps://chat.whatsapp.com/KNKv4r6LH4o3HgiQCefvcI\n-\nIf any team want to do friendly battle with our team.Text at @gouravprithyani\n_\nIf you have lichess team having 200+ Members.Text @gouravprithyani for mutual Benefit.\n-\n![](https://i.imgur.com/qfc8WxC.gif)\n1) @arjun2284 (Peak Fide 2284)\nhttps://wa.me/917550101232\n2) @Bseven (Fide 1664)\nhttps://wa.me/918547684425\n3)\nAdd your name as a Coach, @gouravprithyani\n-\n![](https://i.imgur.com/8j5xfS4.gif)\n1) https://lichess.org/tournament/Neu0njbA (Mega Cash Tmt)\n2) https://lichess.org/swiss/CDuv9c2a (14 sept)\n3) https://lichess.org/tournament/rPXBLdPv (20 October)\nMore Will be update soon.\n---\n![](https://i.imgur.com/QwGRCZB.gif) [Daily Cash Qualifiers](https://lichess.org/team/online-world-chess-lovers/tournaments) **Join in advance for good competition**\n-\n![](https://i.imgur.com/HHjENNS.gif)\n1. [Chess City Team](https://lichess.org/team/chess-city-team)\n2. [Chess Champions (Never Give Up)](https://lichess.org/team/chess-champions-never-give-up)\n3. [Chess Army](https://lichess.org/team/chess-army-og)\n\n---\n**Join Our Special Team** https://lichess.org/team/chess-city-team\n________________________________________\n**Daily Team Battles**\nhttps://lichess.org/team/chess-city-team/tournaments\n-\nWe frequently Conduct Free Cash Prize ",
        "stats": {
          "members": 46115
        }
      },
      "author": {
        "id": "yogesh02005",
        "username": "Yogesh02005"
      }
    },
    {
      "entity": {
        "id": "bengal-tiger",
        "name": "Bengal tiger",
        "description": "Dear reader,\r\nOn a daily basis we organize 7 online chess tournaments. Based on Swiss form.\r\nTournaments are further time & types :-\r\n8:00 am IST= 2:30 am GMT (7 min+2 sec) 7 rounds\r\n11:00 am IST = 5:30 am GMT (10min+0 sec) 7 rounds\r\n2:00 pm IST=8:30 am GMT (7 min +2 sec) 7 rounds\r\n5:00 pm IST = 11:30 am GMT (5 min+2 sec) 7 rounds\r\n8:00 pm IST =2:30 pm GMT (3 min +2 sec) 7 rounds\r\n10:30 pm IST =5:00 pm GMT (1 min+1 sec) 11 rounds\r\n11:30 pm IST =6:00pm GMT (15 min+5 sec) 5 rounds\r\nThe participation is and will continue beyond any national or geographical border. This team was established in India on 19/04/2020. You are just a click away from your contribution to the game you love, the chess.\r\n------------x-----------",
        "stats": {
          "members": 33069
        }
      },
      "author": {
        "id": "bipulb",
        "username": "Bipulb"
      }
    }
  ],
  "metadata": {
    "platform": "lichess",
    "endpoint": "team_search",
    "cached": false,
    "stale": false,
    "age_s": 0,
    "fetched_at": "2026-01-01T12:00:00+00:00",
    "credits_charged": 5,
    "request_id": "7f3a9c2e5b1d4c8fa2e6d0b9c4f18e37"
  },
  "error": null
}
```

## Field mapping

How this endpoint's source fields become Onekey's [unified schema](https://onekey.dev/docs/schema.md). Fields the source lacks come back as `null`.

| Source path | Onekey field | Transform |
| --- | --- | --- |
| `id` | `entity.id` | - |
| `name` | `entity.name` | - |
| `description` | `entity.description` | - |
| `nbMembers` | `entity.stats.members` | `toNumber` |
| `leader.id` | `author.id` | - |
| `leader.name` | `author.username` | - |

## Caching and freshness

- Fresh for about 2 minutes. Repeat calls in that window are served from cache and are free.
- Between 2 minutes and 15 minutes the cached copy is still served instantly and marked `stale: true` while Onekey refreshes it in the background.
- If the source is down when a refresh is needed, the last copy can be served for up to 1 hour more (marked stale).
- A "not found" is remembered for 1 minute and is free.
- The cache is shared across all customers, which is what keeps repeat calls cheap.

## What can go wrong

| Status | Code | What to do |
| --- | --- | --- |
| 401 | `unauthorized` | Check the `x-api-key` header. |
| 402 | `insufficient_credits` | [Add credits](https://onekey.dev/pricing); your balance must cover the price. |
| 404 | `not_found` | Unknown endpoint path. |
| 422 | `invalid_params` | Fix the parameters using the table above. Free. |
| 429 | `rate_limited` | Wait `Retry-After` seconds, then retry. |
| 502 | `upstream_error` | The source failed. Refunded; retry with backoff. |

See [Errors](https://onekey.dev/docs/errors.md) for the full list and retry guidance.

Status: stable (verified against the live source).
