API Documentation
Read and manage your account programmatically: profile, credits, AI models, usage, notifications, generation tasks, chats, hosted sites and the Explore Hub.
Quickstart
- Create a key. Open the API Keys page, click Create API Key and copy the secret. It is shown only once.
- Store it safely. Put it in an environment variable named MINDUS_API_KEY. Never commit it and never ship it in a browser or mobile app.
- Make your first call. This request returns the profile that owns the key:
You should receive a response like this:
Authentication
Send your secret key in the Authorization header of every request, using the Bearer scheme. Requests without a valid key receive a 401 error.
Authorization: Bearer mf_your_secret_key
Scopes
Each key has scopes that limit what it can do. Scopes are hierarchical: a higher scope includes the lower ones.
| Scope | Includes | Allows |
|---|---|---|
read | — | Reading your data: profile, credits, models, usage, notifications, tasks, chats, sites, Explore Hub. |
write | read | Creating, renaming and deleting your notifications and chat sessions. |
admin | write, read | Creating and revoking API keys. |
Keep keys secret. A key acts on your behalf. Give each application its own key with the smallest scope it needs, and delete keys you no longer use.
Response format
Every response is a JSON object with a success flag. On success, the payload is in data and context is in meta. On failure, you get an error message and a stable code you can branch on.
{
"success": true,
"data": { "message": "pong" },
"meta": {
"key_id": 5,
"scopes": ["read"],
"user_id": 12,
"request_id": "req_9f3c1a2b7d4e8a01"
}
}{
"success": false,
"error": "Insufficient scopes. Missing: write",
"code": "INSUFFICIENT_SCOPE",
"details": { "required": ["write"], "present": ["read"], "missing": ["write"] },
"request_id": "req_9f3c1a2b7d4e8a01"
}Every response carries an X-Request-Id header, also returned as request_id. Include it when you contact support.
Pagination
List endpoints accept limit (1 to 100, default 20) and offset. The meta.pagination object tells you whether more pages exist.
{ "limit": 20, "offset": 0, "total": 42, "has_more": true }Request the next page by adding limit to offset until has_more is false. See the pagination guide below for a ready-made loop.
Errors
HTTP status codes tell you the category of the problem; the code field tells you exactly what happened.
| HTTP | code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | A parameter is missing or invalid. details.field names it. |
| 400 | INVALID_JSON | The body is not a JSON object. Send Content-Type: application/json. |
| 401 | MISSING_API_KEY | No Authorization header. |
| 401 | INVALID_API_KEY | The key does not exist or was deleted. |
| 403 | KEY_INACTIVE | The key is not active. |
| 403 | INSUFFICIENT_SCOPE | The key lacks a required scope. details.missing lists them. |
| 404 | NOT_FOUND | The resource does not exist or does not belong to you. |
| 405 | METHOD_NOT_ALLOWED | This path does not support that HTTP method. |
| 429 | RATE_LIMITED | Too many requests. Wait Retry-After seconds. |
| 500 | INTERNAL_ERROR | Unexpected server error. Retry with backoff, then contact support with the request_id. |
| 503 | — | Returned by the status endpoint when a dependency is degraded. |
Rate limits
Limits apply per API key over a rolling one-minute window and depend on your plan.
| Plan | Requests per minute |
|---|---|
| Free | 60 |
| Paid plans | 300 |
| VIP | 600 |
Each response reports your quota in three headers:
X-RateLimit-Limit | Requests allowed per minute for this key. |
X-RateLimit-Remaining | Requests left in the current window. |
X-RateLimit-Reset | Unix time at which the oldest counted request leaves the window. |
When you exceed the limit you receive 429 with a Retry-After header. Counters are kept per server process, so treat the limit as approximate and always handle 429 gracefully:
import time, requests
def call(method, url, **kw):
for attempt in range(5):
r = requests.request(method, url, **kw)
if r.status_code != 429:
return r
wait = int(r.headers.get("Retry-After", 2 ** attempt))
time.sleep(wait)
r.raise_for_status()
async function call(url, options = {}) {
for (let attempt = 0; attempt < 5; attempt++) {
const res = await fetch(url, options);
if (res.status !== 429) return res;
const wait = Number(res.headers.get("Retry-After")) || 2 ** attempt;
await new Promise((ok) => setTimeout(ok, wait * 1000));
}
throw new Error("Rate limited");
}
API reference
Generated live from the OpenAPI specification, so it always matches the server. Code samples follow the language you pick.
Guide: follow a task until it finishes
Generation tasks run in the background. Poll the task by its UUID until it has a completion time or a final status.
import os, time, requests
BASE = "__BASE__"
HEADERS = {"Authorization": f"Bearer {os.environ['MINDUS_API_KEY']}"}
def wait_for_task(task_uuid, timeout=300, every=3):
deadline = time.time() + timeout
while time.time() < deadline:
r = requests.get(f"{BASE}/tasks/{task_uuid}", headers=HEADERS)
r.raise_for_status()
task = r.json()["data"]
if task["completed_at"] or task["status"] in ("completed", "failed"):
return task
time.sleep(every)
raise TimeoutError(f"Task {task_uuid} still running after {timeout}s")
const BASE = "__BASE__";
const headers = { Authorization: `Bearer ${process.env.MINDUS_API_KEY}` };
async function waitForTask(taskUuid, timeoutMs = 300000, everyMs = 3000) {
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
const res = await fetch(`${BASE}/tasks/${taskUuid}`, { headers });
const { data } = await res.json();
if (data.completed_at || ["completed", "failed"].includes(data.status)) return data;
await new Promise((ok) => setTimeout(ok, everyMs));
}
throw new Error(`Task ${taskUuid} still running`);
}
Guide: read every page of a list
A generator that walks a list endpoint until has_more is false:
import os, requests
BASE = "__BASE__"
HEADERS = {"Authorization": f"Bearer {os.environ['MINDUS_API_KEY']}"}
def paginate(path, key, **params):
offset = 0
while True:
r = requests.get(f"{BASE}{path}", headers=HEADERS,
params={**params, "limit": 100, "offset": offset})
r.raise_for_status()
body = r.json()
yield from body["data"][key]
page = body["meta"]["pagination"]
if not page["has_more"]:
return
offset += page["limit"]
for task in paginate("/tasks", "tasks", status="completed"):
print(task["project_name"], task["repository_url"])
const BASE = "__BASE__";
const headers = { Authorization: `Bearer ${process.env.MINDUS_API_KEY}` };
async function* paginate(path, key, params = {}) {
let offset = 0;
while (true) {
const qs = new URLSearchParams({ ...params, limit: 100, offset });
const res = await fetch(`${BASE}${path}?${qs}`, { headers });
const body = await res.json();
yield* body.data[key];
if (!body.meta.pagination.has_more) return;
offset += body.meta.pagination.limit;
}
}
for await (const task of paginate("/tasks", "tasks", { status: "completed" })) {
console.log(task.project_name, task.repository_url);
}
Guide: rotate a key without downtime
Use a key with the admin scope to create the replacement, deploy it, then delete the old one. Both keys work during the switch.
import os, requests
BASE = "__BASE__"
admin = {"Authorization": f"Bearer {os.environ['MINDUS_ADMIN_KEY']}"}
# 1. Create the new key (the secret is returned only once)
r = requests.post(f"{BASE}/keys", headers=admin,
json={"name": "CI pipeline (2026-12)", "scopes": ["read", "write"]})
r.raise_for_status()
new_key = r.json()["data"]
print("Store this secret now:", new_key["key"])
# 2. Update your applications to use new_key["key"], then...
# 3. Delete the old key
old_key_id = 5
requests.delete(f"{BASE}/keys/{old_key_id}", headers=admin).raise_for_status()
const BASE = "__BASE__";
const admin = { Authorization: `Bearer ${process.env.MINDUS_ADMIN_KEY}`, "Content-Type": "application/json" };
// 1. Create the new key (the secret is returned only once)
const created = await fetch(`${BASE}/keys`, {
method: "POST", headers: admin,
body: JSON.stringify({ name: "CI pipeline (2026-12)", scopes: ["read", "write"] }),
});
const { data } = await created.json();
console.log("Store this secret now:", data.key);
// 2. Update your applications to use data.key, then...
// 3. Delete the old key
await fetch(`${BASE}/keys/5`, { method: "DELETE", headers: admin });
Guide: back up your chat history
List your sessions, fetch each one with its messages and save everything to a JSON file:
import json, os, requests
BASE = "__BASE__"
HEADERS = {"Authorization": f"Bearer {os.environ['MINDUS_API_KEY']}"}
def get(path, **params):
r = requests.get(f"{BASE}{path}", headers=HEADERS, params=params)
r.raise_for_status()
return r.json()
backup, offset = [], 0
while True:
page = get("/chat/sessions", limit=100, offset=offset)
for s in page["data"]["sessions"]:
full = get(f"/chat/sessions/{s['session_uuid']}", limit=200)["data"]
backup.append(full)
if not page["meta"]["pagination"]["has_more"]:
break
offset += 100
with open("mindus-chats.json", "w", encoding="utf-8") as f:
json.dump(backup, f, ensure_ascii=False, indent=2)
print(f"Saved {len(backup)} conversations")OpenAPI and client generation
The full specification is available at a public URL. Use it to explore the API in Postman or Insomnia, or to generate a typed client in your language.
- Postman — Import, then Link, then paste the openapi.json URL.
- Insomnia — Create, then Import from URL.
- Swagger UI — Point it at the openapi.json URL.
A minimal client
Copy this small wrapper to get authentication, retries on 429 and automatic pagination in one place.
import os, time, requests
class Mindus:
def __init__(self, key=None, base="__BASE__"):
self.base = base
self.http = requests.Session()
self.http.headers["Authorization"] = f"Bearer {key or os.environ['MINDUS_API_KEY']}"
def request(self, method, path, **kw):
for attempt in range(5):
r = self.http.request(method, self.base + path, **kw)
if r.status_code == 429:
time.sleep(int(r.headers.get("Retry-After", 2 ** attempt)))
continue
body = r.json()
if not body["success"]:
raise RuntimeError(f"{body['code']}: {body['error']} ({body.get('request_id')})")
return body
raise RuntimeError("Rate limited")
def get(self, path, **params):
return self.request("GET", path, params=params)
def pages(self, path, key, **params):
offset = 0
while True:
body = self.get(path, limit=100, offset=offset, **params)
yield from body["data"][key]
if not body["meta"]["pagination"]["has_more"]:
return
offset += 100
api = Mindus()
print(api.get("/credits")["data"]["forge_credits"])
export class Mindus {
constructor(key = process.env.MINDUS_API_KEY, base = "__BASE__") {
this.base = base;
this.headers = { Authorization: `Bearer ${key}`, "Content-Type": "application/json" };
}
async request(method, path, { params, body } = {}) {
const url = this.base + path + (params ? "?" + new URLSearchParams(params) : "");
for (let attempt = 0; attempt < 5; attempt++) {
const res = await fetch(url, { method, headers: this.headers, body: body && JSON.stringify(body) });
if (res.status === 429) {
const wait = Number(res.headers.get("Retry-After")) || 2 ** attempt;
await new Promise((ok) => setTimeout(ok, wait * 1000));
continue;
}
const json = await res.json();
if (!json.success) throw new Error(`${json.code}: ${json.error} (${json.request_id})`);
return json;
}
throw new Error("Rate limited");
}
get(path, params) { return this.request("GET", path, { params }); }
}
const api = new Mindus();
console.log((await api.get("/credits")).data.forge_credits);
Changelog
v1.1 — November 2026
- New endpoints: status, key, models, usage, notifications, tasks, chat sessions, sites and Explore Hub search.
- Keys can now be created and revoked through the API with an admin key.
- Per-key rate limits with X-RateLimit headers and Retry-After on 429.
- Every response includes a request id. Scopes are now hierarchical.
- OpenAPI 3 specification published at /api/v1/openapi.json.
v1.0
- First release: ping, me, credits and keys.
FAQ
I lost my secret key. Can I recover it?
No. Only a hash is stored, so the secret cannot be shown again. Create a new key and delete the old one.
Can I call the API from a browser?
Do not. A key in client-side code is visible to everyone. Call the API from your server and expose only the results you need.
Why do I get 403 on a request that worked yesterday?
Check details.missing in the error. The key probably lacks a scope, or it was revoked (KEY_INACTIVE).
Can I start a code generation through the API?
Not yet. Generation is launched from Mindus Forge; the API lets you follow your tasks and sites. Contact support if you need it for your workflow.
Need help? Include the request_id of the failing call and contact support.