Windcraft

API reference

All HTTP endpoints exposed by the Windcraft API.

All endpoints return JSON in the standardized envelope. Errors:

{ "error": { "code": "WC_*", "message": "...", "details": {} } }

Session-authed endpoints accept the better-auth cookie; the sync endpoints accept Authorization: Bearer wc_live_….

Auth

MethodPathPurpose
POST/auth/sign-up/emailCreate user (email + password)
POST/auth/sign-in/emailSign in (sets session cookie)
POST/auth/sign-outClear session cookie
GET/auth/get-sessionReturns the active session bundle or null
POST/auth/magic-linkSend a one-time sign-in link by email
POST/auth/sign-in/socialStart a social provider OAuth flow
POST/auth/forget-passwordSend password reset email
POST/auth/reset-passwordSubmit new password with reset token
DELETE/auth/accountGDPR — soft-delete user, cascade to projects, drop sessions

Two-factor (Better Auth twoFactor plugin)

MethodPathPurpose
POST/auth/two-factor/enableStart setup, returns TOTP URI + backup codes
POST/auth/two-factor/verify-totpVerify a 6-digit code (also flips twoFactorEnabled true on first verify)
POST/auth/two-factor/verify-backup-codeUse a single-use backup code
POST/auth/two-factor/disablePassword-gated removal
POST/auth/two-factor/generate-backup-codesRotate the backup-code list

Projects

MethodPathPurpose
GET/projectsList the user's active projects
POST/projectsCreate project; returns first API key (one time)
GET/projects/:idGet project
PATCH/projects/:idUpdate name / platforms / outputs
DELETE/projects/:idSoft delete
GET/projects/:id/healthReturns 0–100 score from sync events
GET/projects/:id/api-keysList keys (no plaintext)
POST/projects/:id/api-keysGenerate new key (one-time plaintext)
DELETE/projects/:id/api-keys/:keyIdRevoke

Tokens / contracts / rules

MethodPathPurpose
GET/projects/:id/tokensLatest version
PUT/projects/:id/tokensReplace; new version
PATCH/projects/:id/tokensDeep merge; new version
GET/projects/:id/tokens/versionsPaginated history
GET/projects/:id/tokens/versions/:from/diff/:toDiff added / removed / changed
POST/projects/:id/tokens/versions/:versionId/restoreCopy old version forward
GET/projects/:id/contractsList 77 contracts
GET/projects/:id/contracts/:nameGet one
PATCH/projects/:id/contracts/:nameUpdate contract / toggle enabled
GET/projects/:id/rulesList 9 rule configs
PATCH/projects/:id/rules/:ruleIdUpdate severity / exceptions

Mirror

MethodPathPurpose
POST/projects/:id/mirrorTranslate JSX between web ↔ mobile using project tokens

Sync (API key auth)

MethodPathPurpose
GET/projects/:id/sync/manifestManifest with the 4 generated outputs + hashes
POST/projects/:id/sync/pullTelemetry — log a pull event

GitHub repo connect

MethodPathPurpose
GET/projects/:id/github/reposRepos the user can push to
GET/projects/:id/github/repoConnected repo state
POST/projects/:id/github/connectConnect a repo, install webhook
DELETE/projects/:id/github/connectDisconnect, remove webhook
POST/projects/:id/github/pushOpen / refresh a sync PR

Webhooks

MethodPathPurpose
POST/webhooks/githubGitHub events (HMAC-SHA256 signed, per-repo secret)
POST/webhooks/lemonsqueezyLemon Squeezy lifecycle (HMAC-SHA256)

Billing

MethodPathPurpose
GET/billing/planReturns subscription state — hasSubscription / status / blocked
POST/billing/checkoutLemon Squeezy checkout URL (body: plan = monthly or yearly)
POST/billing/portalCustomer portal URL
GET/billing/invoicesInvoice history (LS-backed)

CLI auth

MethodPathPurpose
GET/cli-auth/poll/:codeCLI polls — 202 pending / 200 authorized
POST/cli-auth/authorizeWeb app authorizes a code for a project

On this page