How to connect your own knowledge databases with the moinAI knowledge base
In the moinAI Hub, it is not only possible to store resources such as websites, PDFs or CSV files in the knowledge base, but also to use articles from your own existing knowledge database. The main advantage of linking a knowledge base is that the AI chatbot provides answers based on existing knowledge bases. It is not necessary to maintain the knowledge base separately.
In addition, content is constantly synchronised so that no maintenance of the knowledge base is necessary here either.
Your own knowledge base is connected via an interface. The articles are transferred to the moinAI knowledge base via this interface.
The following section describes how the knowledge base is connected. It also describes how automatic synchronisation works.
Connecting the knowledge database
This technical documentation provides a comprehensive description of how the connection is made.
If you have any questions, please contact the moinAI Customer Success Team.
Automatic synchronisation
It is possible to automatically synchronise content from any source system (CMS, Git repo, etc.) with the moinAI knowledge base. As soon as the original text changes, the same article is either created in moinAI or updated via "PUT" - without any manual "reloading". This synchronisation takes place in five steps.
Procedure in 5 steps
- Recognising a change: Your CMS, Git repo, Google Doc etc. triggers a webhook or CI job as soon as the content has been changed.
- Search for articles:
- API call: GET /knowledge?metadata.externalId=<ID>
- Check for: data[].id, updatedAt
- Create or update:
- If no article was found: `POST /knowledge`
- If article exists: `PUT /knowledge/:id`
- Wait for indexing: Repeat `GET /knowledge/:id` until `status == "active" is returned.
- Handle errors & quotas: 429 (write rate) or 422 (quota) are intercepted and tried again later.
Exmaple (Python 3)
import os, requests, json
API = "https://api.moin.ai/api/v1/knowledge"
HEAD = {
"x-api-key": os.environ["MOIN_API_KEY"],
"Content-Type": "application/json"
}
def sync_article(ext_id: str, title: str, md_body: str, version: int):
"""Legt einen Artikel an oder aktualisiert ihn, falls er schon existiert."""
# 2. Suchen
r = requests.get(API, headers=HEAD,
params={"metadata.externalId": ext_id})
items = r.json().get("data", [])
payload = {
"title": title,
"body": md_body,
"metadata": {
"externalId": ext_id,
"version": version
}
}
if items: # Update
art_id = items[0]["id"]
requests.put(f"{API}/{art_id}", headers=HEAD, json=payload)
else: # Create
requests.post(API, headers=HEAD, json=payload)
Example call
sync_article(
ext_id="SKU-4711",
title="Turbo-Besen 2000 – Handbuch",
md_body="# Turbo-Besen 2000\nNeue Montage-Anleitung …",
version=3
)
Best practices
- Save a unique external ID (e.g. externalId) in the metadata block.
- Send version number or hash to avoid unnecessary uploads.
- Retry back-off at 429 if the write rate is exceeded with increasing waiting time.
- Logging & monitoring: Record status codes and the duration of indexing.
- Rollback strategy: For a version history, delete the old article and create a new one.