Requests
Clients send commands as arrays of bulk strings. The first element is the command name.
*2\r\n$3\r\nGET\r\n$3\r\nkey\r\n redis://wire-reference
Command shapes, RESP replies, and edge conditions for developers building clients, proxies, protocol test suites or Redis-compatible servers.
RESP primer
Clients send commands as arrays of bulk strings. The first element is the command name.
*2\r\n$3\r\nGET\r\n$3\r\nkey\r\n + simple string, - error, : integer, $ bulk string, * array.
Null is encoded as $-1\r\n or *-1\r\n, depending on context.
Adds native _ null, # boolean, , double, % map, ~ set, and > push.
Use HELLO 3 to switch a connection from RESP2 to RESP3.
Errors are RESP error replies: -PREFIX message\r\n. The prefix is the stable part clients should classify.
Common prefixes include ERR, WRONGTYPE, NOAUTH, NOSCRIPT, MOVED, ASK, and READONLY.
wire types
How the selected protocol represents each reply data type on the wire.
+OK\r\n Short non-binary string; no CR or LF inside payload.
-ERR message\r\n Error reply; classify Redis errors by the prefix before the first space.
:1000\r\n Signed decimal integer terminated by CRLF.
$5\r\n
hello\r\n Length-prefixed binary string; length is bytes, not characters.
$-1\r\n RESP2 null for missing bulk-string values.
*2\r\n
$3\r\n
one\r\n
$3\r\n
two\r\n Count followed by that many nested RESP values.
*-1\r\n RESP2 null for aggregate outcomes such as blocking pop timeout.
+OK\r\n Short non-binary string; still available in RESP3.
-ERR message\r\n Simple error; same prefix convention as RESP2.
:1000\r\n Signed decimal integer.
$5\r\n
hello\r\n RESP3 name for length-prefixed binary strings.
_\r\n Dedicated null type; replaces RESP2 null bulk/array ambiguity.
#t\r\n #t for true, #f for false.
,1.23\r\n Floating-point value; also supports inf, -inf, and nan.
(3492890328409238509324850943850943825024385\r\n Integer outside signed 64-bit range.
!20\r\n
SYNTAX invalid token\r\n Length-prefixed error payload.
=15\r\n
txt:Some string\r\n Length-prefixed string with a 3-byte format tag and colon.
*2\r\n
+one\r\n
+two\r\n Ordered aggregate of nested RESP values.
%1\r\n
+field\r\n
+value\r\n Key/value aggregate; count is number of pairs.
|1\r\n
+ttl\r\n
:30\r\n Out-of-band metadata attached to the following reply.
~2\r\n
+one\r\n
+two\r\n Unordered aggregate of unique values.
>3\r\n
+message\r\n
+channel\r\n
+payload\r\n Server-initiated data not necessarily tied to a request.
simpleRESP simple string bulkRESP2 bulk string blobRESP3 blob string intRESP integer null-bulkRESP2 $-1 null-arrayRESP2 *-1 nullRESP3 _ error<PREFIX>RESP error; classify by prefix replyany nested RESP reply Connection / Server
PING [message] Connection / Server
HELLO [protover [AUTH username password] [SETNAME clientname]] Connection / Server
AUTH [username] password Connection / Server
SELECT index Connection / Server
CLIENT subcommand [arg ...] Connection / Server
QUIT Connection / Server
INFO [section] Connection / Server
COMMAND [subcommand [arg ...]] Generic Keys
EXISTS key [key ...] Generic Keys
DEL key [key ...] Generic Keys
UNLINK key [key ...] Generic Keys
TYPE key Generic Keys
EXPIRE key seconds [NX | XX | GT | LT] Generic Keys
PEXPIRE key milliseconds [NX | XX | GT | LT] Generic Keys
TTL key Generic Keys
PTTL key Generic Keys
SCAN cursor [MATCH pattern] [COUNT count] [TYPE type] Generic Keys
KEYS pattern Generic Keys
RENAME key newkey Strings
GET key Strings
SET key value [NX | XX] [GET] [EX seconds | PX ms | EXAT unix | PXAT ms-unix | KEEPTTL] Strings
MGET key [key ...] Strings
MSET key value [key value ...] Strings
INCR key Strings
DECR key Strings
APPEND key value Strings
STRLEN key Strings
GETRANGE key start end Hashes
HGET key field Hashes
HSET key field value [field value ...] Hashes
HMGET key field [field ...] Hashes
HGETALL key Hashes
HDEL key field [field ...] Hashes
HEXISTS key field Hashes
HSCAN key cursor [MATCH pattern] [COUNT count] [NOVALUES] Lists
LPUSH key element [element ...] Lists
RPUSH key element [element ...] Lists
LPOP key [count] Lists
RPOP key [count] Lists
LRANGE key start stop Lists
LLEN key Lists
BLPOP key [key ...] timeout Lists
BRPOP key [key ...] timeout Sets
SADD key member [member ...] Sets
SREM key member [member ...] Sets
SMEMBERS key Sets
SISMEMBER key member Sets
SCARD key Sets
SSCAN key cursor [MATCH pattern] [COUNT count] Sorted Sets
ZADD key [NX | XX] [GT | LT] [CH] [INCR] score member [score member ...] Sorted Sets
ZRANGE key start stop [BYSCORE | BYLEX] [REV] [LIMIT offset count] [WITHSCORES] Sorted Sets
ZREM key member [member ...] Sorted Sets
ZSCORE key member Sorted Sets
ZRANK key member [WITHSCORE] Sorted Sets
ZCARD key Sorted Sets
ZSCAN key cursor [MATCH pattern] [COUNT count] Streams
XADD key [NOMKSTREAM] [KEEPREF | DELREF | ACKED] [MAXLEN | MINID [= | ~] threshold [LIMIT count]] id field value [field value ...] Streams
XRANGE key start end [COUNT count] Streams
XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] id [id ...] Streams
XGROUP subcommand key group [arg ...] Streams
XREADGROUP GROUP group consumer [COUNT count] [BLOCK ms] [NOACK] STREAMS key [key ...] id [id ...] Streams
XACK key group id [id ...] Pub/Sub
SUBSCRIBE channel [channel ...] Pub/Sub
PSUBSCRIBE pattern [pattern ...] Pub/Sub
PUBLISH channel message Pub/Sub
UNSUBSCRIBE [channel [channel ...]] Transactions
MULTI Transactions
EXEC Transactions
DISCARD Transactions
WATCH key [key ...] Transactions
UNWATCH Scripting
EVAL script numkeys [key [key ...]] [arg [arg ...]] Scripting
EVALSHA sha1 numkeys [key [key ...]] [arg [arg ...]] Scripting
SCRIPT LOAD script Scripting
SCRIPT EXISTS sha1 [sha1 ...] Cluster Basics
CLUSTER SLOTS Cluster Basics
CLUSTER NODES Cluster Basics
ASKING Cluster Basics
READONLY