# OpenAPI

The API is described by an OpenAPI 3.1 document, generated from the same schemas the API validates
requests with, so the docs and the API can't drift apart.

- On this site: [https://happyfetch.net/openapi.json](https://happyfetch.net/openapi.json)
- From the API itself: `https://api.happyfetch.net/v1/openapi.json`

Each operation carries `x-codeSamples` in cURL, JavaScript and Python. Those are the samples on these pages.

## Generate a client

```bash tab="TypeScript"
npx openapi-typescript https://happyfetch.net/openapi.json -o happyfetch.d.ts
```

```bash tab="Python"
pipx run openapi-python-client generate --url https://happyfetch.net/openapi.json
```

```bash tab="Any language"
npx @openapitools/openapi-generator-cli generate -i https://happyfetch.net/openapi.json -g go -o ./happyfetch
```

## Use it in API tools

Postman, Insomnia and Bruno import the URL directly. Set the `Authorization` header to
`Bearer <your key>` once at the collection level.
