# Archivist API Developer Documentation > Official developer documentation for the Archivist AI REST API and MCP server. Build integrations with TTRPG campaign data including campaigns, sessions, characters, locations, factions, items, quests, journals, key moments, hero awards, quotes, spotlights, and RAG-powered campaign Q&A. API Base URL: https://api.myarchivist.ai OpenAPI Spec: https://api.myarchivist.ai/openapi.json MCP Server URL: https://mcp.myarchivist.ai/mcp ## Documentation - [API Reference](https://developers.myarchivist.ai/api-reference): Full endpoint documentation with request/response examples - [Guides & Concepts](https://developers.myarchivist.ai/docs): Authentication, data models, conventions, and quickstart - [MCP Server](https://developers.myarchivist.ai/mcp): MCP setup guides for Claude, Cursor, OpenCode, and tool reference - [MCP Landing Page](https://www.myarchivist.ai/mcp): Product overview and connect flow for AI assistants - [API Playground](https://developers.myarchivist.ai/playground): Interactive API testing with your own API key - [API Code Examples](https://github.com/archivistai/api-examples): Python, TypeScript, and cURL samples on GitHub - [API Changelog](https://github.com/archivistai/api-examples/blob/main/CHANGELOG.md): Breaking changes and release notes ## Authentication All API endpoints (except `/health`) require authentication via the `x-api-key` header: ``` curl -H "x-api-key: YOUR_API_KEY" https://api.myarchivist.ai/v1/campaigns ``` API keys are generated from the Archivist app dashboard at https://app.myarchivist.ai. OAuth Bearer tokens are also supported for third-party integrations. ## Key Endpoints - `GET /health` — health check (no auth) - `GET /v1/campaigns` — list campaigns - `GET /v1/campaigns/{id}` — get campaign details - `POST /v1/campaigns` — create a campaign - `GET /v1/sessions` — list sessions - `GET /v1/sessions/{id}` — get session details - `PATCH /v1/sessions/{id}` — update session metadata (title, summary, notes, type, public, session_date, image). Sessions are system-managed: there is no `POST` or `DELETE /v1/sessions` on the developer API. - `GET /v1/characters` — list characters - `GET /v1/locations` — list locations - `GET /v1/factions` — list factions - `GET /v1/items` — list items - `GET /v1/quests` — list quests - `GET /v1/entities` — lightweight compendium picker (characters, factions, locations, items) - `GET /v1/entities/{id}/properties` — structured Properties tables for a character, faction, location or item (`campaign_id`, `type`); connection fields include entity ids - `PATCH /v1/entities/{id}/properties` — partial Properties update (`{"properties": {key: value}}`; connection fields take ids/names or `{"add", "remove"}`) - `GET /v1/characters/{id}/arc` — Character Arc facets by theme (`status=approved|pending|all`) - `POST /v1/characters/{id}/arc/facets`, `PATCH`/`DELETE /v1/characters/{id}/arc/facets/{facet_id}` — edit a PC's arc (text edits create a new version) - `POST /v1/characters/{id}/arc/runs/{run_id}/review` — approve or decline a session run's pending arc changes - `GET /v1/journals` — list journal entries - `GET /v1/beats` — list beats (paginated by campaign_id or flat session_id); session hierarchy with `session_id` + `include_hierarchy=true` (nodes include `linkedEntities`) - `GET /v1/moments` — list moments (same Moment table; Key Moment cards are `kind=key-moment`, usually also `categories=key-moment`) - `GET /v1/hero-awards` — list hero awards (`campaign_id` or `session_id` required) - `POST /v1/hero-awards` — create a hero award (`session_id`, `title`, `description`) - `GET /v1/quotes` — list session quotes (`campaign_id` or `session_id` required) - `POST /v1/quotes` — create a quote (`session_id`, `text`); finds or creates a recap pipeline - `GET /v1/spotlights` — list recap spotlights / GEMS cards (not session-handout spotlights) - `POST /v1/spotlights` — create a recap spotlight (`session_id`, `title`); finds or creates a recap pipeline - `GET /v1/campaigns/{id}/search` — unified campaign search (`q`, optional `types`) - `GET /v1/images/usage` — image quota for a campaign - `POST /v1/images/generate` — AI entity/world image generation - `POST /v1/campaigns/{id}/images/init` — presigned upload (step 1) - `POST /v1/campaigns/{id}/images/complete` — validate and attach upload (step 2) - `DELETE /v1/campaigns/{id}/images` — remove entity image - `GET /v1/ask/quota` — remaining Ask tokens (`monthlyTokensRemaining`, `hourlyTokensRemaining`, `launchPromoActive`) - `POST /v1/ask` — RAG chat endpoint (supports SSE streaming) ## MCP Server Archivist AI provides a Model Context Protocol (MCP) server for AI assistants and agents. - [MCP Landing Page](https://www.myarchivist.ai/mcp): Product overview and connect flow - Official Claude connector: [Archivist AI in the Anthropic Connectors Directory](https://claude.ai/new#directory/connectors/archivist-ai-mcp) - MCP Server URL: `https://mcp.myarchivist.ai/mcp` (manual setup fallback) - Registry ID: `io.github.Astrotomic/archivist-ai` - Transport: Streamable HTTP - Authentication: OAuth 2.0 (PKCE) or Bearer token - Server Card: `https://mcp.myarchivist.ai/.well-known/mcp/server-card.json` - Tool annotations: read tools use `readOnlyHint: true`; write/delete tools use appropriate destructive/idempotent hints - OAuth write scope: `agent_write` required for mutating MCP tools ### MCP Tools (87 tools — 36 read, 51 write) **Campaigns (read):** `list_campaigns`, `get_campaign`, `get_campaign_stats`, `ask_campaign` **Campaigns (write):** `create_campaign`, `update_campaign` **Characters (read):** `list_characters`, `get_character`, `get_character_arc` **Characters (write):** `create_character`, `update_character`, `delete_character`, `create_character_arc_facet`, `update_character_arc_facet`, `delete_character_arc_facet`, `review_character_arc_run` **Properties (write):** `update_entity_properties` — read Properties with `with_properties: true` on `get_character` / `get_faction` / `get_location` / `get_item` **Sessions (read):** `list_sessions`, `get_session`, `get_session_cast_analysis`, `get_session_handout`, `get_session_transcript` **Sessions (write):** `patch_session` **Beats (read):** `list_beats`, `get_beat` **Beats (write):** `create_beat`, `update_beat`, `delete_beat` **Moments (read):** `list_moments`, `get_moment` **Moments (write):** `create_moment`, `update_moment`, `delete_moment` **Hero Awards (read):** `list_hero_awards`, `get_hero_award` **Hero Awards (write):** `create_hero_award`, `update_hero_award`, `delete_hero_award` **Quotes (read):** `list_quotes`, `get_quote` **Quotes (write):** `create_quote`, `update_quote`, `delete_quote` **Spotlights (read):** `list_spotlights`, `get_spotlight` — GEMS recap cards, not session-handout spotlights **Spotlights (write):** `create_spotlight`, `update_spotlight`, `delete_spotlight` **Factions (read):** `list_factions`, `get_faction` **Factions (write):** `create_faction`, `update_faction`, `delete_faction` **Locations (read):** `list_locations`, `get_location` **Locations (write):** `create_location`, `update_location`, `delete_location` **Items (read):** `list_items`, `get_item` **Items (write):** `create_item`, `update_item`, `delete_item` **Quests (read):** `list_quests`, `get_quest` **Quests (write):** `create_quest`, `update_quest`, `delete_quest` **Journals (read):** `list_journals`, `get_journal`, `list_journal_folders`, `get_journal_folder` **Journals (write):** `create_journal`, `update_journal`, `delete_journal`, `create_journal_folder`, `update_journal_folder`, `delete_journal_folder` **Links (read):** `list_links` **Links (write):** `create_link`, `update_link`, `delete_link`, `bulk_link_maintenance` **Images:** `get_image_usage`, `init_image_upload`, `complete_image_upload`, `delete_entity_image` Pass `with_links: true` on read tools before editing wikilink-bearing text fields. `update_quest` keeps objective and progress-entry identity when entries are sent as objects with their `id` (progress entries also accept `session_id`). If a write tool reports that the API did not respond in time, the change may still have been saved: read the record back before retrying. Session create and delete are not exposed on MCP or the developer REST API (first-party product clients only). AI image generation is not exposed as an MCP tool. It remains available on the REST API (`POST /v1/images/generate`) and in the Archivist AI app. ### MCP Registry Listings - [Anthropic Connectors Directory](https://claude.ai/new#directory/connectors/archivist-ai-mcp): official Archivist AI connector for Claude - [Official MCP Registry](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.Astrotomic/archivist-ai): Canonical metadata for `io.github.Astrotomic/archivist-ai` - [Smithery](https://smithery.ai/servers/me-26lt/archivist-ai): MCP server registry - [Glama](https://glama.ai/mcp/connectors/ai.myarchivist.mcp/mcp-archivist-ai): MCP connector directory - [mcp.so](https://mcp.so/server/archivist-ai/Archivist%20AI): MCP server directory ### Agent Examples - [Agent Examples Repository](https://github.com/archivistai/agent-examples): MCP configs, Claude.ai setup, and SDK samples - [Claude.ai setup guide](https://github.com/archivistai/agent-examples/blob/main/examples/claude-ai/README.md): example prompts and manual connector setup - [Official Claude Connector](https://claude.ai/new#directory/connectors/archivist-ai-mcp): Archivist AI in Anthropic's Connectors Directory ## Response Format Paginated list endpoints return: ```json { "data": [...], "total": 42, "page": 1, "size": 20, "pages": 3 } ``` `GET /v1/entities` uses a different envelope: `{results, hasMore, page, pages, total}` with `limit` instead of `size`. Pass `fields=card` on characters, moments, and journals list endpoints for lightweight picker items. Errors return: ```json { "detail": "Error description" } ``` ## Rate Limits Requests are rate-limited per API key. 429 responses include a `Retry-After` header. ## Streaming `POST /v1/ask` supports Server-Sent Events (SSE) for streaming campaign Q&A responses. ## Related Resources - [API Code Examples](https://github.com/archivistai/api-examples): Python, TypeScript, and cURL samples for the public REST API - [API Changelog](https://github.com/archivistai/api-examples/blob/main/CHANGELOG.md): Breaking changes and release notes - [Main Product](https://www.myarchivist.ai): Product overview, features, and pricing - [Full Product Docs](https://www.myarchivist.ai/llms-full.txt): Comprehensive product documentation - [Pricing](https://www.myarchivist.ai/pricing.md): Machine-readable pricing information