{
  "schema_version": 2,
  "id": "commands/topk.list",
  "title": "TOPK.LIST",
  "url": "https://redis.io/docs/latest/commands/topk.list/",
  "summary": "Return the full list of items in the Top-K sketch",
  "since": "2.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:54+01:00",
  "page_type": "content",
  "content_hash": "41b89b5903c744056d5b70d5e76da778fe93ac1b8af2475e6314284b523f7ed6",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Return the full list of items in Top-K sketch."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nthe name of the sketch.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>WITHCOUNT</code></summary>\n\nthe count of each element is also returned.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]\n\n[code example]"
    },
    {
      "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; Supported</span><br /> | <span title=\"Supported\">&#x2705; Flexible & Annual</span><br /><span title=\"Supported\">&#x2705; Free & Fixed</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "k (or less) items in the given Top-k sketch. The list is sorted by decreased count estimation.\n\n**RESP2:**\n\nOne of the following:\n\n* [Array](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) of [bulk string replies](https://redis.io/docs/latest/develop/reference/protocol-spec#bulk-strings) representing the names of items in the given sketch. If `WITHCOUNT` is requested, an [array](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) of [bulk string reply](https://redis.io/docs/latest/develop/reference/protocol-spec#bulk-strings) and \n[integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers) pairs, representing the names of the items in the sketch together with their counts.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) in these cases: invalid arguments, non-existant key, or key of the incorrect type.\n\n**RESP3:**\n\nOne of the following:\n\n* [Array](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) of [bulk string replies](https://redis.io/docs/latest/develop/reference/protocol-spec#bulk-strings) representing the names of items in the given sketch. If `WITHCOUNT` is requested, an [array](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) of [bulk string reply](https://redis.io/docs/latest/develop/reference/protocol-spec#bulk-strings) and \n[integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers) pairs, representing the names of the items in the sketch together with their counts.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) in these cases: invalid arguments, non-existant key, or key of the incorrect type."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "TOPK.LIST topk\n1) foo\n2) 42\n3) bar",
      "section_id": "examples"
    },
    {
      "id": "examples-ex1",
      "language": "plaintext",
      "code": "TOPK.LIST topk WITHCOUNT\n1) foo\n2) (integer) 12\n3) 42\n4) (integer) 7\n5) bar\n6) (integer) 2",
      "section_id": "examples"
    }
  ]
}
