# Data Store

The Data Store provides simple key/value persistent storage. The Data Store API can be accessed using `Platform.Server.DataStore`.

* Data Store is durable. Data saved will not be deleted or cleaned up.
* The Data Store API can only be used on the server.
* Data Store is slower than Cache Store.

Some common use cases for the Data Store are:

* User Profiles
* Tracking Unlocks
* Persistent Inventory

{% hint style="info" %}
Data Store is intended to be used for general purpose persistent key/value storage. Check out [Cache Store](/platform-services/cache-store.md), [Leaderboards](/platform-services/leaderboards.md), and [Platform Inventory](/platform-services/platform-inventory.md) for more specialized data storage situations.
{% endhint %}

{% hint style="info" %}
Data store keys must be alphanumeric and only contain allowed symbols: -, ., \_, :
{% endhint %}

## Common Patterns

```typescript
// Store user unlocks
const unlocks: UnlockData = {
    level1: true,
    level2: true,
    level3: false,
}
await Platform.Server.DataStore.SetKey(`Unlocks:${player.userId}`, unlocks);

// Get user unlocks
const result = await Platform.Server.DataStore.GetKey<UnlockData>(
    `Unlocks:${player.userId}`,
);
if (!result) return; // Key did not exist

// Check if user has unlocked level2
if (result.level2) {
    // Unlocked!
}
```


---

# 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.airship.gg/platform-services/data-store.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.
