# Upstash API keys: find, store, rotate, and use them safely with AI agents

Source: https://botpassword.com/keys/upstash
Last checked: 2026-11-08

Upstash Redis shows the REST URL and token in the **Connect** section of the database page in the Upstash Console, and the same token is the database password for TCP clients. Upstash also issues a read-only token for the `default_ro` user, and separate Developer API keys under **Account → Developer API** for the Upstash CLI and management API.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| Redis REST token (database password) | — | Yes | Full read and write access to one database | — |
| Read-only token | — | Yes | Read-only access to one database through the `default_ro` user | — |
| Developer API key | — | Yes | Account management through the Developer API, the Upstash CLI and the MCP server; **Read/Write** or **Read Only** | Set when the key is created |

## How to create a Upstash key

1. Sign in to the Upstash Console and open your Redis database.
2. In the **Connect** section copy `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from the REST tab.
3. For a read-only token, open **Connect → TCP** and tick **Read-Only Token**.
4. For a Developer API key, open **Account → Developer API**, click **Create API Key**, choose a name, **Read/Write** or **Read Only** and an expiration, then click **Submit** and save the key.

## Limiting what the key can do

Upstash Redis has two built-in levels per database: the full token and the read-only `default_ro` token. Use the read-only token wherever writes are not needed. Developer API keys can be created as **Read Only** and with an expiration.

## How to rotate a Upstash key

1. Open the database's **Settings** tab and use **Reset Credentials**, or call `POST https://api.upstash.com/v2/redis/reset-password/{id}` with Developer API Basic auth.
2. Copy the new REST token and password from the **Connect** section.
3. Update `UPSTASH_REDIS_REST_TOKEN` and every Redis client connection string, then redeploy.

## How to revoke a Upstash key

1. Reset the database credentials from the **Settings** tab (**Reset Credentials**); the old token stops working.
2. Delete an exposed Developer API key under **Account → Developer API**.

## If the key leaked

1. Reset the database credentials from the database's **Settings** tab, or with the Developer API reset-password endpoint.
2. Delete any exposed Developer API key under **Account → Developer API** and create a replacement.
3. Update `UPSTASH_REDIS_REST_TOKEN` and other client configuration everywhere it is used, then redeploy.
4. Review the database contents for keys you did not write.

## Environment variables

- `UPSTASH_REDIS_REST_URL`
- `UPSTASH_REDIS_REST_TOKEN`
- `UPSTASH_EMAIL`
- `UPSTASH_API_KEY`

## Gotchas

- The REST token is also the Redis password, so leaking either exposes the whole database.
- `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` are for the HTTP-based `@upstash/redis` SDK; TCP clients need the endpoint, port and token instead.
- With Credential Protection (a Production Pack feature) Upstash does not store the credentials and shows them only once.
- Developer API keys only work for native Upstash accounts; databases created through the Vercel or Fly.io integrations are managed there.

## Using this key with AI agents (BotPassword)

- `run_with`: Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output.
- `http_request`: Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused.
- `rotate`: Partly built: creates a new key, stores it as pending, verifies it, promotes it, then revokes the old key after a grace period. Today it works for Cloudflare tokens and AWS IAM keys you have set up, and an agent can start it only under a grant with autopilot; other providers cannot be rotated through their API yet.
- `store_secret`: Saves a value the agent already holds as a new vault item.

## FAQ

### Where do I find my Upstash Redis token?

In the **Connect** section of the database page in the Upstash Console. The REST tab shows `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`.

### Is the Upstash Redis token the same as the password?

Yes. Upstash Redis has no separate password; Redis clients use the token as the password.

### How do I rotate an Upstash Redis token?

Use **Reset Credentials** on the database's **Settings** tab, or the Developer API reset-password endpoint, then update every client with the new token.

### Is there a read-only Upstash token?

Yes. Tick **Read-Only Token** under **Connect → TCP** to get the token for the `default_ro` user.

### What credentials does the Upstash CLI use?

The Upstash CLI uses your account email and a Developer API key, from `upstash login`, the `UPSTASH_EMAIL` and `UPSTASH_API_KEY` variables, or flags.

### Can an AI agent use my Upstash key without seeing it?

Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a `.env` file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with `run_with`, `http_request`, `store_secret`, so the agent gets the result and never the value.

## Sources

- https://upstash.com/docs/redis/howto/connectclient
- https://upstash.com/docs/redis/features/credential-protection
- https://upstash.com/docs/redis/troubleshooting/http_unauthorized
- https://upstash.com/docs/devops/developer-api/introduction
- https://upstash.com/docs/devops/developer-api/redis/reset_password
- https://upstash.com/docs/devops/cli/overview
- https://upstash.com/docs/redis/integrations/mcp
