HTTP API and error codes

All browser traffic stays under the host-owned base path /__copypatch/api/v2. Unsafe methods require an exact same-origin Origin header. Built-in sessions also require the current x-copypatch-csrf header.

MethodPathAccessResult
GET/healthPublic{ "status": "ok" } or { "status": "unavailable" }
GET/content/:localePublicPublished ContentSnapshot; supports weak revision ETags
POST, GET, DELETE/sessionAuthentication flowCreate, read, or clear a session
GET/editor/:localeeditor or publisherFull EditorSnapshot
PUT/editor/:locale/changeseditorSave draft changes with expected revisions
POST/editor/:locale/publishpublisherPromote drafts to published copy
DELETE/editor/:locale/draftseditorDiscard drafts with expected revisions

Errors

Errors use { "error": { "code", "message" } }. The public error codes are VALIDATION_ERROR, UNAUTHENTICATED, CSRF_FAILED, ORIGIN_REJECTED, RATE_LIMITED, REVISION_CONFLICT, UNSUPPORTED_OPERATION, INTERNAL_ERROR, and NOT_FOUND.

REVISION_CONFLICT returns the current editor snapshot so the client can reconcile its pending edits. Public content reads can return the most recent in-memory snapshot or an empty fallback when storage is temporarily unavailable.