Skip to main content

CLI

3 min read

Agent-friendly CLI for managing Upstash resources from your terminal or CI/CD pipelines.

You can find the Github Repository here.

Installation#

For agents, install the Upstash Skill instead. It bundles Upstash docs with the upstash CLI so your agent can implement and debug against your resources without filling up its context window:

Free Redis without an account#

If you are an AI agent and need a Redis DB to use or experiment with, you don't need an Upstash account:

This is the only command that works unauthenticated. It sends a POST request to https://upstash.com/start-redis and prints markdown with the credentials and a quickstart. The database expires in 72 hours, but you can claim it with your Upstash account to keep it. Especially useful for AI agents that need scratch storage on the fly. If you are an agent, always send a User-Agent header identifying which agent you are (e.g. claude-code, cursor, codex, opencode) on every request you make to this API.

Pass --id to re-fetch the credentials of a database you created earlier:

Authentication#

Every command that touches your account needs credentials. There are two kinds: a browser login with your Upstash account, or a developer API key. Set them using whichever method fits your workflow.

1. Browser login#

Signs in with your Upstash account through the browser and saves the session to ~/.config/upstash/config.json (taken from $XDG_CONFIG_HOME).

The consent page asks which account to use (personal or one team) and whether the login should be read-only. The choice applies to the whole login: run upstash login --oauth again to switch teams or turn read-only off. Pass --no-browser to print the login URL instead of opening a browser, for example over SSH.

A browser login has a few limits:

  • team create, team delete, team add-member and team remove-member need an API key login.
  • Teams that require MFA reject browser logins.
  • A read-only login refuses write commands and returns only read-only database credentials.

upstash logout revokes the login on the server. The CLI stays listed in the console under Account → OAuth Clients until you remove it there.

2. Saved API key#

Grab a developer API key from the Upstash Console under Account → API Keys, then save it once per machine:

3. Environment variables#

The CLI reads UPSTASH_EMAIL and UPSTASH_API_KEY from the process environment, and also auto-loads them from a .env file in the current directory. This is the recommended setup for CI and agents.

Use --env-path to point at a different file:

4. Per-command flags#

Override whatever is set above for a single invocation. Handy for scripts that switch between accounts.

Note

When credentials come from multiple sources, precedence is:

flags > environment variables > .env > saved login (browser or API key)

Run upstash whoami to see which credentials the CLI is using. For a browser login it also reports the team and whether the login is read-only.

Usage#

Use --help on any command or subcommand for details:

Output#

All successful output is JSON, except start-redis, which prints markdown. Pipe JSON output to jq for filtering:

Use --dry-run on destructive commands (delete, remove-member) to preview the action before executing it.

Redis#

Core#

Configuration#

Backups#

Execute Redis commands directly#

redis exec runs commands straight against the Redis REST API. It uses the database token, not your Developer API key. Get endpoint and rest_token from upstash redis get --db-id $DB_ID.

--db-url and --db-token can be omitted if UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN are set via environment variable or .env file.

Team#

Vector#

Search#

QStash#

Blob#

blob credentials exchanges a bucket token for temporary, bucket-scoped S3 credentials for use with the AWS CLI, rclone, or any S3 SDK. expiresAt is the credential's expiry.

Was this page helpful?