API Reference
REST routes exposed by the WordPress plugin and the Cloudflare Worker.
WordPress plugin REST API
All routes are registered on the altered-digital/v1 namespace (with back-compat on wp-to-sanity/v1). Auth: WP nonce via X-WP-Nonce header (admin capability required).
Export
| Method | Path | Description |
|---|---|---|
| POST | /export | Export a single post (post_id param) |
| POST | /export/bulk | Bulk export multiple posts |
| POST | /export/full | Full-site export |
| GET | /export/batch-size | Get the configured batch size |
Status
| Method | Path | Description |
|---|---|---|
| GET | /status | Aggregate migration status |
| GET | /status/post/{id} | Per-post migration history (reconciles with Worker D1) |
Connect
| Method | Path | Description |
|---|---|---|
| POST | /connect | Legacy v1 connect (self-host) |
| POST | /connect/v2 | Multi-tenant connect |
| GET | /connect/test | Test Worker reachability |
AI + Billing
| Method | Path | Description |
|---|---|---|
| GET | /analyze-data | Aggregated site analysis payload |
| POST | /analyze | Trigger AI analysis |
| GET | /analyze/{id}/status | Poll analysis status |
| POST | /quote | Generate a quote |
| POST | /checkout | Start Stripe checkout (50% upfront) |
| POST | /approve | Approve migration + capture final 50% |
| POST | /schema-generate | Generate Sanity schema from analysis |
Auth
| Method | Path | Description |
|---|---|---|
| POST | /auth/login | Supabase login |
| POST | /auth/signup | Supabase signup |
| POST | /auth/logout | Clear session |
MCP hand-off
| Method | Path | Description |
|---|---|---|
| POST | /mcp/token | Store a Sanity MCP token |
| GET | /mcp/config | Get Claude Desktop config snippet |
| POST | /mcp/revoke | Revoke the MCP token |
Progress
| Method | Path | Description |
|---|---|---|
| GET | /progress | Aggregate progress (from Worker D1) |
| GET | /progress/{post_id} | Per-post progress |
Cloudflare Worker API
Webhook
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /webhook/wp | HMAC signature | WP content webhook |
v2 (multi-tenant)
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /v2/connect | Bearer ADMIN_TOKEN | Create tenant |
| GET | /v2/migrations | Bearer ADMIN_TOKEN + X-AD-Tenant | Aggregate stats |
| GET | /v2/migrations/{postId} | Bearer ADMIN_TOKEN + X-AD-Tenant | Per-post history |
| POST | /v2/cleanup | Bearer ADMIN_TOKEN + X-AD-Tenant | AI content cleanup |
| POST | /v2/mcp/token | Bearer ADMIN_TOKEN + X-AD-Tenant | Store MCP token |
| GET | /v2/mcp/config | Bearer ADMIN_TOKEN + X-AD-Tenant | Get MCP config |
| POST | /v2/mcp/revoke | Bearer ADMIN_TOKEN + X-AD-Tenant | Revoke MCP token |
Revalidation
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /revalidate | X-Sanity-Webhook-Secret | Sanity webhook → Next.js |
| POST | /revalidate/manual | Bearer | Manual revalidate {path} |
AI service API (Vercel)
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/health | None | Liveness probe |
| POST | /api/signup | None (rate-limited) | Create AD account |
| POST | /api/analyze | Supabase JWT | Full-site analysis |
| POST | /api/quote | Supabase JWT | Generate quote |
| POST | /api/stripe/checkout | Supabase JWT | 50% upfront checkout |
| POST | /api/stripe/capture | Supabase JWT or internal | Final 50% checkout |
| POST | /api/stripe/webhook | Stripe signature | Stripe webhook |
| POST | /api/transform | Internal token | AI transform fallback |
| POST | /api/cleanup | Supabase JWT or internal | AI content cleanup |
| POST | /api/schema-generate | Supabase JWT or internal | Sanity schema generation |
| POST | /api/approve | Supabase JWT | Customer sign-off + QA |
| GET | /api/auto-complete | CRON_SECRET | Daily cron (auto-complete) |