> For the complete documentation index, see [llms.txt](https://deplyr.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://deplyr.gitbook.io/docs/how-to-guides/use-app-data-storage.md).

# 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://deplyr.gitbook.io/docs/how-to-guides/use-app-data-storage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
