Swayzio Core API v1 — base path /api/swayzio/v1
Errors

Errors

Errors are JSON objects with a stable machine‑readable error code. Match on the code, not the HTTP status or human message.

Shape

{ "error": "validation_error", "issues": [{ "path": "title", "message": "Required" }] }

Most errors are just { "error": "<code>" }; some add context fields (issues, message, entitlement fields, path).

Status → meaning

StatusWhen
400Validation failed (validation_error / Fastify validation_failed), malformed body (invalid_json), or a bad request shape
401No / invalid credentials (unauthorized, missing_bearer_token, invalid_bearer_token)
403Authenticated but not entitled (entitlement_required) or access denied / access code required
404Resource not found, or an owner mismatch that resolves to “not found”
405method_not_allowed on a resource that exists
409Conflict — library_name_conflict, track_set_mismatch, delete‑original, duplicate
422Structural validation — e.g. split_sheet_structural_validation_failed
429Rate limited — analytics_rate_limited
500Unhandled error (Fastify collapses to internal_error; never leaks the message)
501native_route_not_implemented (native handler missing and proxy disabled)
502Provider error — analytics_provider_error, AI provider failure
503Dependency unavailable — <x>_database_unavailable, native_runtime_required, provider not configured

Common codes by area

CodeStatusMeaning
unauthorized401No resolvable actor
entitlement_required403Plan/feature gate — body carries feature, limit, current, planId, upgradeRequired
validation_error400Request failed its Zod schema; issues[] lists { path, message }
invalid_json400Body wasn’t valid JSON
*_not_found404e.g. track_not_found, pack_not_found, peaks_not_found, pack_link_not_found
track_resource_not_found404Unknown :resource on a track sub‑route
method_not_allowed405e.g. PUT on a track resource other than lyrics/split-sheet
track_set_mismatch409Reorder payload doesn’t match the pack’s track set
library_name_conflict409Library name already used
split_sheet_structural_validation_failed422Split‑sheet totals/structure invalid
downloads_disabled403Share settings disallow downloads on that pack link
access_code_required403Pack link needs an access code
analytics_rate_limited429Dub analytics per‑second limit hit
analytics_provider_error502Dub returned an error
*_database_unavailable503DB pool unavailable (and proxy fallback disabled)
native_runtime_required503Endpoint is native‑only; runtime isn’t Vercel
native_route_not_implemented501No native handler and proxy fallback disabled

Validation errors are the most common during integration. Inspect issues[] — each entry’s path points at the offending field and message explains the rule (from the Zod schema). See Data Contracts.