Quickstart
On this page
Call Marvnor directly from your own application: save a fact, verify it, then delete the test record. No Marvnor client download or SDK is required.
No-code setup? Use Connect an AI tool; see LLM integration. The example below calls the API directly.
API reference · Edit and delete records · LLM integration
1. Prepare your API key
Sign in to the customer portal, create and copy an API key, and check your available quota. Use MARVNOR_API_TOKEN consistently. Do not send the key to an LLM or put it in browser-side code.
Windows PowerShell:
$env:MARVNOR_API_TOKEN = [System.Net.NetworkCredential]::new('', (Read-Host 'Marvnor API Key' -AsSecureString)).PasswordBash on macOS / Linux (if using zsh, run bash first):
read -r -s -p 'Marvnor API Key: ' MARVNOR_API_TOKEN
export MARVNOR_API_TOKEN
printf '\n'Run the next step in the same terminal. The variable lasts only for that terminal and programs launched from it. Python 3 is required, with no third-party packages. You can also skip the variable and paste the key at the script's hidden-input prompt.
2. Run the example
Save this code as marvnor_demo.py. On Windows, run py -3 marvnor_demo.py; on macOS / Linux, run python3 marvnor_demo.py. It generates a small amount of real API usage. It deletes only its newly created demonstration record, never all memory.
import getpass
import json
import os
import urllib.error
import urllib.request
import uuid
BASE_URL = "https://api.marvnor.com"
API_KEY = os.environ.get("MARVNOR_API_TOKEN") or getpass.getpass("Marvnor API Key: ")
def request(method, path, payload=None):
body = None if payload is None else json.dumps(payload, ensure_ascii=False).encode("utf-8")
req = urllib.request.Request(
BASE_URL + path,
data=body,
method=method,
headers={
"Authorization": "Bearer " + API_KEY,
"Content-Type": "application/json",
},
)
try:
with urllib.request.urlopen(req, timeout=60) as response:
return json.load(response)
except urllib.error.HTTPError as error:
raise SystemExit(f"HTTP {error.code} ({path}): see the error guide below.") from None
except (urllib.error.URLError, OSError):
raise SystemExit(
f"Network connection failed or timed out ({path}). Check your network, proxy/VPN, "
"and Python TLS certificate settings; do not disable certificate verification. "
"No automatic retry was made. A write may have been saved; keep the test ID for cleanup."
) from None
demo_id = "demo-" + uuid.uuid4().hex
fact = {
"source": demo_id,
"relation": "status",
"target": "paid",
"client_record_id": demo_id,
}
print("Test ID:", demo_id)
written = request("POST", "/v1/relations", {"relations": [fact]})
record_id = written["record_ids"][0]
print("Write succeeded:", written["ok"])
query = {"questions": [{
"id": "check",
"source": demo_id,
"relation": "status",
"target": "paid",
}]}
try:
answer = request("POST", "/v1/evaluate", query)["answers"]["check"]
print("Verification result:", json.dumps(answer, ensure_ascii=False))
finally:
deleted = request("POST", "/v1/relations/delete", {"record_ids": [record_id]})
print("Test records deleted:", deleted["deleted_count"])
after = request("POST", "/v1/evaluate", query)["answers"]["check"]
print("After deletion:", after["conclusion"])3. Check the result
Normally, verification after the write returns TRUE with conflict: false; deletion removes 1 record; verification after deletion returns UNKNOWN. Each answer has exactly six fields: conclusion, conflict, reason, path, decision, and evidence_kind.
If the write times out, the record may already have been saved. Use the printed test ID to delete by your own record ID. Do not clear the entire key's memory.
401: check that the key is valid.402: check your available quota.400: check fields against the API reference.429: wait for the response'sRetry-Afterinterval.5xx: a temporary service error; check whether the write succeeded before resubmitting.UNKNOWN: check naming, key, context, and time. Do not treat it as a negative conclusion.conflict: true: check the conflicting values; do not let the LLM arbitrarily select one.
For connection errors, check that this computer can open the API docs, then check that the proxy selected by your system or HTTP_PROXY / HTTPS_PROXY is running. A working browser does not prove Python uses the same proxy or certificates. For TLS errors, check the system clock and Python's trusted certificates; do not disable HTTPS verification. If the issue persists, send support the error code, failing step, and test ID, never your key.
This completes the smallest working flow. For a production integration, keep a mapping between original facts, record receipts, and sources in your own system. Follow the LLM integration guide to send only the current question and relevant results to your model.