ZeroFall Game API
Public REST endpoints for the ZeroFall mobile client. Everything is scoped to the signed-in player through Lovable Cloud auth and row-level security.
Authentication
All player-scoped endpoints require the caller to send the player's Supabase JWT as Authorization: Bearer <access_token>. Public content endpoints do not require a token.
Get a token from the mobile client using the shared Supabase project keys:
const { data } = await supabase.auth.signInWithPassword({ email, password });
const token = data.session?.access_token;
await fetch("https://<your-domain>/api/public/game/me", {
headers: { Authorization: `Bearer ${token}` },
});Base URL & CORS
All endpoints are same-origin under this site's host. CORS is enabled for all origins with the standard preflight (OPTIONS).
Content (public, no auth)
/api/public/game/newsPublished news feed.
/api/public/game/announcementsActive in-game announcements.
Player account
/api/public/game/meBearerPublic profile + player profile.
/api/public/game/betaBearerBeta access status.
Character
/api/public/game/characterBearerCharacter loadout, faction, and stats.
/api/public/game/characterBearerPartial update of character/faction/stats.
{ "character": {...}, "faction": "wardens", "stats": {...} }Progression (level, XP, survival stats)
/api/public/game/progressionBearerLevel, XP, currency, playtime, kills, distance, bases, vehicles.
/api/public/game/progressionBearerSync counters from the client. Only whitelisted numeric fields are accepted.
{ "level": 12, "xp": 5400, "playtime_seconds": 8210, "zombies_defeated": 300 }Inventory
/api/public/game/inventoryBearerAll inventory items for the player.
/api/public/game/inventoryBearerGrant an item to the player.
{ "name": "Salvaged Rifle", "category": "weapon", "rarity": "rare", "quantity": 1 }Achievements
/api/public/game/achievementsBearerFull catalog + unlocked entries for player.
/api/public/game/achievementsBearerUnlock or update progress for a single achievement.
{ "achievement_id": "first_blood", "progress": 100 }Social
/api/public/game/friendsBearerAll friendship rows involving the player.
/api/public/game/clanBearerPlayer's clan, role, and member list.
Notifications
/api/public/game/notificationsBearerMost recent 100 notifications.
/api/public/game/notificationsBearerMark notifications as read/unread.
{ "ids": ["uuid1","uuid2"], "read": true }Game settings
/api/public/game/settingsBearerLanguage, region, graphics, audio, controls, preferences.
/api/public/game/settingsBearerPartial update of settings.
{ "language": "en", "graphics_quality": "high", "sfx_volume": 0.8 }Cloud saves
/api/public/game/savesBearerAll save slots. Use ?slot=N to fetch one.
/api/public/game/savesBearerCreate or replace a save slot (max 2 MB payload).
{ "slot": 0, "label": "Sector 7", "version": 1, "payload": {...}, "checksum": "sha256:..." }/api/public/game/saves?slot=0BearerDelete a save slot.
Errors
Errors are JSON in the form { "error": "message" }. Common statuses: 401 missing/invalid token, 400 bad input, 413 payload too large, 500 upstream failure.
Data model
The mobile game and the website share the same database. All rows are protected by row-level security so a token only ever sees its own data. Tables the game will use: profiles, player_profiles, inventory_items, achievements, user_achievements, friendships, clans, clan_members, notifications, game_settings, cloud_saves, news, announcements.