API Reference
TheoremSearch exposes a REST API for semantic theorem search, dependency graph exploration, and paper lookup. All endpoints are available at the base URL below.
BASE URL
https://api.theoremsearch.comSearch
Perform semantic search for mathematical theorems. Embeds the query using Qwen3-Embedding-8B, runs HNSW approximate nearest-neighbor search, then reranks by exact cosine similarity with optional citation weighting.
REQUEST BODY
| FIELD | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| query* | string | — | Natural-language description of the mathematical result to find. |
| n_results | integer | 10 | Number of theorems to return. |
| sources | string[] | [] | Filter by source. Options: arXiv, Stacks Project, ProofWiki, CRing Project, HoTT Book, Open Logic Project, An Infinitely Large Napkin. |
| authors | string[] | [] | Filter by author name (partial match). |
| types | string[] | [] | Filter by theorem type, e.g. Theorem, Lemma, Proposition, Corollary. |
| tags | string[] | [] | Filter by primary arXiv category, e.g. math.AG. |
| paper_filter | string | null | null | Filter results to theorems from papers whose title contains this substring. |
| year_range | [int, int] | null | null | Inclusive year range, e.g. [2015, 2023]. |
| citation_range | [int, int] | null | null | Inclusive citation count range, e.g. [10, 500]. |
| include_unknown_citations | boolean | true | When filtering by citation_range, whether to include papers with no citation data. |
| citation_weight | number | 0.0 | Blends ln(citations) into the ranking score. 0 = pure semantic similarity. |
| prompt | string | null | null | Instruction prepended to the query before embedding. Defaults to the built-in search prompt. |
| db_top_k | integer | null | null | ANN candidate pool size before reranking. Higher improves recall at cost of latency. Defaults to 2 × n_results. |
EXAMPLE
curl https://api.theoremsearch.com/search \
-H "Content-Type: application/json" \
-d '{
"query": "smooth DM stack codimension one",
"n_results": 5,
"sources": ["Stacks Project"],
"year_range": [2010, 2024]
}'RESPONSE
{
"theorems": [
{
"slogan_id": 8291,
"theorem_id": 5104,
"name": "Lemma 4.2",
"body": "Let X be a smooth DM stack...",
"slogan": "A smooth DM stack has a dense open subscheme.",
"theorem_type": "Lemma",
"link": "https://stacks.math.columbia.edu/tag/04YC",
"similarity": 0.871,
"score": 0.871,
"paper": {
"source": "Stacks Project",
"title": "Stacks Project",
"primary_category": "math.AG",
"year": null,
"citations": null,
"journal_published": null
}
}
]
}Graph
Returns the full dependency graph for a paper, including its formal statements and directed edges.
QUERY PARAMETERS
| FIELD | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| external_id* | string | — | arXiv ID or other external paper identifier, e.g. 2403.05555. |
EXAMPLE
curl "https://api.theoremsearch.com/graph?external_id=2403.05555"RESPONSE
{
"paper": {
"paper_id": "uuid",
"title": "Paper Title",
"external_id": "2403.05555",
"source": "arXiv",
"url": "https://arxiv.org/abs/2403.05555",
"authors": ["Author One", "Author Two"],
"abstract": "..."
},
"statements": [
{
"statement_id": "uuid",
"name": "Theorem 1.1",
"body": "Let R be a ring...",
"note": "Informal description or null",
"proof": "Proof text or null"
}
],
"dependencies": [
{
"src_statement_id": "uuid",
"src_name": "Theorem 1.1",
"dep_statement_id": "uuid",
"dep_name": "Lemma 2.3",
"dep_paper_ext_id": "2401.00001",
"dep_paper_title": "Another Paper",
"interpaper": true
}
]
}interpaper: true on a dependency edge means the referenced statement lives in a different paper.
Paper Search
Autocomplete search over paper titles and external IDs. Returns exact external-ID prefix matches first, then title substring matches.
QUERY PARAMETERS
| FIELD | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| q | string | "" | Search string matched against external ID (prefix) and title (substring). |
| limit | integer | 8 | Maximum number of results to return. |
EXAMPLE
curl "https://api.theoremsearch.com/paper-search?q=derived+categories&limit=5"RESPONSE
{
"papers": [
{
"paper_id": "uuid",
"title": "Derived Categories of Coherent Sheaves",
"external_id": "math/0206163",
"source": "arXiv"
}
]
}Paper Links
Returns all directed citation edges among papers in the graph dataset as (source, target) pairs of paper UUIDs.
EXAMPLE
curl https://api.theoremsearch.com/paper-linksRESPONSE
{
"links": [
{ "source": "uuid-of-citing-paper", "target": "uuid-of-cited-paper" }
]
}Graph Embedding Search
Peform semantic search over the entire TheoremGraph corpus, formal and informal statements. Embeds the query with Qwen3-Embedding-8B and returns statements ranked by cosine similarity.
QUERY PARAMETERS
| FIELD | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| query* | string | — | Natural-language description of the mathematical result to find. |
| n_results | integer | 10 | Number of results to return. |
| formality | string | "both" | Filter by corpus: "informal" (arXiv), "formal" (Lean), or "both". |
EXAMPLE
curl "https://api.theoremsearch.com/graph/embedding?query=fundamental+theorem+of+calculus&n_results=5"RESPONSE
{
"results": [
{
"statement_id": "uuid",
"name": "Theorem 1.1",
"body": "If f is continuous on [a, b] and differentiable on (a, b)...",
"slogan": "Every continuous function on a closed interval has an antiderivative.",
"formality": "informal",
"similarity": 0.943,
"paper": {
"title": "Real Analysis Notes",
"external_id": "2301.00001",
"source": "arXiv"
}
}
]
}Graph Statement
Returns a statement and its direct dependency neighborhood. Use the direction parameter to walk outward along dependency edges, and formality to select informal or formal edges.
PATH PARAMETER
| FIELD | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| statement_id* | string | — | UUID of the statement, obtained from /graph/embedding or /graph/paper. |
QUERY PARAMETERS
| FIELD | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| direction | string | "both" | "src" (what this statement uses), "dep" (what uses this statement), or "both". |
| formality | string | "both" | "informal", "formal", or "both". |
EXAMPLE
curl "https://api.theoremsearch.com/graph/statement/<statement_id>?direction=both&formality=formal"RESPONSE
{
"statement": {
"statement_id": "uuid",
"name": "Theorem 1.1",
"body": "If f is continuous on [a, b]...",
"slogan": "...",
"formality": "formal"
},
"neighbors": [
{
"statement_id": "uuid",
"name": "Lemma 2.3",
"direction": "src",
"edge_type": "proof",
"formality": "formal"
}
]
}Graph Paper
Returns all statements and dependency edges for an arXiv paper or Lean repository. Accepts either a UUID path parameter or an external_id query parameter for lookup by arXiv ID or repo slug.
PATH PARAMETER (OR QUERY PARAMETER)
| FIELD | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| paper_id | string | — | UUID of the paper (path parameter). |
| external_id | string | — | arXiv ID or Lean repo slug, e.g. 2301.00001 or leanprover-community/mathlib4. |
EXAMPLE
curl "https://api.theoremsearch.com/graph/paper?external_id=2301.00001"RESPONSE
{
"paper": {
"paper_id": "uuid",
"title": "Real Analysis Notes",
"external_id": "2301.00001",
"source": "arXiv"
},
"statements": [
{
"statement_id": "uuid",
"name": "Theorem 1.1",
"body": "If f is continuous on [a, b]...",
"slogan": "...",
"formality": "informal"
}
],
"dependencies": [
{
"src_statement_id": "uuid",
"dep_statement_id": "uuid",
"edge_type": "proof",
"formality": "informal"
}
]
}Tip: search with /graph/embedding to get a statement_id, then walk its neighborhood with /graph/statement/{id}.
MCP
TheoremSearch is available as an MCP (Model Context Protocol) server for AI agents. It exposes a single tool theorem_search with the same parameters as POST /search.
https://api.theoremsearch.com/mcpEXAMPLE — CALL theorem_search VIA MCP
curl -X POST https://api.theoremsearch.com/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "tools/call",
"params": {
"name": "theorem_search",
"arguments": {
"query": "every projective module over a local ring is free",
"n_results": 5
}
}
}'RESPONSE
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"content": [{ "type": "text", "text": "{...serialized SearchResponse...}" }],
"structuredContent": { "theorems": [...] }
}
}SUPPORTED METHODS
| FIELD | TYPE | DEFAULT | DESCRIPTION |
|---|---|---|---|
| initialize | — | — | Handshake. Returns protocol version and server capabilities. |
| tools/list | — | — | Returns the theorem_search tool schema. |
| tools/call | — | — | Invokes theorem_search with the given arguments. |