Would you rather talk to Claude than write code? See Connect Claude. Every route and every field is described in the reference.
Create a key and choose its rights
- Once API access is open on your account, an owner or admin sees the Settings › API access tab.
- Click Create a key and give it a name that says what it is for: "n8n monthly reports", "Julie's script"…
- Accessible projects: tick the projects the key may read. If you tick nothing, it reads every project, including the ones you add later.
- What the key can do: reading is always allowed. Tick Edit (recommendations, questions) to change recommendations and questions, and Launch scans to start a scan.
-
The key is shown only once. It starts with
iak_. Copy it straight into your password manager: we only keep a fingerprint and cannot give it back. If you lose it, revoke it and create another one.
A few good habits:
- one key per tool or per person: you can cut one without touching the others (10 active keys at most per account);
- limit a key you hand to someone else to the projects they need;
- a key belongs to the account, not to the person who created it. If that person leaves the agency, their keys keep working: the Created by column helps you find the ones to revoke;
- never put a key in a code repository, a shared document or an e-mail.
Authentication and base URL
Every route starts with:
https://api-back.inspectai.eu/v1/agency
Put the key in the X-API-Key header, or in Authorization: Bearer iak_… if your tool prefers.
Every response has the same shape, {"success": true, "data": …, "message": null}: what you want is
in data. Lists always look like {"total": …, "items": [...]}. Dates are UTC, scores go
from 0 to 100.
For the examples below:
export INSPECTAI_API_KEY="iak_..." # your key
export BASE="https://api-back.inspectai.eu/v1/agency" First call, to check the key works:
curl -s "$BASE/me" -H "X-API-Key: $INSPECTAI_API_KEY" {
"success": true,
"data": {
"tenant": { "name": "Lumière Agency" },
"key": {
"name": "n8n monthly reports",
"key_prefix": "iak_7c41d0e2",
"scopes": ["read"],
"project_ids": [],
"requests_per_minute": 60,
"scans_per_day": 3,
"scans_today": 0,
"expires_at": null
},
"plan": "pro"
},
"message": null
} An empty project_ids means "every project of the account".
In Python, this small helper is used by all the examples. It waits on its own when the API asks to slow down:
import os, time, requests
BASE = "https://api-back.inspectai.eu/v1/agency"
SESSION = requests.Session()
SESSION.headers["X-API-Key"] = os.environ["INSPECTAI_API_KEY"]
def api(method, path, **kwargs):
"""Call the API and return the content of "data"."""
while True:
r = SESSION.request(method, BASE + path, timeout=60, **kwargs)
if r.status_code in (429, 503): # too many requests: wait
time.sleep(int(r.headers.get("Retry-After", "5")))
continue
if r.status_code >= 400:
raise RuntimeError(f"{r.status_code} {r.json().get('detail')}")
return r.json()["data"] Names and ids in the examples are made up.
Examples
1. The monthly report for all your clients
GET /projects gives your clients and their id, used in every other route.
GET /projects/{id}/scores gives the score history, oldest first.
curl -s "$BASE/projects" -H "X-API-Key: $INSPECTAI_API_KEY" # Monthly report: current score and change over 30 days, for each client
for p in api("GET", "/projects")["items"]:
scores = api("GET", f"/projects/{p['id']}/scores", params={"days": 30})["items"]
values = [s["global_score"] for s in scores if s.get("global_score") is not None]
if len(values) >= 2:
print(f"{p['name']:30} {values[-1]:5.0f} ({values[-1] - values[0]:+.0f} over 30 days)")
else:
print(f"{p['name']:30} not enough scores in the period") 2. The questions where your client does not appear
/gaps lists the questions whose answers never name your client, with the businesses named instead.
/prompt-runs then gives the answers themselves, word for word, with their sources. Without
since, only the last 90 days of answers are read.
PROJECT=6f1d2c3a-1111-4a5b-9c8d-000000000001
# Questions where the client does not appear, and who is named instead
curl -s "$BASE/projects/$PROJECT/gaps?days=30" -H "X-API-Key: $INSPECTAI_API_KEY"
# What ChatGPT answered to one of them (prompt_id taken from the previous response)
curl -s "$BASE/projects/$PROJECT/prompt-runs?prompt_id=c9a8b7d6-3333-4e00-9f00-000000000011&platform=chatgpt&limit=3&answer_chars=600" \
-H "X-API-Key: $INSPECTAI_API_KEY" PROJECT = "6f1d2c3a-1111-4a5b-9c8d-000000000001"
gaps = api("GET", f"/projects/{PROJECT}/gaps", params={"days": 30})
for q in gaps["items"][:5]:
names = ", ".join(c["name"] for c in q["competitors"][:3])
print(f"- {q['prompt']}\n named instead: {names}")
runs = api("GET", f"/projects/{PROJECT}/prompt-runs",
params={"prompt_id": q["prompt_id"], "limit": 1, "answer_chars": 300})
for run in runs["items"]:
print(f" {run['platform']}: {run['answer']}")
print(f" sources: {', '.join(run['sources'][:3])}")
In each answer, brand_mentioned says whether your client is named, brand_cited whether its
site is given as a source, and sources lists the cited pages: that is often where you see why a
competitor comes first.
3. Rising competitors
/competitors counts, over the last days days, the answers naming each business, next to
your client's figures. tracked says whether the business is one of the project's tracked competitors.
curl -s "$BASE/projects/$PROJECT/competitors?days=7" -H "X-API-Key: $INSPECTAI_API_KEY" # Every Monday: who is named this week, next to your client
data = api("GET", f"/projects/{PROJECT}/competitors", params={"days": 7})
print(f"{data['brand']['name']}: named in {data['brand']['mentions']} answers")
for c in data["competitors"][:5]:
tracked = "tracked" if c["tracked"] else "new?"
print(f" {c['name']:30} {c['mentions']:3} answers, {c['questions']} questions ({tracked})")
To go further, /competitor-comparison puts your client against three competitors at most: the sites the
AI assistants cite when they name the competitor and not your client, and the differences between the two sites
(pages, text, FAQ, structured data). The "site" part needs a competitor scan
(POST /projects/{id}/competitor-scans, "Launch scans" right), which then runs again on its own
every month.
4. Start a scan and follow it
# Start a full scan (key with the "Launch scans" right)
curl -s -X POST "$BASE/projects/$PROJECT/scans" -H "X-API-Key: $INSPECTAI_API_KEY"
# Follow its status
curl -s "$BASE/projects/$PROJECT/scans" -H "X-API-Key: $INSPECTAI_API_KEY" scan = api("POST", f"/projects/{PROJECT}/scans")
print("Scan started:", scan["id"])
while True:
time.sleep(120) # a scan takes 10 to 40 minutes
latest = next(s for s in api("GET", f"/projects/{PROJECT}/scans")["items"] if s["id"] == scan["id"])
print(latest["status"], latest.get("progress"), "%")
if latest["status"] in ("completed", "failed"):
if latest["error"]:
print("Error:", latest["error"]["message"])
break
Rather than asking for the status every two minutes, you can receive a webhook when the scan
ends. Before showing fresh figures to a client, have a look at /scans: a failed or partial scan often
explains a gap in the data.
5. Recommendations in your task tool
# Open recommendations, most important first
curl -s "$BASE/projects/$PROJECT/recommendations?status=open" -H "X-API-Key: $INSPECTAI_API_KEY"
# Mark one as done (key with the "Edit" right)
curl -s -X PATCH "$BASE/projects/$PROJECT/recommendations/$RECO_ID" \
-H "X-API-Key: $INSPECTAI_API_KEY" -H "Content-Type: application/json" \
-d '{"status": "resolved"}' recos = api("GET", f"/projects/{PROJECT}/recommendations", params={"status": "open"})["items"]
for r in recos:
author = "expert" if r["origin"] == "expert" else "auto"
print(f"[{r['priority']}] ({author}) {r['title']}")
# When the task is done in your tool:
api("PATCH", f"/projects/{PROJECT}/recommendations/{recos[0]['id']}", json={"status": "resolved"}) origin is expert for the actions written by our experts. The statuses are
open, in_progress, resolved (done) and dismissed (not relevant).
Other actions
| Route | Right | What it does |
|---|---|---|
GET /projects/{id}/prompts | Read | the questions asked to the AI assistants, and how many your plan allows |
POST /projects/{id}/prompts | Edit | adds a question, {"text": "Which accountant should I choose in Namur?"}, asked at the next scan |
DELETE /projects/{id}/prompts/{prompt_id} | Edit | stops asking a question; its past answers stay readable |
POST /projects/{id}/content-gaps/{gap_id}/resolve | Edit | marks a missing topic as handled |
Quotas and limits
- 60 requests per minute per key. Above that, the API answers
429with aRetry-Afterheader (in seconds). For a monthly report it is plenty; just avoid tight loops. - 30 attempts with a wrong key per minute from one IP address. Above that, even a good key gets
429from that address until the next minute. - Scans: 3 per day by default for the whole account, midnight to midnight UTC. All your keys count
together, revoked ones included, and so do the scans started by Claude: a second key does not give more scans. A
failed scan does not count. Your plan's limits apply on top.
GET /megivesscans_per_dayandscans_today. - A scan already running on the project blocks the next one (
409 scan_already_running). - A question is 5 to 500 characters long.
- AI answers: 500 at most per call (
limit), 20,000 characters at most per answer (answer_chars). Histories go back 365 days at most (days). - 5 webhooks at most per key.
Error codes
An error response looks like this:
{ "detail": { "error": "insufficient_scope", "required": "scan" } } | Status | Code | What it means | What to do |
|---|---|---|---|
| 401 | invalid_api_key | key missing, unknown, revoked or expired (we never say which) | check the header; otherwise create a new key |
| 403 | api_access_disabled | API access is not (or no longer) open on the account, or the paid subscription stopped | check the subscription; otherwise write to us |
| 403 | insufficient_scope | the key lacks the right needed (required says which) | create a key with that right |
| 403 | feature_not_in_plan | competitor comparison is not in your plan | see the account's plan |
| 404 | project_not_found | unknown project, another account's, or outside the key's allowed projects | take the id from /projects |
| 404 | prompt_not_found, recommendation_not_found, gap_not_found, webhook_not_found | unknown item, or one that belongs to another project (or another key for a webhook) | take the id from the matching list |
| 409 | scan_already_running | a scan is already running on this project, or another scan of the account is starting at the same moment | wait for the end, or retry a few seconds later |
| 409 | scan_quota_exceeded | today's API scans are used up | retry tomorrow (UTC) |
| 409 | plan_limit_reached | the plan allows no more scans this period | see the account's plan |
| 409 | scan_not_possible | the project has no domain to scan | add a domain in the app |
| 409 | no_competitor_to_compare | no confirmed or AI-cited competitor with a known site | confirm competitors in the project |
| 409 | prompt_limit_reached, duplicate_prompt | too many questions for the plan, or question already asked | remove a question, or do nothing |
| 409 | webhook_limit_reached | already 5 webhooks on this key | delete one |
| 422 | invalid_request | invalid parameter or body; fields gives each field and the reason | fix what is listed |
| 422 | invalid_prompt | question too short, too long, or with a null character | fix the question |
| 422 | invalid_url | webhook address refused (message says why) | give a public https address |
| 429 | rate_limited | too many requests, or too many attempts with a wrong key | wait Retry-After seconds |
| 503 | service_busy | the API is very busy; your request was not processed | wait Retry-After seconds, then send it again as is |
| 5xx | — | a problem on our side | retry in a few minutes, then tell us |
When a scan failed, /scans also gives a readable error: site_unreachable,
site_blocked_bot_protection, ai_platform_unavailable, timeout,
interrupted_by_restart (resumed automatically), cancelled, quota_exceeded or
internal_error.
Webhooks
Rather than asking every hour whether a scan is done, give us an address: we call it when something happens on one of your projects. You need a key with the Edit right. Webhooks never go through Claude, only through a key.
curl -s -X POST "$BASE/webhooks" \
-H "X-API-Key: $INSPECTAI_API_KEY" -H "Content-Type: application/json" \
-d '{"url": "https://your-tool.example/inspectai", "events": ["scan.completed", "scan.failed", "score.dropped"]}' | Event | When |
|---|---|
scan.completed | a full scan is finished, even if some steps failed |
scan.failed | a full scan failed |
score.dropped | after a scan, the global score lost 5 points or more |
The address must be https, on port 443, 500 characters at most and reachable on the Internet (no IP
address, no internal network). The webhook receives the events of the projects the key can read.
GET /webhooks lists them, DELETE /webhooks/{id} deletes one. You also see them, and can
delete them, in Settings › API access › Webhooks.
Example of a message you receive:
{
"id": "…",
"event": "score.dropped",
"created_at": "2026-10-28T06:40:12+00:00",
"project_id": "6f1d2c3a-1111-4a5b-9c8d-000000000001",
"project_name": "Dupont Bakery",
"scan": { "id": "…", "type": "full_scan", "status": "completed", "progress": 100, "error": null },
"score": { "previous": 61.0, "current": 54.0 }
} Check the signature
The creation response contains a secret. Write it down straight away: it is shown only
once. Every call carries two headers:
X-InspectAI-Timestamp: the time of sending, in seconds since 1970;X-InspectAI-Signature: sha256=…: an HMAC-SHA256, computed with the secret, of the time, a dot, then the exact request body.
Check both before trusting the message, and refuse a message older than 5 minutes: someone who copied an old call cannot replay it. Use the body exactly as received, before parsing it as JSON: one extra space changes the signature.
Python
import hashlib, hmac, time
def signature_ok(raw_body: bytes, timestamp: str, signature: str, secret: str) -> bool:
"""raw_body: the body as received, before parsing it as JSON.
timestamp: the X-InspectAI-Timestamp header. signature: X-InspectAI-Signature."""
if abs(time.time() - int(timestamp)) > 5 * 60:
return False # too old: maybe a replayed call
message = timestamp.encode() + b"." + raw_body
expected = "sha256=" + hmac.new(secret.encode(), message, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature)
# Example with Flask
from flask import Flask, request, abort
app = Flask(__name__)
@app.post("/inspectai")
def receive():
if not signature_ok(request.get_data(), request.headers.get("X-InspectAI-Timestamp", "0"),
request.headers.get("X-InspectAI-Signature", ""), SECRET):
abort(401)
event = request.get_json()
# skip an id you already handled: retries keep the same id
return "", 204 Node.js
import crypto from 'node:crypto';
import express from 'express';
function signatureOk(rawBody, timestamp, signature, secret) {
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 5 * 60) return false; // too old
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(`${timestamp}.`)
.update(rawBody)
.digest('hex');
const a = Buffer.from(expected);
const b = Buffer.from(signature ?? '');
return a.length === b.length && crypto.timingSafeEqual(a, b);
}
const app = express();
// express.raw keeps the body untouched: needed for the signature
app.post('/inspectai', express.raw({ type: 'application/json' }), (req, res) => {
const ok = signatureOk(req.body, req.get('X-InspectAI-Timestamp'), req.get('X-InspectAI-Signature'), process.env.INSPECTAI_WEBHOOK_SECRET);
if (!ok) return res.sendStatus(401);
const event = JSON.parse(req.body.toString('utf8'));
res.sendStatus(204);
}); Answering and retries
- Answer with any
2xxcode, quickly: we wait 10 seconds at most and do not follow redirects. - Otherwise we retry three times: after 1, 5 and then 30 minutes, with the same
id. - That
idonly depends on the scan, the event and the webhook. Use it to skip duplicates. - After 10 failed events in a row, the webhook is turned off (
active: false). Delete it and create it again once your address is fixed.
Local MCP server with a key
If you cannot use the Claude connector, or want to plug in another MCP client, there is
an MCP server that runs on your computer with an iak_ key. It is not published online yet:
write to us to get it. It needs Python 3.11 or
newer and uv.
Claude Desktop: add this to the claude_desktop_config.json file, then restart Claude.
{
"mcpServers": {
"inspectai": {
"command": "uvx",
"args": ["--from", "/path/to/inspectai-agency-mcp", "inspectai-agency-mcp"],
"env": { "INSPECTAI_API_KEY": "iak_..." }
}
}
} Claude Code:
claude mcp add inspectai --env INSPECTAI_API_KEY=iak_... \
-- uvx --from /path/to/inspectai-agency-mcp inspectai-agency-mcp - The server creates one tool per API route, with the same name as in the reference (
list_projects,get_prompt_runs,get_competitors…), plus thecompetitor_briefprompt. - By default it only reads. Add
--allow-writeafterinspectai-agency-mcpto allow edits and scans, with a key that has those rights. - Webhooks are never offered as tools.
- The key stays on your computer: the server writes it nowhere and never sends it back to Claude.