# Make your first call

> Search the catalog, read one game and show its cover, in three requests and no key.

The API is at `https://api.thebgdb.org/v1`. Reading needs no key and no
account. Three calls take you from a name typed with a mistake to a game's
cover on screen.

## 1. Search, with a typo

```sh
curl "https://api.thebgdb.org/v1/search?q=wingspn&limit=2"
```

```json
{
"query": "wingspn",
"total": 2,
"page": 1,
"pages": 1,
"nextCursor": "2",
"data": [
{
"id": "2e8eb86c-73f6-4343-a04a-c546debfd484",
"slug": "wingspan",
"name": "Wingspan",
"yearPublished": 2019,
"players": { "min": 1, "max": 5 },
"thumbnail": "/v1/media/covers/1520…-w250.jpg",
"approximate": true
}
]
}
```

`approximate: true` says the game was found by correcting the query, not
as written. The answer is shortened here: every game in a list carries the
same fields (`GameSummary` in the [reference](https://docs.thebgdb.org/reference/)).

## 2. Read one game

Use the `id` or the `slug`:

```sh
curl "https://api.thebgdb.org/v1/games/wingspan"
```

The answer holds everything the catalog knows about the game: its names in
every language, credits, players, playing time, age, members' ratings and
polls, its covers. A fact nobody knows is `null`, never a guess.

## 3. Show its cover

`image`, `medium` and `thumbnail` are paths on the API. Put the API's
address in front:

```html
<img
  src="https://api.thebgdb.org/v1/media/covers/1520…-w250.jpg"
  width="250"
  alt="Wingspan"
/>
```

Every file is ours: the API never sends another site's address for an
image. See [Show the right cover](https://docs.thebgdb.org/guides/covers-and-credits/).

## In TypeScript and Python

```ts
const base = "https://api.thebgdb.org/v1";
const found = await fetch(`${base}/search?q=${encodeURIComponent("wingspn")}`);
const { data } = await found.json();
const game = await (await fetch(`${base}/games/${data[0].slug}`)).json();
console.log(game.data.name, game.data.yearPublished);
```

```python

base = "https://api.thebgdb.org/v1"
found = requests.get(f"{base}/search", params={"q": "wingspn"}, timeout=10).json()
game = requests.get(f"{base}/games/{found['data'][0]['slug']}", timeout=10).json()
print(game["data"]["name"], game["data"]["yearPublished"])
```

## Next

- [Find a game despite typos](https://docs.thebgdb.org/guides/find-a-game/): search boxes, languages, paging.
- [Limits and caching](https://docs.thebgdb.org/guides/limits-and-caching/): before you go to production.
