# Upstash Redis: pick REST or the native protocol before you write code

Upstash serves the same database two ways. Picking wrong costs you a rewrite later.

## Choose the REST API when

- You run on Cloudflare Workers, Fastly Compute@Edge, WASM, or any runtime
  where TCP sockets are unavailable. The Redis protocol is TCP based and
  simply cannot connect there.
- You run serverless functions (Lambda, Vercel) and do not want to manage
  connection pools across cold starts. REST is request based, no connections
  to babysit.
- You want to call Redis from any HTTP client, curl included, with no
  client library.

## Choose the native Redis protocol when

- You have legacy code built on ioredis, redis-py, jedis, or similar. Point
  it at Upstash with TLS on and it works with no code changes.
- You need the wider Redis ecosystem: BullMQ, Celery, Sidekiq, session
  stores for Express, and similar tooling that speaks RESP.
- You need blocking commands (BLPOP, BRPOP, blocking XREAD). These are not
  supported over REST.

## Rules that apply to both

- Pricing is per command/request on both paths. A chatty REST loop costs
  exactly as much as a chatty RESP loop.
- TLS is always on. There is no plaintext mode.
- Commands you cannot use over REST: blocking list/zset/stream pops,
  CLUSTER commands, and WATCH/UNWATCH/DISCARD inside transactions.

## Quick check

If your runtime can open a TCP socket and you already have Redis client
code, use the protocol. If your runtime is edge/serverless-first or you
are writing fresh agent code, use REST with the official SDK for your
language.