OAuth2
Authorization-code flow with PKCE. Short-lived access tokens (15 min) and rotating refresh tokens (30 days). Scopes line up 1:1 with endpoint groups — decisions:read, campaigns:write, etc.
Authorization: Bearer at_…
// api reference
The Magistry REST API is one base URL, three auth modes, and eight endpoint groups. Versioned by date header, idempotent on every write, and signed HMAC-SHA256 on every webhook delivery.
// auth
Authorization-code flow with PKCE. Short-lived access tokens (15 min) and rotating refresh tokens (30 days). Scopes line up 1:1 with endpoint groups — decisions:read, campaigns:write, etc.
Authorization: Bearer at_…
RS256-signed, 60-minute TTL, audience-bound to api.magistry.io. Issued from the workspace dashboard, scoped per service. Rotate the key, the old JWT dies in seconds.
Authorization: Bearer eyJhbGc…
Every delivery includes a timestamp + signature header. Reject deliveries older than 5 minutes; verify the HMAC over ts.body before you trust the payload. Replays drop on a per-id idempotency cache.
X-Magistry-Signature: t=…,v1=…
// endpoint groups
Read the append-only ledger. Every action lands here as a row.
/v1/decisions
Catalog state, lifecycle, cost confidence tier, last cycle action.
/v1/products/{variant_id}Google Ads + Meta + TikTok + Bing — read state, request budget shifts.
/v1/campaigns/{id}/budgetInbound + outbound threads, brand-voice draft, escalation queue.
/v1/cs/threads
Chargeback rows, evidence chains, Ethoca/Verifi/RDR responses.
/v1/disputes/{id}/respondSix discovery lanes — trend, supplier, repeat-buyer, geo, gap, refresh.
/v1/research/candidates
Worker job state — submit a dry-run cycle, poll for completion.
/v1/jobs
Register an HMAC-SHA256-signed URL to receive decision row events.
/v1/webhooks
// example
GET /v1/decisions?store_id=stk_2YHFZ3WkP6e3xL2&since=2026-05-25T00:00:00Z Host: api.magistry.io Authorization: Bearer sk_live_a8f3…2b91 Accept: application/json X-Magistry-Version: 2026-05-01
HTTP/1.1 200 OK
Content-Type: application/json
X-RateLimit-Remaining: 597
X-Magistry-Cycle: cyc_771
{
"data": [
{
"id": "dec_01J9X2KQZP6E3XL2",
"agent": "catalog",
"action": "DISCOUNT_TEST",
"subject": "SKU-LIN-228-SND-L",
"from_state": "ACTIVE",
"to_state": "ON_DISCOUNT",
"judge_score": 0.88,
"tier": "A",
"evidence": ["perf#9123", "cycle#771"],
"reversal": "PRICE_RESTORE@2026-06-08",
"applied_at": "2026-05-25T08:02:14Z",
"applied_by": "catalog_agent.discount_executor"
}
],
"next_cursor": "cur_2YHFZ3WkP…",
"has_more": true
}// rate limits
| Scope | Sustained | Burst | Window |
|---|---|---|---|
| Read | 600 req / min | 1,000 req / 10s | Per workspace token |
| Write | 60 req / min | 120 req / 10s | Per workspace token |
| Webhook delivery | Up to 50 / s | Backpressure at 200 in-flight | Per registered endpoint |
| Bulk export | 4 jobs / hour | 1 concurrent job | Per workspace |
| Discovery (Researcher) | 20 candidates / min | 60 candidates / 10s | Per lane |
// sdks
First-party. Same library the FastAPI worker uses in production.
pip install magistry-sdk
Edge-ready, fetch-based. Generated from the same OpenAPI as Python.
npm i @magistry/sdk
Reads stable, writes still under review. Tag v0.9.x — pin it.
go get github.com/magistry/magistry-go
Reads + webhook helpers. Catalog/campaign writes land in v0.10.
gem install magistry
// status + policy
Live status, current incident, and the last 90 days of uptime live at /support/status. Subscribe by email or RSS to get incidents in your inbox the moment they open.
Breaking changes ship behind a new date-pinned version header (e.g. X-Magistry-Version: 2027-01-01). The previous shape stays live in parallel for a full 12 months before deprecation.
// api reference
The API is the same surface our worker pushes through in production. Same auth, same rate limits, same row shape as your dashboard.
OAuth2 + service JWT · HMAC-SHA256 webhooks · Date-pinned versioning