# Knowledge Bases

A Knowledge Base is a searchable legal collection for a place and content type, such as national legislation, municipal by-laws or court judgments.

Use Knowledge Bases when your application needs relevant legal context but does not need to store and maintain full legal collections itself. They are the fastest way to build legal AI assistants, RAG systems, legal agents, semantic search and workflow tools grounded in African legal information.

When you query a Knowledge Base, Laws.Africa runs text and semantic search over maintained legal collections and returns the best matching results with:

* legal text or summaries;
* source metadata;
* public URLs for inspection and citation;
* a match score.

## What you can build

Knowledge Bases are useful for:

* grounding legal AI answers in maintained sources;
* retrieving legal context for RAG pipelines;
* powering semantic legislation or judgment search;
* giving agents a legal retrieval tool;
* triaging legal research questions before deeper review.

## Start here

{% content-ref url="/pages/Ve6UZgqLViJNXjOUepzQ" %}
[Quick start](/knowledge-bases/quick-start.md)
{% endcontent-ref %}

{% content-ref url="/pages/6dd6jVz8PAtbwflboS9p" %}
[Concepts](/knowledge-bases/concepts.md)
{% endcontent-ref %}

{% content-ref url="/pages/DXCgAZHCYu0EFLvHNfbv" %}
[Use results in your app](/knowledge-bases/use-in-apps.md)
{% endcontent-ref %}

## API endpoint

Knowledge Bases are available at:

```
https://api.laws.africa/ai/v1/knowledge-bases
```

The Knowledge Base retrieve endpoint is:

```
POST https://api.laws.africa/ai/v1/knowledge-bases/{code}/retrieve
```

See the [reference](/knowledge-bases/reference.md) for endpoint details.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.laws.africa/knowledge-bases/knowledge-bases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
