# Knowledge Bases

## What are Knowledge Bases?

A Knowledge Base (KB) is a database of legal information. You can use the **retrieve** API to query the Knowledge Base for items of legal data that match a query, such as legislation and court judgments. You can then use the returned information in your application, such as in a [RAG](https://en.wikipedia.org/wiki/Retrieval-augmented_generation) or LLM agent workflow.

When you use the retrieve API to query the Knowledge Base, Laws.Africa performs a text and semantic search for the best portions of documents that match the query, and returns those portions and related metadata.

Knowledge Bases contain information for a particular region, such as a national, provincial or municipal level.

Explore the documentation to learn how to integrate Knowledge Bases into your application.

{% content-ref url="/pages/hIO37zukBFI9tAb4qxc3" %}
[Types of Knowledge Bases](/ai-api/knowledge-bases/types-of-knowledge-bases.md)
{% endcontent-ref %}

{% content-ref url="/pages/g9e4iS1tVkaGMvYHEIKH" %}
[Using a Knowledge Base](/ai-api/knowledge-bases/using-a-knowledge-base.md)
{% endcontent-ref %}

{% content-ref url="/pages/GxCVmalmkkGrVfvlFuXp" %}
[Query a Knowledge Base](/ai-api/knowledge-bases/query-a-knowledge-base.md)
{% endcontent-ref %}


---

# Agent Instructions: 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/ai-api/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.
