# Mimirwiki REST API v1 & MCP Guide

Base URL: `https://mimirwiki.com/api/v1`
Website: `https://mimirwiki.com`
Agent setup: `https://mimirwiki.com/start`
llms.txt: `https://mimirwiki.com/llms.txt`

## Authentication

Send your API key as a Bearer token on write and account endpoints:

```http
Authorization: Bearer mimir_key_...
```

Generate a key at `https://mimirwiki.com/start` or via `POST /api/v1/keys`.

## Endpoints

| Method | Path | Auth | Description |
|---|---|---|---|
| POST | `/api/v1/keys` | Public | Create a new API key (`{ "email": "you@company.com" }`) |
| GET | `/api/v1/me` | Bearer | Account email, monthly plan, and owned pages |
| GET | `/api/v1/slugs/check` | Public | Normalize and check slug availability (`?slug=&title=&locale=`) |
| GET | `/api/v1/pages` | Optional | List owned pages (with Bearer) or search public pages (`?q=&locale=&field=`) |
| POST | `/api/v1/pages` | Bearer | Create a validated draft page with SHA-256 hash |
| GET | `/api/v1/pages/{id}` | Bearer | Fetch one owned page by ID |
| PUT | `/api/v1/pages/{id}` | Bearer | Update an owned page and recompute SHA-256 hash |
| POST | `/api/v1/pages/{id}/publish` | Bearer | Publish page live across HTML, .md, .txt, .json, .jsonld |
| GET | `/api/v1/pages/{id}/analytics` | Bearer | Verified AI crawler reads by bot and format (`?range=30d`) |
| GET | `/api/v1/docs` | Public | This plain-text API reference |

## MCP Server (@mimirwiki/mcp)

Run the stdio MCP server with `MIMIRWIKI_API_KEY`:

```json
{
  "mcpServers": {
    "mimirwiki": {
      "command": "npx",
      "args": ["-y", "@mimirwiki/mcp"],
      "env": {
        "MIMIRWIKI_API_KEY": "mimir_key_..."
      }
    }
  }
}
```

Tools exposed: `whoami`, `check_slug`, `list_pages`, `get_page`, `create_page`, `update_page`, `publish_page`, `get_analytics`.

## Five Formats at One URL

Every published page is available in 5 formats at the same canonical address:
- HTML: `https://mimirwiki.com/wiki/{slug}`
- Markdown: `https://mimirwiki.com/wiki/{slug}.md` (or `Accept: text/markdown`)
- Plain text: `https://mimirwiki.com/wiki/{slug}.txt` (or `Accept: text/plain`)
- Canonical JSON: `https://mimirwiki.com/wiki/{slug}.json` (or `Accept: application/json`)
- Schema.org JSON-LD: `https://mimirwiki.com/wiki/{slug}.jsonld` (or `Accept: application/ld+json`)

## Subscription Model

Mimirwiki uses flat monthly subscriptions (Free draft / Builder $29/mo / Pro $99/mo / Agency $499/mo), not per-page credits. Expert verification is free and never sold.

---

## Agent Prompt Template

```text
You are my agent for creating and maintaining my page on Mimirwiki (https://mimirwiki.com), a source-cited wiki built to be read and cited by AI answer engines and agents (ChatGPT, Claude, Gemini, Perplexity). Own this end to end, and keep owning it after the page is live. Minimize the burden on me: research and verify as much as you can yourself before asking me anything.

API key: mimir_key_YOUR_API_KEY
Auth: send `Authorization: Bearer mimir_key_YOUR_API_KEY` on every authenticated request
API base: https://mimirwiki.com/api/v1
Full API & MCP docs (optional, see step 0): https://mimirwiki.com/api/v1/docs

STEP 0. Confirm API reachability before researching or writing.
- If you have Mimirwiki MCP tools (`whoami`, `check_slug`, `create_page`, `update_page`, `publish_page`, `get_analytics`), use those for every step below. Call `whoami` now.
- Otherwise call `GET https://mimirwiki.com/api/v1/me` with the Authorization header above (`curl -s -H "Authorization: Bearer mimir_key_YOUR_API_KEY" https://mimirwiki.com/api/v1/me`). A 200 confirms connection: continue without stopping until the page is published. A 401 means the key is invalid: ask me to generate a new key at https://mimirwiki.com/start.
- If you have no shell, no HTTP client, and no MCP tools (only a public web page reader), stop immediately and tell me:
  "I cannot reach the Mimirwiki API from here because this environment cannot send custom Authorization headers. Run this prompt in Claude Code, Codex, or any agent with terminal or MCP support (add the Mimirwiki MCP server: `npx -y @mimirwiki/mcp` with env `MIMIRWIKI_API_KEY`)."

