> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/tools/mariadb-ai-rag/reference/integration.md).

# Integration

## External Systems

MariaDB AI RAG can be integrated with external systems through its REST API. Common integration patterns include:

* **Document Management Systems**: Automatically ingest documents from DMS platforms using the document ingestion endpoints
* **Knowledge Bases**: Enhance existing knowledge bases with AI-powered search via the retrieval endpoints
* **Customer Support Systems**: Integrate with ticketing systems for AI-assisted responses using the orchestration pipeline
* **Business Intelligence Tools**: Connect BI tools for natural language querying of data through the API

Example integration with a document management system:

```python
import requests
import json

# Authenticate
auth_response = requests.post(
    "http://localhost:8000/token",
    data={"username": "user@example.com", "password": "secure_password"}
)
token = auth_response.json()["access_token"]

# Upload document
with open("document.pdf", "rb") as f:
    files = {"file": ("document.pdf", f, "application/pdf")}
    headers = {"Authorization": f"Bearer {token}"}
    response = requests.post(
        "http://localhost:8000/documents/ingest",
        files=files,
        headers=headers
    )

document_id = response.json()["id"]

# Process document
chunking_response = requests.post(
    "http://localhost:8000/chunks/document",
    json={"document_id": document_id},
    headers={"Authorization": f"Bearer {token}"}
)
```

## Authentication Integration

MariaDB AI RAG uses JWT-based authentication. The system can be integrated with existing authentication systems by implementing custom authentication middleware.

```
# JWT Authentication settings
SECRET_KEY=your_secure_random_string
ACCESS_TOKEN_EXPIRE_MINUTES=60
```

<sub>*This page is: Copyright © 2025 MariaDB. All rights reserved.*</sub>

{% @marketo/form formId="4316" %}


---

# 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, and the optional `goal` query parameter:

```
GET https://mariadb.com/docs/tools/mariadb-ai-rag/reference/integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
