Quick start
Make your first Laws.Africa Knowledge Base query.
This guide shows you how to query a Knowledge Base and use the result in an application.
You will:
create a platform account and API token;
list available Knowledge Bases;
query a Knowledge Base;
use the returned legal context in your application.
Create an API token
Sign up at https://platform.laws.africa/.
Get your API token from https://platform.laws.africa/api-keys/.
In the examples below, replace <YOUR_AUTH_TOKEN> with your token.
Knowledge Base retrieve calls count toward your account's Knowledge Base usage limits. You can monitor usage in the platform and read rate-limit guidance in manage your plan and subscription.
List available Knowledge Bases
curl -H "Authorization: Bearer <YOUR_AUTH_TOKEN>" \
https://api.laws.africa/ai/v1/knowledge-basesThe response includes Knowledge Base codes. Use a code in the retrieve endpoint.
Query a legislation Knowledge Base
This example queries the South African municipal legislation Knowledge Base for Cape Town dog ownership rules.
The response contains matching legal portions:
Use Result
The examples below make the same Knowledge Base request and format each result as source-linked context.
Pass this context into your search interface, RAG prompt or agent response with the user's question. Always include source URLs so users can inspect the legal material.
Next steps
Learn the main Knowledge Base concepts.
Apply filters for more precise legislation results.
Use results in RAG, search and agent workflows.
Last updated