Laws.Africa Legal Knowledge Platform commandline tool
# Laws.Africa CLI
`lawsafrica` is a command-line client for the Laws.Africa Legal Knowledge Platform.
This CLI covers the Legislation Content API and Knowledge Base API. It is designed for AI agents and shell automation:
API responses are emitted as raw JSON on standard output, while diagnostics go to standard error.
## Get started
Create a free account at platform.laws.africa,
then create an API key in the API keys page.
Install the CLI from PyPI with pip:
```sh
python -m pip install --upgrade lawsafrica-cli
```
Or run it without installing anything permanently, using uv:
```sh
uvx --from lawsafrica-cli lawsafrica --help
```
Set the API key in your shell before making API requests:
```sh
export LAWSAFRICA_API_KEY='your-api-key'
lawsafrica --help
```
With `uvx`, the same command is:
```sh
uvx --from lawsafrica-cli lawsafrica places list
```
Run `lawsafrica docs` for a short explanation of works, expressions, FRBR URIs, and links to the official developer
documentation. Command-group help also links to the relevant API reference.
## Places
Places are shared by the legislation and Knowledge Base APIs. List them to find a country or locality code, then pass it
as `--place` when listing legislation expressions or as `--frbr-place` when retrieving Knowledge Base passages:
```sh
lawsafrica places list
lawsafrica places get za-cpt
```
## Legislation
All Content API commands are under `lawsafrica legislation`. The API resolves a work FRBR URI to its current expression
where necessary, but the CLI calls the returned resources expressions.
List commands fetch one page by default. For a quick count, ask for one result and use the API's `count` field. Use
`--all` only when the whole result set is needed; it follows every API-supplied pagination link.
```sh
lawsafrica legislation expressions list --place za-cpt --page-size 1
lawsafrica legislation expressions list --place za-cpt --uncommenced --page-size 1
lawsafrica legislation expressions list --place za- …