> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

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

You can find the Github Repository [here](https://github.com/upstash/cli).

# Installation

```bash theme={"system"}
npm i -g @upstash/cli
```

For agents, install the [Upstash Skill](/docs/agent-resources/skills) 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:

```bash theme={"system"}
npx skills add upstash/skills
```

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

```bash theme={"system"}
upstash start-redis
```

This is the only command that works unauthenticated. It sends a POST request to [https://upstash.com/start-redis](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.

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

```bash theme={"system"}
upstash start-redis --id $DB_ID
```

# Authentication

The CLI needs your account email and a developer API key. Grab one from the [Upstash Console under Account → API Keys](https://console.upstash.com/account/api), then set credentials using whichever method fits your workflow.

## 1. Saved login (recommended)

Saves your credentials to `~/.config/upstash/config.json` (taken from `$XDG_CONFIG_HOME`) so you only have to do it once per machine.

```bash theme={"system"}
upstash login
```

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

```bash theme={"system"}
# Exported in your shell or CI
export UPSTASH_EMAIL=you@example.com
export UPSTASH_API_KEY=your_api_key
```

```bash theme={"system"}
# Or defined in the .env file of your current working directory (loaded automatically)
UPSTASH_EMAIL=you@example.com
UPSTASH_API_KEY=your_api_key
```

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

```bash theme={"system"}
upstash --env-path .dev.vars redis list
```

## 3. Per-command flags

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

```bash theme={"system"}
upstash --email you@example.com --api-key your_api_key redis list
```

<Note>
  When credentials come from multiple sources, precedence is:

  `flags` > `environment variables` > `.env` > `saved config file`
</Note>

# Usage

```bash theme={"system"}
upstash start-redis  # free temporary Redis database, no account needed
upstash redis   # Redis databases
upstash team    # Teams and members
upstash vector  # Vector indexes
upstash search  # Search indexes
upstash qstash  # QStash instances
```

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

```bash theme={"system"}
upstash --help
upstash redis --help
upstash redis create --help
```

## Output

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

```bash theme={"system"}
upstash redis list | jq '.[].database_id'
upstash vector list | jq '.[] | {id, name, region}'
upstash qstash list | jq '.[] | {id, region}'
upstash team members --team-id $TEAM_ID | jq '.[].member_email'
```

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

# Redis

## Core

```bash theme={"system"}
upstash redis list
upstash redis get --db-id $DB_ID
upstash redis get --db-id $DB_ID --hide-credentials
upstash redis create --name $NAME --region $REGION
upstash redis create --name $NAME --region $REGION --read-regions $REGION_1 $REGION_2
upstash redis delete --db-id $DB_ID --dry-run
upstash redis delete --db-id $DB_ID
upstash redis rename --db-id $DB_ID --name $NEW_NAME
upstash redis reset-password --db-id $DB_ID
upstash redis stats --db-id $DB_ID
```

## Configuration

```bash theme={"system"}
upstash redis enable-tls --db-id $DB_ID
upstash redis enable-eviction --db-id $DB_ID
upstash redis disable-eviction --db-id $DB_ID
upstash redis enable-autoupgrade --db-id $DB_ID
upstash redis disable-autoupgrade --db-id $DB_ID
upstash redis change-plan --db-id $DB_ID --plan $PLAN        # free, payg, pro, paid
upstash redis update-budget --db-id $DB_ID --budget $BUDGET_CENTS
upstash redis update-regions --db-id $DB_ID --read-regions $REGION_1 $REGION_2
upstash redis move-to-team --db-id $DB_ID --team-id $TEAM_ID
```

## Backups

```bash theme={"system"}
upstash redis backup list --db-id $DB_ID
upstash redis backup create --db-id $DB_ID --name $NAME
upstash redis backup delete --db-id $DB_ID --backup-id $BACKUP_ID --dry-run
upstash redis backup delete --db-id $DB_ID --backup-id $BACKUP_ID
upstash redis backup restore --db-id $DB_ID --backup-id $BACKUP_ID
upstash redis backup enable-daily --db-id $DB_ID
upstash redis backup disable-daily --db-id $DB_ID
```

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

```bash theme={"system"}
upstash redis exec --db-url $REDIS_URL --db-token $REDIS_TOKEN SET key value
upstash redis exec --db-url $REDIS_URL --db-token $REDIS_TOKEN GET key
upstash redis exec --db-url $REDIS_URL --db-token $REDIS_TOKEN --json '["SET","key","value"]'
```

`--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

```bash theme={"system"}
upstash team list
upstash team create --name $NAME
upstash team create --name $NAME --copy-cc
upstash team delete --team-id $TEAM_ID --dry-run
upstash team delete --team-id $TEAM_ID
upstash team members --team-id $TEAM_ID
upstash team add-member --team-id $TEAM_ID --member-email $EMAIL --role $ROLE
upstash team remove-member --team-id $TEAM_ID --member-email $EMAIL --dry-run
upstash team remove-member --team-id $TEAM_ID --member-email $EMAIL
```

# Vector

```bash theme={"system"}
upstash vector list
upstash vector get --index-id $INDEX_ID
upstash vector create --name $NAME --region $REGION --similarity-function $FUNCTION --dimension-count $DIMENSION
upstash vector delete --index-id $INDEX_ID --dry-run
upstash vector delete --index-id $INDEX_ID
upstash vector rename --index-id $INDEX_ID --name $NEW_NAME
upstash vector reset-password --index-id $INDEX_ID
upstash vector set-plan --index-id $INDEX_ID --plan $PLAN          # free, payg, fixed
upstash vector transfer --index-id $INDEX_ID --target-account $TARGET_ACCOUNT_ID
upstash vector stats
upstash vector index-stats --index-id $INDEX_ID
upstash vector index-stats --index-id $INDEX_ID --period $PERIOD   # 1h, 3h, 12h, 1d, 3d, 7d, 30d
```

# Search

```bash theme={"system"}
upstash search list
upstash search get --index-id $INDEX_ID
upstash search create --name $NAME --region $REGION --type $INDEX_TYPE
upstash search delete --index-id $INDEX_ID --dry-run
upstash search delete --index-id $INDEX_ID
upstash search rename --index-id $INDEX_ID --name $NEW_NAME
upstash search reset-password --index-id $INDEX_ID
upstash search transfer --index-id $INDEX_ID --target-account $TARGET_ACCOUNT_ID
upstash search stats
upstash search index-stats --index-id $INDEX_ID
upstash search index-stats --index-id $INDEX_ID --period $PERIOD   # 1h, 3h, 12h, 1d, 3d, 7d, 30d
```

# QStash

```bash theme={"system"}
upstash qstash list
upstash qstash get --qstash-id $QSTASH_ID
upstash qstash rotate-token --qstash-id $QSTASH_ID
upstash qstash set-plan --qstash-id $QSTASH_ID --plan $PLAN             # paid, qstash_fixed_1m, qstash_fixed_10m, qstash_fixed_100m
upstash qstash stats --qstash-id $QSTASH_ID
upstash qstash stats --qstash-id $QSTASH_ID --period $PERIOD            # 1h, 3h, 12h, 1d, 3d, 7d, 30d
upstash qstash ipv4
upstash qstash move-to-team --qstash-id $QSTASH_ID --target-team-id $TARGET_TEAM_ID
upstash qstash update-budget --qstash-id $QSTASH_ID --budget $BUDGET_DOLLARS   # 0 = no limit
upstash qstash enable-prodpack --qstash-id $QSTASH_ID
upstash qstash disable-prodpack --qstash-id $QSTASH_ID
```