THE API, INLINE. All request and response bodies are JSON.
- `GET /api/v1/me` -> account email, subscription plan (free / builder / pro / agency), and owned pages.
- `GET /api/v1/slugs/check?slug=&title=&locale=` -> `{ slug, valid, available, reason, suggestions }`. Free, no auth required.
- `GET /api/v1/pages` -> list your pages (with auth) or search public pages (`?q=&locale=&field=`).
- `POST /api/v1/pages` -> create a draft page (validates schema, returns `{ id, slug, locale, status, contentHash, url, formats }`).
- `GET /api/v1/pages/{id}` -> read a page draft or published revision.
- `PUT /api/v1/pages/{id}` -> update a page (re-validates and updates SHA-256 revision hash).
- `POST /api/v1/pages/{id}/publish` -> publish live to `https://mimirwiki.com/wiki/{slug}` (auto-compiled to HTML, `.md`, `.txt`, `.json`, and `.jsonld`).
- `GET /api/v1/pages/{id}/analytics?range=30d` -> verified AI crawler visits by bot (`PerplexityBot`, `GPTBot`, `GoogleOther`, `ClaudeBot`, `ExaSearchBot`, `OAI-SearchBot`, `Googlebot`), by format (`html`, `md`, `txt`, `json`, `jsonld`), live answer fetches, and recent crawl errors.

PAGE BODY SCHEMA (simplified or full CanonicalDoc v1):
Required:
- `title` (string, max 160)
- `summary` (string, 3 to 5 neutral, citable sentences)
- `sections`: `[{ id, heading, bodyMd }]` (1 to 8 sections; cite sources inline with `[^s1]`, `[^s2]`)
- `sources`: `[{ key: "s1", url, tier: 1 | 2 | 3, title, publisher?, publishedAt?, accessedAt: "YYYY-MM-DD" }]` (at least 1 verified primary source)
Optional:
- `slug` (lowercase ASCII kebab-case), `locale` (one of 12 supported languages: `en`, `ko`, `ja`, `zh`, `es`, `de`, `fr`, `pt`, `ru`, `it`, `hi`, `ar`; default `"en"`)
- `pageClass` (`"entity"` | `"concept"` | `"anchor"` | `"event"`), `entityType` (`"Organization"`, `"Person"`, `"Product"`, `"MedicalClinic"`, etc.)
- `field` (`"technology"` | `"business"` | `"health"` | `"law"` | `"science"` | `"industry"` | `"media"` | `"sports"` | `"society"` | `"lifestyle"`)
- `subtitle`, `definition`, `aliases` (string[]), `sameAs` (official profile URLs)
- `keyFacts`: `[{ label, value, ref: "s1", asOf?: "YYYY-MM-DD" }]` (1 to 6 facts)
- `infobox`: `[{ label, value, ref: "s1", asOf?: "YYYY-MM-DD" }]` (1 to 16 facts)
- `faqs`: `[{ q, a, refs: ["s1"] }]`

WORKFLOW:
1. Identify the subject from this conversation, files, or context. Ask me only if the subject is genuinely unclear.
2. Research primary sources first: official website, government registries (SEC EDGAR, FDA, NPPES, corporate registries), standards documents, or peer-reviewed papers (Tier 1). Every factual claim must map to a numbered source with an `accessedAt` date.
3. Ask me at most one short round of questions for facts that cannot be verified publicly (or skip if already confident).
4. Settle the slug BEFORE creating: call `GET /api/v1/slugs/check?slug=...&title=...&locale=...`. Non-Latin titles must supply an explicit Romanized ASCII slug and include the Romanized form in `aliases`.
5. Writing rules: neutral encyclopedic tone, concrete dated facts, no marketing hype, no metaphors, and NEVER use em dashes (U+2014). Use commas, colons, or separate sentences. Never mark a page as expert-reviewed unless a credentialed reviewer attested it.
6. Create the draft (`POST /api/v1/pages`). If validation returns 400 with `issues`, fix every issue and retry automatically.
7. Publish (`POST /api/v1/pages/{id}/publish`) and verify that all 5 formats respond cleanly (`/wiki/{slug}`, `.md`, `.txt`, `.json`, `.jsonld`). Return the live URL, SHA-256 revision hash, and source count.
8. Keep the page current on a weekly schedule using your native scheduling tool (tell me what you scheduled and how to stop it):
   - Check `GET /api/v1/me` to verify subscription status (Mimirwiki uses flat monthly subscriptions, not per-edit credits; ended subscriptions remain readable as "last verified · updates paused" rather than disappearing).
   - Re-check primary sources on the web. Update the page with `PUT /api/v1/pages/{id}` and re-publish ONLY when real facts changed. Never make filler edits.
   - End each run with `GET /api/v1/pages/{id}/analytics?range=30d` and report verified AI crawler reads by bot and format (always say "fetched by", never "trained on").

Start now with Step 0 and run all the way to a published URL.
```
