Command line

sportsapi CLI

Every endpoint from your terminal, with table, CSV and JSON output, paging in one flag and a live watch of any WebSocket channel.

Not published yet: the install lines go live with the first release.

Install

One package, no setup beyond your API key.

Shell
$ go install github.com/sportsapiapp/sportsapi-go/cmd/sportsapi@latest
# or a release binary (macOS, Linux)
$ curl -fsSL https://raw.githubusercontent.com/sportsapiapp/sportsapi-go/main/install.sh | sh

Sign in

The key is checked with one call and kept in the OS keychain. --api-key and SPORTSAPI_API_KEY win over it.

Shell
$ sportsapi login     # checks the key with one call, keeps it in the OS keychain
$ sportsapi logout    # forgets it

Call any endpoint

sportsapi <group> <action> exists for every endpoint: path parameters as arguments, query parameters as flags.

Shell
$ sportsapi livescores list --sport football -o table
$ sportsapi fixtures lineups 237609
$ sportsapi leagues standings 17 --season 61627 -o csv
$ sportsapi search query messi --fields id,type,name -o table

Output

JSON by default; table, CSV and JSON lines for the rows of data. --all walks every page.

Shell
$ sportsapi teams fixtures 42 --type recent --all -o jsonl
# -o json (the envelope, default) | jsonl | table | csv
# --fields a,b.c   --raw   --all (+ --max-pages)

Watch live

Any WebSocket channel as JSON lines, or the merged state after each change (Business).

Shell
$ sportsapi watch livescores sport:tennis          # frames as JSON lines
$ sportsapi watch fixture:237609 --state           # the merged fixture after each change
Every endpoint, with this SDK's call on each page→