Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 216 additions & 0 deletions agent-resources/cli.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
---
title: 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
npm i -g @upstash/cli
```

For agents, install the [Upstash Skill](/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
npx skills add upstash/skills
```

# 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
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
# Exported in your shell or CI
export UPSTASH_EMAIL=you@example.com
export UPSTASH_API_KEY=your_api_key
```

```bash
# 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
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
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
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
upstash --help
upstash redis --help
upstash redis create --help
```

## Output

All successful output is JSON. Pipe it to `jq` for filtering:

```bash
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
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
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
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
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
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
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
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
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
```
4 changes: 4 additions & 0 deletions agent-resources/llms-txt.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: llms.txt
url: https://upstash.com/docs/llms.txt
---
Loading