11---
2- last_modified : 2026-02-13
2+ last_modified : 2026-06-05
33title : Deno KV
44description : Use Deno KV in your applications with a dedicated database per timeline
55oldUrl : /deploy/reference/deno-kv/
@@ -34,11 +34,11 @@ keeps your production data safe while you develop and test. You can monitor
3434provisioning and watch the status change to "Connected." If any errors occur,
3535click "Fix" to retry.
3636
37- ## Using Deno KV in Your Code
37+ ## Connect from Deno Deploy
3838
3939Once you've assigned a database to your app, connecting from code is simple.
4040Deno Deploy sets up the connection to the correct database based on the current
41- environment.
41+ environment — no database ID or access token required .
4242
4343### Example
4444
@@ -58,6 +58,31 @@ Deno.serve(async () => {
5858For detailed information about Deno KV and its features, see the
5959[ Deno KV documentation] [ Deno KV ] .
6060
61+ ## Connect from outside Deno Deploy
62+
63+ You can also open a managed Deno KV database from local Deno CLI apps using the
64+ URL connector:
65+
66+ ``` typescript
67+ const kv = await Deno .openKv (
68+ " https://api.deno.com/v2/databases/<Database ID>/connect" ,
69+ );
70+ ```
71+
72+ Replace ` <Database ID> ` with the ID of the database you want to connect to. Each
73+ database's ID is shown in the Databases table on the database instance page in
74+ the Deno Deploy console.
75+
76+ Authenticate the connection by setting either a personal or an organization
77+ access token as the ` DENO_KV_ACCESS_TOKEN ` environment variable:
78+
79+ ``` bash
80+ export DENO_KV_ACCESS_TOKEN=ddo_...
81+ ```
82+
83+ Organization access tokens can be created from your organization's settings page
84+ in the Deno Deploy console.
85+
6186## Un-assigning a KV database
6287
6388If you remove a database assignment from an app, the app will no longer be able
@@ -86,9 +111,11 @@ such as our
86111
87112## Data storage
88113
89- In local development, data is kept in memory. You do not need to create or
90- allocate a database before using the KV APIs locally, and your KV code remains
91- consistent across environments.
114+ By default, in local development data is kept in memory. You do not need to
115+ create or allocate a database before using the KV APIs locally, and your KV code
116+ remains consistent across environments. To develop against a managed Deno KV
117+ database from a local Deno program instead, see
118+ [ Connect from outside Deno Deploy] ( #connect-from-outside-deno-deploy ) .
92119
93120## Deleting a database instance
94121
0 commit comments