> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# XAUTOCLAIM

> Changes the ownership of pending messages from one consumer to another in a stream consumer group automatically.

## Arguments

<ParamField body="key" type="str" required>
  The key of the stream.
</ParamField>

<ParamField body="group" type="str" required>
  The consumer group name.
</ParamField>

<ParamField body="consumer" type="str" required>
  The consumer name that will claim the messages.
</ParamField>

<ParamField body="min_idle_time" type="int" required>
  The minimum idle time in milliseconds for messages to be claimed.
</ParamField>

<ParamField body="start" type="str" required>
  The stream entry ID to start claiming from.
</ParamField>

<ParamField body="count" type="int">
  The maximum number of messages to claim.
</ParamField>

<ParamField body="justid" type="bool">
  Return only the message IDs instead of the full message data.
</ParamField>

## Response

<ResponseField type="Tuple[str, List[Any], List[str]]">
  Returns a list containing:

  * Next start ID for pagination
  * List of claimed messages. If `justid` option is used, returns only message IDs.
  * List of deleted message IDs
</ResponseField>

<RequestExample>
  ```py Example theme={"system"}
  # Auto-claim messages that have been idle for more than 60 seconds
  result = redis.xautoclaim(
      "mystream",
      "mygroup", 
      "consumer1",
      60000,  # 60 seconds
      start="0-0"
  )
  ```

  ```py With count and justid theme={"system"}
  result = redis.xautoclaim(
      "mystream",
      "mygroup",
      "consumer1", 
      60000,
      start="0-0",
      count=5,
      justid=True
  )
  ```
</RequestExample>

<ResponseExample>
  ```py theme={"system"}
  [
    "1638360173533-1",  # next start ID
    [["1638360173533-0", ["field1", "value1", "field2", "value2"]]],  # claimed messages
    []  # deleted message IDs
  ]
  ```
</ResponseExample>
