# Legacy Storage

#### Retrieve Player Storage

To view Player storage in the web console, go to the player and select the storage tab. From here it's possible to view and edit the data for the player.

![](/files/PwzTh0EbNSceTfjWylF6)

**Retrieve Entire Player Storage From Game**

{% tabs %}
{% tab title="Unity" %}

```csharp
LootLockerSDKManager.GetEntirePersistentStorage((response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully retrieved player storage: " + response.payload.Length);
    } else
    {
        Debug.Log("Error getting player storage");
    }
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/RBAjl7GhBum3TxeyOIMd" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/d_kdttxo/">Blueprint example of retrieving entire player storage</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}

```bash
curl -X GET "https://api.lootlocker.io/game/v1/player/storage" \
  -H "x-session-token: your_token_here"
```

Example response:

```json
{
  "success": true,
  "payload": [
    {
      "key": "user.answer",
      "value": "42",
      "is_public": false
    }
  ]
}
```

{% endtab %}
{% endtabs %}

**Retrieve Single Storage Value From Game**

{% tabs %}
{% tab title="Unity" %}

```csharp
string key = "some-key";
LootLockerSDKManager.GetSingleKeyPersistentStorage(key, (response) =>
{
    if (response.success)
    {
        if (response.payload != null)
        {
            Debug.Log("Successfully retrieved player storage with value: " + response.payload.value);
        } else
        {
            Debug.Log("Item with key " + key + " does not exist");
        }
    } else
    {
        Debug.Log("Error getting player storage");
    }
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/58Jiqi4AmmpCfGvRSt4v" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/xntq6m5x/">Blueprint example of retrieving a single storage value</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}

```bash
curl -X GET "https://api.lootlocker.io/game/v1/player/storage?key=user.something" \
  -H "x-session-token: your_token_here"
```

Example response:

```json
{
  "success": true,
  "payload": {
    "key": "user.answer",
    "value": "42",
    "is_public": false
  }
}
```

{% endtab %}
{% endtabs %}

#### Update Player Storage

To update a single value for a key

{% tabs %}
{% tab title="Unity" %}

```csharp
LootLockerSDKManager.UpdateOrCreateKeyValue("some-key", "some new value", (getPersistentStoragResponse) =>
{
    if (getPersistentStoragResponse.success)
    {
        Debug.Log("Successfully updated player storage");
    }
    else
    {
        Debug.Log("Error updating player storage");
    }
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/OTsMCczB1PjLa4cED9Cd" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/t5ustnxr/">Blueprint example of updating a single value</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}

```bash
curl -X POST "https://api.lootlocker.io/game/v1/player/storage" \
  -H "x-session-token: your_token_here" \
  -H "Content-Type: application/json" \
  -d '
[
  {
    "key": "totalDeaths",
    "value": "124",
    "is_public": true,
    "order": 1
  }
]'
```

{% endtab %}
{% endtabs %}

To update or create multiple keys at the same time

{% tabs %}
{% tab title="Unity" %}

```csharp
LootLockerGetPersistentStorageRequest data = new LootLockerGetPersistentStorageRequest();
data.AddToPayload(new LootLockerPayload { key = "some-key", value = "Some new value" });
data.AddToPayload(new LootLockerPayload { key = "some-other-key", value = "Some other new value" });

LootLockerSDKManager.UpdateOrCreateKeyValue(data, (getPersistentStoragResponse) =>
{
    if (getPersistentStoragResponse.success)
    {
        Debug.Log("Successfully updated player storage");
    }
    else
    {
        Debug.Log("Error updating player storage");
    }
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/kIcycoUgkMarOihTTkok" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/eu7ddj9-/">Blueprint example of creating or updating multiple keys</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}

```bash
curl -X POST "https://api.lootlocker.io/game/v1/player/storage" \
  -H "x-session-token: your_token_here" \
  -H "Content-Type: application/json" \
  -d '
[
  {
    "key": "totalDeaths",
    "value": "124",
    "is_public": true,
    "order": 1
  },
  {
    "key": "animal",
    "value": "Sheep",
    "order": 2
  }
]'
```

{% endtab %}
{% endtabs %}

#### Remove Player Storage Item

{% tabs %}
{% tab title="Unity" %}

```csharp
LootLockerSDKManager.DeleteKeyValue("some-key", (getPersistentStoragResponse) =>
{
    if (getPersistentStoragResponse.success)
    {
        Debug.Log("Successfully removed key from player storage");
    }
    else
    {
        Debug.Log("Error removing key from player storage");
    }
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/VYwavANp05mIvU2ffGz4" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/wzfkq1zb/">Blueprint example of deleting key</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}

```bash
curl -X DELETE "https://api.lootlocker.io/game/v1/player/storage?key=fruit" \
  -H "x-session-token: your_token_here"
```

{% endtab %}
{% endtabs %}

#### Get Other Players Public Storage

For this you need the public UID of the other player.

{% tabs %}
{% tab title="Unity" %}

```csharp
LootLockerSDKManager.GetOtherPlayersPublicKeyValuePairs("92AR9254", (response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully retrieved storage for other player " + response.payload.Length);
    }
    else
    {
        Debug.Log("Error retrieving storage for other player");
    }
});
```

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="/files/zRxJKVEVx0IV84MLhIC1" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/wzfkq1zb/">Blueprint example of deleting key</a></p></figcaption></figure>
{% endtab %}

{% tab title="REST" %}

#### Get by Player ID

```bash
curl -X GET "https://api.lootlocker.io/game/v1/player/1234/storage" \
  -H "x-session-token: your_token_here"
```

#### Get by Player Public UID

```bash
curl -X GET "https://api.lootlocker.io/game/v1/player/A1B2C3D4/storage" \
  -H "x-session-token: your_token_here"
```

Example response:

```json
{
  "success": true,
  "payload": [
    {
      "key": "user.answer",
      "value": "42",
      "is_public": true
    }
  ]
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lootlocker.com/legacy/storage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
