Skip to main content
Use GETBIT to read a single bit of the string stored at a key. The offset is counted in bits from the start of the value, so offset 0 is the most significant bit of the first byte. When the key does not exist, or the offset lies past the end of the stored string, the bit reads as 0 rather than producing an error.

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.

Related topics

GETBITOverview