{
  "schema_version": 2,
  "id": "commands/client-id",
  "title": "CLIENT ID",
  "url": "https://redis.io/docs/latest/commands/client-id/",
  "summary": "Returns the unique client ID of the connection.",
  "since": "5.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:21+01:00",
  "page_type": "content",
  "content_hash": "e9ba14ccf0ab61183e349dddb87e0e13cdc4fa650bb3a007def4298a3afee655",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "The command just returns the ID of the current connection. Every connection\nID has certain guarantees:\n\n1. It is never repeated, so if `CLIENT ID` returns the same number, the caller can be sure that the underlying client did not disconnect and reconnect the connection, but it is still the same connection.\n2. The ID is monotonically incremental. If the ID of a connection is greater than the ID of another connection, it is guaranteed that the second connection was established with the server at a later time.\n\nThis command is especially useful together with [`CLIENT UNBLOCK`](https://redis.io/docs/latest/commands/client-unblock) which was\nintroduced also in Redis 5 together with `CLIENT ID`. Check the [`CLIENT UNBLOCK`](https://redis.io/docs/latest/commands/client-unblock) command page for a pattern involving the two commands."
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> CLIENT ID"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | Because Redis Software clustering allows [multiple active proxies](https://redis.io/docs/latest/operate/rs/databases/configure/proxy-policy), `CLIENT ID` cannot guarantee incremental IDs between clients that connect to different nodes under multi proxy policies. |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): the ID of the client.\n\n**RESP3:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): the ID of the client."
    }
  ],
  "examples": []
}
