Skip to main content
Use GET to read the string value stored at a key. The reply is null when the key does not exist, and an error when the key holds a value of another type, such as a hash or a list. Strings in Redis are binary safe and can hold anything up to 512 MB, so the same command reads back text, JSON, and serialized binary alike. To read and delete in one step use GETDEL, and to read and refresh the expiration use GETEX.

Syntax

Arguments

Response

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.