API documentation
Plans and API keysQuickstart
- Choose a monthly data plan and complete checkout.
- Create and copy a key under Your API keys. Copy new keys before leaving this page. Full keys are shown only when created.
- Replace the placeholder below with your key and make a request.
export MATHDB_API_KEY='YOUR_MATHDB_KEY'
curl 'https://mathdb.com/api/data/problems?limit=2' \
-H "Authorization: Bearer $MATHDB_API_KEY"List responses contain an items array and a next_cursor. A null cursor means you have reached the end.
Authentication
Send Authorization: Bearer YOUR_MATHDB_KEY with every data API request. Keys start with mdb_ and grant read-only data access while your subscription is active.
Keep keys in server-side environment variables, never in browser code or public repositories. Revoke a key from your account if it is exposed. Each Business teammate uses their own login and keys.
Endpoint reference
All paths below are relative to https://mathdb.com. Responses use JSON.
/api/data/problemsList problems
Ordered by problem number. Optional parameters: limit (1–100, default 100), after (last problem number, default 0), and q (title search, up to 200 characters). Returns items and next_cursor.
/api/data/problems/{number}Get a problem
Use the numeric problem number, not its UUID. Returns id, number, title, statement, post_type, status, references, source_name, source_url, created_at, author, and tags. List items contain the same fields except tags.
/api/data/problems/{number}/solutionsList solutions
Supports limit and after, where after is the last solution number within this problem. Returns items and next_cursor. Each item contains number, kind, summary, body, created_at, and author.
/api/datasetsBrowse snapshots
Public catalog; no key required. Returns snapshots with id, label, record_count, size_bytes, sha256, terms, and format, plus the sales_enabled flag.
/api/data/snapshots/{snapshot_id}/downloadGet a download link
Requires your API key. Use a snapshot UUID from the catalog. No request body. Returns url, sha256, and expires_at (Unix seconds).
Verify a Lean proof
Submit a problem description and a Lean proof file containing the theorem it proves. MathDB uses Jiaxin’s MathDB-Lean evaluator: MathDB extracts the selected theorem using the evaluator’s scanner, Claude checks that it matches the description, and Lean verifies the proof. Both checks must pass. Use your existing Individual or Business subscription API key.
/api/lean/v1/formatsGet an example prose-and-proof request.
/api/lean/v1/proofs/formatCheck the shape of your request without running Lean or the LLM. This does not verify correctness.
/api/lean/v1/proofsCheck the theorem in your Lean proof against its prose description with Claude, then verify the proof with Lean. Returns HTTP 202 with an id and poll_url.
/api/lean/v1/jobs/{id}Poll your check. Status is queued, running, completed, or failed. Completed results include verdict, message, and fix.
import os
import time
from pathlib import Path
import requests
base = "https://mathdb.com"
headers = {"Authorization": f"Bearer {os.environ['MATHDB_API_KEY']}"}
response = requests.post(f"{base}/api/lean/v1/proofs", headers=headers, json={
"submission": Path("proof.lean").read_text(encoding="utf-8"),
"prose": Path("problem.txt").read_text(encoding="utf-8"),
}, timeout=30)
response.raise_for_status()
job = response.json()
deadline = time.monotonic() + 2100
while job["status"] in ("queued", "running"):
if time.monotonic() > deadline:
raise TimeoutError("Save the job ID and check it again later.")
time.sleep(5)
response = requests.get(base + job["poll_url"], headers=headers, timeout=30)
response.raise_for_status()
job = response.json()
print(job["result"] if job["status"] == "completed" else job["error"])curl 'https://mathdb.com/api/lean/v1/formats' \
-H "Authorization: Bearer $MATHDB_API_KEY"Send file contents as JSON strings, rather than GitHub URLs or folders. No separate statement file or MathDB problem ID is needed. If your proof file contains multiple theorems, add theorem with the fully qualified name to check. The LLM assessment can be wrong, and an inconclusive result is not a pass. Results include separate faithfulness and proof records. A completed job means a result is available, not that the proof was accepted or a prize was awarded. MathDB’s website verifies submissions against its saved statements internally, without an LLM; that workflow is not a public API endpoint.
Each source is limited to 200,000 UTF-8 bytes. You can submit five checks per ten minutes and keep two in flight per account; additional keys do not increase these limits. Format checks allow 30 requests per minute, and polling allows 60. Checks have a maximum Lean timeout of 900 seconds, with additional time for worker startup. HTTP 503 means the worker or judge is unavailable. Revoking a key, ending subscription access, or removing Business team membership immediately stops access through that key.
Read the next page
Pass the returned next_cursor as after on your next request. Keep your filters unchanged, and stop when the cursor is null. Each page contains at most 100 records.
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['MATHDB_API_KEY']}"}
after = 0
while True:
response = requests.get(
"https://mathdb.com/api/data/problems",
headers=headers,
params={"after": after, "limit": 100},
timeout=30,
)
response.raise_for_status()
page = response.json()
for problem in page["items"]:
print(problem["number"], problem["title"])
after = page["next_cursor"]
if after is None:
breakDataset downloads
For bulk analysis, choose a snapshot from GET /api/datasets, then request its download link. Links expire after five minutes; request another if needed. Verify the file against the returned SHA-256 checksum.
curl -X POST 'https://mathdb.com/api/data/snapshots/SNAPSHOT_ID/download' \
-H "Authorization: Bearer $MATHDB_API_KEY"Each ZIP includes problems.jsonl, solutions.jsonl, tags.jsonl, manifest.json, and TERMS.txt. Read the snapshot terms and retain source attribution. Private account data, messages, embeddings, and attachments are excluded.
Limits & errors
Both paid plans have no daily or monthly data quota. A shared speed limit of 600 API requests per minute per user protects availability. Multiple keys do not increase that limit.
| Status | Meaning | What to do |
|---|---|---|
401 | Missing, invalid, or revoked key | Check your Authorization header or create a new key. |
403 | No active data access | Check subscription status or team membership. |
404 | Problem or snapshot not found | Check the problem number or published snapshot ID. |
422 | Invalid request parameters | Check parameter types, lengths, and limits. |
429 | Too many requests | Pause and retry with backoff. |
Non-success responses include a detail field. Handle errors before processing a response as data.