REST API
Base URL: https://api.spawnle.com (or SPAWNLE_API).
- Requests and responses are JSON (
Content-Type: application/json). - Authenticate with the player’s ticket:
Authorization: Bearer gt_…. Only/v1/sdk/verifyuses your game’s secret instead. - Times are Unix seconds. Fields use
snake_case. - Errors answer
{ "code": "…", "message": "…" }with an HTTP status — see Errors and limits. - The SDK routes allow cross-origin requests from any origin (CORS).
Player
Section titled “Player”GET /v1/sdk/me
Section titled “GET /v1/sdk/me”{ "handle": "sofi_moth", "display_name": "Sofi", "avatar_color": 10193919, "avatar_url": "https://api.spawnle.com/v1/images/…", "level": 7, "studio": { "studio": "moth-studio", "name": "Moth Studio", "color": 13172557, "logo": null, "title": "Art" }, "game": "neon-moth"}display_name is empty when the player has none (show handle). Colours are
24-bit RGB integers (0xRRGGBB).
GET /v1/sdk/saves
Section titled “GET /v1/sdk/saves”[{ "slot": "slot1", "size": 1834, "updated_at": 1795733892 }]GET /v1/sdk/saves/{slot}
Section titled “GET /v1/sdk/saves/{slot}”{ "slot": "slot1", "data": "{\"level\":3}", "updated_at": 1795733892 }404 not_found when the slot is empty.
PUT /v1/sdk/saves/{slot}
Section titled “PUT /v1/sdk/saves/{slot}”{ "data": "{\"level\":3}" }Answers the slot’s metadata. 413 too_large over 256 KB; 409 conflict when
the player already uses all 16 slots and this is a new one.
DELETE /v1/sdk/saves/{slot}
Section titled “DELETE /v1/sdk/saves/{slot}”204 No Content.
Achievements
Section titled “Achievements”GET /v1/sdk/achievements
Section titled “GET /v1/sdk/achievements”[ { "key": "first-win", "name": "First win", "description": "Win your first round", "xp": 10, "hidden": false, "unlocked_at": 1795733892, "percent": 42.5 }]Hidden, locked achievements have an empty name and description.
POST /v1/sdk/achievements/{key}
Section titled “POST /v1/sdk/achievements/{key}”No body. Unlocks it (once) and answers:
{ "achievement": { "key": "first-win", "…": "…" }, "newly": true }Leaderboards
Section titled “Leaderboards”GET /v1/sdk/leaderboards/{key}?scope=global&limit=10
Section titled “GET /v1/sdk/leaderboards/{key}?scope=global&limit=10”{ "key": "speedrun", "name": "Speedrun", "lower_is_better": true, "format": "time", "scope": "global", "entries": [ { "rank": 1, "handle": "sofi_moth", "display_name": "Sofi", "avatar_color": 10193919, "avatar_url": null, "score": 83250 } ], "me": { "rank": 1, "…": "…" }, "total": 128}scope: global or friends. limit: 1–100, default 10.
POST /v1/sdk/leaderboards/{key}
Section titled “POST /v1/sdk/leaderboards/{key}”{ "score": 83250 }{ "best": 83250, "rank": 1, "improved": true }Presence
Section titled “Presence”PUT /v1/sdk/presence
Section titled “PUT /v1/sdk/presence”{ "details": "Level 3 · 2 lives" }Up to 80 characters, one line; "" clears it. 204 No Content.
Verify
Section titled “Verify”POST /v1/sdk/verify
Section titled “POST /v1/sdk/verify”For your server, with the game’s secret instead of a ticket. See Server verification.
X-Spawnle-Game-Secret: gs_…{ "ticket": "gt_…" }{ "handle": "sofi_moth", "display_name": "Sofi", "game": "neon-moth", "expires_at": 1795820291 }