Integration Guide
REST API
A FastAPI backend that exposes Mithril's trust-scoring, admission gating, and audit trail over standard HTTP endpoints. Powers the dashboard and can be used by any HTTP client.
Quick Start
Start the API server
make api
# Windows Makefile runs: .venv\Scripts\python.exe -m uvicorn api.main:app --port 8000 --reload
# macOS / Linux / WSL
python -m uvicorn api.main:app --port 8000 --reloadThe server runs at http://localhost:8000. Interactive docs are available at /docs (Swagger UI).
Submit a memory claim
curl -X POST http://localhost:8000/api/remember \
-H "Content-Type: application/json" \
-d '{
"text": "Passwords must use Argon2id.",
"source": "Security Policy",
"author": "policy_admin"
}'Query verified memory
curl -X POST http://localhost:8000/api/recall \
-H "Content-Type: application/json" \
-d '{"query": "How should we hash passwords?"}'Endpoints
These paths are served by the FastAPI backend on localhost:8000. The Next.js dashboard also exposes proxy routes under /api for the UI; use the FastAPI URL directly when calling /api/quarantine.
/api/rememberSubmit a memory claim through the trust gate/api/recallQuery verified memory only/api/auditFull audit trail of all evaluated claims/api/quarantineList quarantined / rejected claims/api/reputationLive source reputation scores/api/statsAggregate dashboard metrics/api/configCurrent scoring weights and thresholds/api/resetClear all Cognee memory and audit stores/api/healthHealth checkPOST /api/remember
Submit a text claim for trust scoring and conditional storage into Cognee. Returns the admission decision, serialized trust-score breakdown, and any secrets that were redacted.
Request Body
| Parameter | Type | Description |
|---|---|---|
text | string | The memory claim to evaluate (min 1 character). |
source | string | Channel / origin — e.g. "Slack", "Security Policy", "AI Agent". |
author | string | Who submitted the claim. Defaults to "demo_user". |
Example Response
{
"text": "Argon2id with cost factor 12 is now mandatory.",
"source": "Security Policy",
"author": "policy_admin",
"status": "accept",
"trust_score": 0.89,
"decision_reason": "Score 0.89 meets acceptance threshold (≥ 0.85)",
"trust_breakdown": {
"source_reputation": 0.98,
"contradiction_penalty": 0.0,
"corroboration_bonus": 0.1,
"freshness_bonus": 0.05,
"source_component": 0.392,
"corroboration_component": 0.025,
"freshness_component": 0.0025,
"contradiction_component": 0.0,
"raw_weighted_score": 0.4195,
"final_score": 0.89,
"reasons": [
"Source 'Security Policy' live reputation: 0.98",
"No contradictions found in verified memory",
"Corroborated by 1 other source(s)",
"Weighted sum: 0.42 (source 0.39, corroboration +0.03, freshness +0.00, contradiction -0.00, content_danger -0.00)",
"Normalized trust score: 0.89 (÷ 0.47 max theoretical)"
]
},
"reasons": ["..."],
"redacted_secrets": [],
"entered_cognee": true,
"cognee_dataset": "verified_memories",
"timestamp": "2026-07-05T00:00:00+00:00"
}POST /api/recall
Answers a natural-language question using only claims that passed the trust gate. Blocked / quarantined data is automatically excluded.
| Parameter | Type | Description |
|---|---|---|
query | string | The question to answer from verified memory. |
{
"query": "How should we hash passwords?",
"answer": "Passwords must be hashed using Argon2id with a minimum cost factor of 12.",
"candidate_count": 3,
"blocked_count": 2
}Admission Statuses
accept (≥ 0.85)
warn (≥ 0.60)
review (≥ 0.40)
quarantine (≥ 0.20)
reject (< 0.20)
Default Source Reputation
Each source starts with a prior reputation. Scores adapt over time as claims from that source are accepted or blocked.
| Source | Prior Score |
|---|---|
| Security Policy | 0.98 |
| HR System | 0.95 |
| Official Docs | 0.95 |
| GitHub PR | 0.90 |
| Jira | 0.85 |
| Engineering Blog | 0.80 |
| Internal Wiki | 0.75 |
| Slack | 0.60 |
| 0.55 | |
| Customer Support | 0.50 |
| AI Agent | 0.40 |
| External Email | 0.40 |
| Unknown Agent | 0.30 |
| Public Web | 0.25 |
| Untrusted | 0.10 |