> ## Documentation Index
> Fetch the complete documentation index at: https://docs.susaplay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Saves

> Cloud save read and write

Cloud saves are keyed by slot. Data is an opaque string — serialize it yourself, usually as
JSON. The platform stores the payload and tracks its version for you.

## Read

```csharp theme={null}
var loaded = await SusaPlaySDK.CloudSave.Load("main");

if (loaded.success)
{
    var state = JsonUtility.FromJson<MyState>(loaded.data.data);
    Debug.Log($"Loaded version {loaded.data.version}, saved at {loaded.data.savedAt}");
}
else
{
    // No save in this slot yet — start a fresh game.
}
```

`LoadResult`:

| Field          | Type     | Notes                                           |
| -------------- | -------- | ----------------------------------------------- |
| `success`      | `bool`   | False when the slot is empty or the read failed |
| `data.slot`    | `string` | Slot name you requested                         |
| `data.data`    | `string` | Your serialized payload                         |
| `data.version` | `int`    | Increments on every successful write            |
| `data.savedAt` | `string` | ISO-8601 timestamp                              |

## Write

```csharp theme={null}
var payload = JsonUtility.ToJson(myState);
var saved = await SusaPlaySDK.CloudSave.Save("main", payload);

if (saved.success)
{
    Debug.Log($"Now at version {saved.data.version}");
}
```

You do not pass a version. The platform assigns the next one and returns it.

## Multiple slots

Slots are independent — use them to separate concerns that change at different rates.

```csharp theme={null}
await SusaPlaySDK.CloudSave.Save("progress", progressJson);
await SusaPlaySDK.CloudSave.Save("settings", settingsJson);
```

## Concurrency

Writes are applied inside a server-side transaction, so two sessions writing the same slot
cannot corrupt each other — the later write wins and gets the higher version.

The SDK does not surface a merge hook. If your game can run in two tabs at once and you need
last-write-wins to be smarter than that, read before writing and merge in your own code.

## Limits

* 500 KB per slot
* Payloads above the limit are rejected server-side

## When a write fails

`success` is false. Common causes: payload too large, the player's session expired, or the shell
stopped responding. Keep the unsaved state in memory and retry rather than discarding progress.
