{
  "id": "xcfgset",
  "title": "XCFGSET",
  "url": "https://redis.io/docs/latest/commands/xcfgset/",
  "summary": "Sets the IDMP configuration parameters for a stream.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-01T08:10:08-05:00",
  "page_type": "content",
  "content_hash": "65525d30b3780a4df23d8667117c2161937b52d83304b107f6ffaf903a52fc46",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Sets the IDMP (Idempotent Message Processing) configuration parameters for a stream. This command configures how long idempotent IDs are retained and the maximum number of idempotent IDs tracked per producer."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the stream key. The stream must already exist.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>IDMP-DURATION idmp-duration</code></summary>\n\nSets the duration in seconds that each idempotent ID (iid) is kept in the stream's IDMP map. Valid range: 1-86,400 seconds. Default: 100 seconds.\n\nWhen an idempotent ID expires, it can be reused for new messages. This provides an operational guarantee that Redis will not forget an idempotency ID before the duration elapses (unless capacity is reached).\n\n</details>\n\n<details open><summary><code>IDMP-MAXSIZE idmp-maxsize</code></summary>\n\nSets the maximum number of most recent idempotent IDs kept for each producer in the stream's IDMP map. Valid range: 1-10,000 entries. Default: 100 entries.\n\nWhen the capacity is reached, the oldest idempotent IDs for that producer are evicted regardless of remaining duration. This prevents unbounded memory growth.\n\n</details>"
    },
    {
      "id": "behavior",
      "title": "Behavior",
      "role": "content",
      "text": "- Calling `XCFGSET` clears all existing producer IDMP maps for the stream.\n- At least one of `IDMP-DURATION` or `IDMP-MAXSIZE` must be specified.\n- The stream must exist before calling this command.\n- Configuration changes apply immediately to all future IDMP operations."
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[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=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK` if the configuration was set successfully.\n\n**RESP3:**\n\n[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK` if the configuration was set successfully."
    },
    {
      "id": "error-conditions",
      "title": "Error conditions",
      "role": "errors",
      "text": "The command returns an error in the following cases:\n\n- **WRONGTYPE**: The key exists but is not a stream\n- **ERR no such key**: The stream does not exist\n- **ERR syntax error**: Invalid command syntax or missing required arguments\n- **ERR invalid duration**: Duration value is outside the valid range (1-86,400)\n- **ERR invalid maxsize**: Maxsize value is outside the valid range (1-10,000)"
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "redis-cli",
      "code": "XADD mystream * field value\nXCFGSET mystream IDMP-DURATION 300\nXCFGSET mystream IDMP-MAXSIZE 1000\nXCFGSET mystream IDMP-DURATION 600 IDMP-MAXSIZE 500",
      "section_id": "examples"
    }
  ]
}
