Skip to main content

Developer docs

Build on Magistry. Start here.

The developer surface is small on purpose. A handful of concepts cover most integrations — the rest is calling the same tool registry Magistry uses, over REST or MCP, against a decision log you can already inspect. Start here, then go deep.

REST API + MCP serverOAuth 2.1 + scoped API keysOpenAPI at /api/v1/openapi.json

Quickstart

Four steps to your first tool call.

The quickstart is built around the read surface — nothing writes to your business until you add write scopes, and even then propose_write keeps a human approval in the loop. You can finish this in your lunch break.
01

Mint an API key

In the dashboard, open Settings → Developers and create a key. Scopes are fine-grained per resource and action — start with the read bundle; add write scopes when you need them.

$ mag_sk_live_…   # keep it secret

~ 1 minute

02

Make your first read call

Every capability is a tool — the same registry Magistry uses in-app. POST to /api/v1/tools/{tool} with your key; the OpenAPI document at /api/v1/openapi.json lists every tool and shape.

$ curl -X POST …/api/v1/tools/get_store_overview

~ 2 minutes

03

Connect your own AI (MCP)

Magistry ships a remote MCP server at /api/mcp. Add it as a custom connector in Claude, or via mcp-remote in Claude Desktop and Cursor — OAuth handles store and scope selection.

$ npx -y mcp-remote https://…/api/mcp

~ 3 minutes

04

Write with a safety net

Write tools come in two tiers: auto_write applies immediately, propose_write returns an approval card you confirm in the dashboard. Auto-apply is opt-in, per key, in Settings → Developers.

$ …/api/v1/tools/propose_discount

~ 30 seconds

Core concepts

Nine ideas. The rest is composition.

If you can hold these in your head, every Magistry tool call falls into place. Skim them once before you start wiring code.
01

decision_log

The audit record of Magistry. Every catalog move lands as a row with its evidence and cost tier, updated as it is approved, applied, failed or reverted; ad changes keep a sibling ledger, ad_decision_log. A price, status or copy change, or a budget or bid target set by the budget allocator or bid pacing, can be reverted from its row. Read it like a ledger.

core/auditRead more
02

ALLOWED_TRANSITIONS

The static state-transition map that gates every catalog write. Every SKU lives in exactly one lifecycle state; invalid moves become operator-review rows, not Shopify mutations. Inspect it before you write a custom executor.

core/catalogRead more
03

planner-judge-executor

Agents that change a store keep three roles apart. A planner proposes, a judge and hard policy checks can refuse or send it to a person, and a separate executor applies only what got through.

core/agentRead more
04

Cost Confidence Tiers

Tier A (verified cost), Tier B (inferred margin), Tier C (orphan). The tier on a SKU decides what the agent is allowed to do — price changes are A-only; copy edits open up at B; archive needs operator confirm at C.

core/safetyRead more
05

Action enum

The product move set in decision_engine.Action: KEEP, SCALE_WINNER, OPTIMIZE_LOSER, DISCOUNT_TEST, DRAFT, VAULT, REVIVE_SEASONAL (raised by variant mining) and WAIT — each one tied to a trigger and a set of valid from-states. The undo is derived from the action when you revert, not stored beside it.

core/catalogRead more
06

Safety primitives

Kill switch (operator-owned), per-action rate limits, the tier-A discount gate, monthly LLM budget cap, advisory locks, credits metering. The guardrails the agents that write and spend run inside — and the cap you can tune.

core/safetyRead more
07

Marketing Brain

The orchestrator above every agent. Signals in, one context bundle, one decision pass, proposals out — with a weekly strategist for durable initiatives and a reflection loop that turns verified outcomes into lessons.

core/orchestrationRead more
08

Trust ramp

Autonomy is earned per lever. The verdict engine scores every applied action win/loss on a full window; sustained wins promote a lever one tier, a losing streak demotes it immediately. Irreversible moves are never auto-approved.

core/autonomyRead more
09

API + MCP

One tool registry behind Magistry, the REST API, and the MCP server. Scoped keys, OAuth 2.1 for MCP clients, and two write tiers — auto_write and propose_write with approval cards in the dashboard.

core/apiRead more

Snippet

Read the log. That's the whole onboarding.

With a key in hand, the first useful call is a read of the store's recent decisions. Everything else — proposing a discount, checking performance, driving your own AI over MCP — composes on top of the same tool registry.
first_call.shcurl
# Read the store's recent decisions — same tools Magistry uses
curl -X POST https://app.magistry.io/api/v1/tools/get_recent_decisions \
  -H "Authorization: Bearer mag_sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "days": 7 }'

# Every tool + shape is in the OpenAPI document:
#   GET https://app.magistry.io/api/v1/openapi.json
# Write tools are tagged: auto_write applies, propose_write
# returns an approval card you confirm in the dashboard.
next: connect Claude over MCPread-only by default

Versioning

Continuous delivery, versioned API.

The platform ships continuously — every release is cut automatically from the same pipeline that deploys the product. The API you build against lives in a versioned namespace (/api/v1), so continuous product releases don't break your integration.

How releases ship

  • Continuous — features and fixes deploy as they're ready; releases are versioned automatically from the commit history.
  • Versioned API — the public surface lives under /api/v1; additive changes only. A breaking change means a new namespace, with overlap.
  • Tool registry — new capabilities appear as new tools in the catalog and the OpenAPI document; existing tool shapes stay stable.

Follow what changes

  1. User-facing releases, sourced from the same release pipeline that ships the product — features, fixes, and improvements without internal noise.

  2. The generated spec for /api/v1 — every tool, its input shape, and its read/write tier. Diff it to see exactly what changed between visits.

  3. Live status of the API, dashboard, worker, and agent surfaces — plus incident history when something does go wrong.

Building on Magistry from outside? The developer platform covers app access and revocation; the trust center covers data handling, audit and sub-processors.

Developer docs

Magistry runs your business. We run Magistry.

The REST API and MCP server expose the same tool registry Magistry's own assistant uses, with the same scopes, approval model and audit trail.

Versioned API · Approval-gated writes · No silent breaking changes