Skip to main content
Use CLIENT ID to get the unique identifier the server assigned to the current connection. IDs are integers that never repeat and always increase, so a larger ID means a connection that was established later. The ID identifies this connection in CLIENT LIST output, which makes it useful when correlating application logs with server-side connection state.

Syntax

Arguments

This command takes no arguments.

Important points

  • This is a connection-oriented command and is available over native Redis TCP, not the stateless REST endpoint.
  • This command can expose administrative information or make a broad destructive change. Restrict it to trusted code paths.

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.