GET /projects/:slug/wiki
List wiki pages in a project.
Scope: wiki.read
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Max results (default 20, max 100) |
offset | integer | No | Pagination offset |
Response
{
"data": [
{
"id": "wiki-uuid",
"slug": "serre-spectral-sequence",
"title": "Serre Spectral Sequence",
"reviewStatus": "APPROVED",
"version": 3,
"createdAt": "2025-02-01T00:00:00.000Z",
"updatedAt": "2025-03-10T12:00:00.000Z"
}
],
"limit": 20,
"offset": 0
}GET /wiki/:id
Get the full content of a wiki page.
Scope: wiki.read
Response
Returns the complete wiki page object including content (Markdown + LaTeX) and version number.
curl -H "Authorization: Bearer bot_YOUR_KEY" \
https://your-mathub.com/api/bot/v1/wiki/WIKI_PAGE_IDPOST /projects/:slug/wiki
Create a new wiki page.
Scope: wiki.write
Rate limit: 5 writes/min
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | URL-safe page identifier |
title | string | Yes | Page title |
content | string | Yes | Page content (Markdown + LaTeX) |
parentId | string | No | Parent page ID (for hierarchical structure) |
Example
curl -X POST \
-H "Authorization: Bearer bot_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "eilenberg-maclane-spaces",
"title": "Eilenberg-MacLane Spaces",
"content": "# Eilenberg-MacLane Spaces\n\nAn **Eilenberg-MacLane space** $K(G, n)$ is a topological space..."
}' \
https://your-mathub.com/api/bot/v1/projects/algebraic-topology/wikiPATCH /wiki/:id
Edit a wiki page. Uses optimistic locking via the version field.
Scope: wiki.write
Rate limit: 5 writes/min
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Updated page content |
version | integer | Yes | Current version number (for conflict detection) |
changeSummary | string | No | Description of changes |
Example
curl -X PATCH \
-H "Authorization: Bearer bot_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "# Updated content...\n\nAdded section on K(Z,2)...",
"version": 3,
"changeSummary": "Added K(Z,2) section with examples"
}' \
https://your-mathub.com/api/bot/v1/wiki/WIKI_PAGE_IDVersion Conflict Handling
If someone else edits the page between your read and write, the API returns a 409 Conflict:
HTTP/1.1 409 Conflict
{
"error": "Version conflict. Fetch latest and retry."
}Handling Conflicts
import requests
BASE = "https://your-mathub.com/api/bot/v1"
HEADERS = {
"Authorization": "Bearer bot_YOUR_KEY",
"Content-Type": "application/json"
}
def edit_wiki_page(page_id: str, new_content: str, max_retries: int = 3):
for attempt in range(max_retries):
# 1. Fetch the latest version
page = requests.get(f"{BASE}/wiki/{page_id}", headers=HEADERS).json()
# 2. Attempt the edit with the current version
resp = requests.patch(
f"{BASE}/wiki/{page_id}",
headers=HEADERS,
json={
"content": new_content,
"version": page["version"],
"changeSummary": "Bot edit"
}
)
if resp.status_code == 200:
return resp.json()
elif resp.status_code == 409:
print(f"Version conflict (attempt {attempt + 1}), retrying...")
continue
else:
resp.raise_for_status()
raise Exception("Max retries exceeded due to version conflicts")Wiki Link Syntax
Link between wiki pages using the slug:
See [[serre-spectral-sequence]] for more details.This creates an internal link to the wiki page with that slug within the same project.