User Storage

The storage API is designed for frontend-only apps that don't have their own backend. If you have your own backend, you should store game state there instead.

When to Use

Use the storage API if:

  • You're building a frontend-only game (web, Unity WebGL, mobile)
  • You don't have your own backend
  • You need to store simple game state per user

Don't use it if:

  • You have your own backend (store data there instead)
  • You need complex queries or relationships
  • You need to store large amounts of data

Available Endpoints

Store Data

await fetch(`${API_URL}/miscellaneous/v1/storage/game-settings`, {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${idToken}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    volume: 0.7,
    difficulty: 'medium',
    lastPlayedSkill: 'multiplication',
  }),
});

Retrieve Data

const res = await fetch(`${API_URL}/miscellaneous/v1/storage/game-settings`, {
  headers: { Authorization: `Bearer ${idToken}` },
});
const settings = await res.json();
console.log(settings.volume); // 0.7

Delete Data

await fetch(`${API_URL}/miscellaneous/v1/storage/game-settings`, {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${idToken}` },
});

Common Use Cases

Game settings:

await fetch(`${API_URL}/miscellaneous/v1/storage/settings`, {
  method: 'PUT',
  headers: { Authorization: `Bearer ${idToken}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ volume: 0.7, musicEnabled: true }),
});

Current progress:

await fetch(`${API_URL}/miscellaneous/v1/storage/current-progress`, {
  method: 'PUT',
  headers: { Authorization: `Bearer ${idToken}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ currentSkill: 'multiplication', currentLevel: 5 }),
});

Unlocked cosmetics:

await fetch(`${API_URL}/miscellaneous/v1/storage/cosmetics`, {
  method: 'PUT',
  headers: { Authorization: `Bearer ${idToken}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ unlocked: ['hat-1', 'hat-2', 'shirt-3'] }),
});

Data Persistence

Stored data is:

  • Per-user: Each user's storage is isolated
  • Persistent: Data survives app closes and reinstalls
  • Simple key-value: No complex queries or relationships supported
  • Size limits: Store reasonable amounts (< 100KB per key recommended)

If your data doesn't meet these constraints, use your own backend storage.


Authentication required for storage access. See auth setup if you're using the OAuth flow.

Production patterns showing how to use storage for session persistence and recovery.

Complete endpoint documentation for storage operations, including size limits and data format requirements.