Databases, search and data

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

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.

Upstash key types

TypePrefixSecret?ScopeExpiry
Redis REST token (database password)
There is no separate password; Redis clients use this token as the password.
—YesFull read and write access to one database—
Read-only token
Shown when you tick Read-Only Token under Connect → TCP.
—YesRead-only access to one database through the `default_ro` user—
Developer API key
Upstash does not store the key, so a lost key must be replaced. Only available to native Upstash accounts, not accounts created through Vercel or Fly.io.
—YesAccount 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.

Open Upstash's key settings

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.

Resetting replaces the database password, so clients using the old token fail until they are updated. With Credential Protection on, the new credentials are shown only once.

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 your Upstash 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 and CLI

Upstash's SDKs and docs read the key from UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN, UPSTASH_EMAIL or UPSTASH_API_KEY.

Upstash CLI (upstash): upstash login saves your email and Developer API key to ~/.config/upstash/config.json; scripts can set UPSTASH_EMAIL and UPSTASH_API_KEY instead

Things that catch people out

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

Common Upstash authentication errors

WRONGPASS invalid or missing auth token

The REST request has no token or the wrong one, often because UPSTASH_REDIS_REST_TOKEN is not loaded at runtime or the TCP password was used for HTTP.

Using your Upstash key with AI agents

A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.

BotPassword works this way. For a Upstash key, these intents fit:

IntentWhat BotPassword does
run_withRuns 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_requestMakes 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.
rotatePartly 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_secretSaves a value the agent already holds as a new vault item.

Upstash also publishes its own MCP server. Whatever server the agent uses, keep the credential it authenticates with out of the agent's context.

Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents

Frequently asked questions

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.

Stop pasting Upstash keys into agents

BotPassword is in early access. Request an invite and we'll email you when your spot opens.