# Use App Data Storage

## Purpose

We can use have a built in key-value storage to store basic state between action runs or to help us centralize values we need across actions, like IDs. Note that key-value storage items are *always* stored as strings, so you may have to cast the type.

## Usage Examples

We can store our Airtable base ID, Google Sheets ID, or any other ID inkey-value storage so that we don’t have to copy/paste it into our actions. If we change the ID, we just change it in one location. You can set a key-value pair in the “App Data Storage” tab, then call it in your action with the following code:

```javascript
const base_id = kv.get("AIRTABLE_BASE_ID") // Returns the item from key-value storage
```

You can also set values in key-value storage. If the value does not exist in key-value storage then it will be created the first time the code is run. For example:

```javascript
kv.set("highScore", 500) // This will update "highScore" to "500" (string value)
```

## Prompting Tips

When you want our AI to generate code for you with key-value storage, mention that you want to use key-value storage like this:

> Use key-value storage to fetch the Airtable base ID. I called it AIRTABLE\_BASE\_ID.
