Cloud Saves API
PUT /v1/saves
Section titled “PUT /v1/saves”Save player game data. Supports optimistic locking — if a version is provided and doesn’t match the server’s version, a conflict is returned.
Auth: x-game-api-key header
curl -X PUT https://api.questdata.io/v1/saves \ -H "Content-Type: application/json" \ -H "x-game-api-key: YOUR_API_KEY" \ -d '{ "player_id": "player-123", "data": { "level": 15, "health": 100, "inventory": ["sword", "shield"], "playtime_seconds": 7200 }, "version": 3 }'Request Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
player_id | string | Yes | Player identifier |
data | object | Yes | Game state (max 100 KB) |
version | number | No | Expected version for conflict detection |
Response (200)
Section titled “Response (200)”{ "success": true, "version": 4, "updated_at": "2026-04-08T14:30:00Z"}Error Responses
Section titled “Error Responses”| Status | Body | Cause |
|---|---|---|
| 409 | { "error": "Version conflict", "server_version": 4, "server_data": {...}, "updated_at": "..." } | Version mismatch |
| 413 | { "error": "Save data exceeds 100KB limit", "size_bytes": 120000, "limit_bytes": 102400 } | Data too large |
| 400 | { "error": "..." } | Missing required fields |
On a 409 Conflict, the response includes the server’s current data so you can implement conflict resolution.
GET /v1/saves
Section titled “GET /v1/saves”Load a player’s saved game data.
Auth: x-game-api-key header
curl "https://api.questdata.io/v1/saves?player_id=player-123" \ -H "x-game-api-key: YOUR_API_KEY"Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
player_id | string | Yes | Player identifier |
Response (200)
Section titled “Response (200)”{ "data": { "level": 15, "health": 100, "inventory": ["sword", "shield"], "playtime_seconds": 7200 }, "version": 4, "updated_at": "2026-04-08T14:30:00Z"}Response (404)
Section titled “Response (404)”{ "error": "No save found", "data": null}DELETE /v1/saves
Section titled “DELETE /v1/saves”Delete a player’s cloud save.
Auth: x-game-api-key header
curl -X DELETE "https://api.questdata.io/v1/saves?player_id=player-123" \ -H "x-game-api-key: YOUR_API_KEY"Response
Section titled “Response”- 204 No Content — Save deleted
- 404 — No save found for this player