> ## 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.

# XCLAIM

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

## Arguments

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

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

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

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

<ParamField body="ids" type="string | string[]" required>
  The ID(s) of the message(s) to claim. Can be a single ID or an array of IDs.
</ParamField>

<ParamField body="options">
  <Expandable title="options">
    <ParamField body="idle" type="number">
      Set the idle time of the message.
    </ParamField>

    <ParamField body="time" type="number">
      Set the idle time to a specific Unix time.
    </ParamField>

    <ParamField body="retryCount" type="number">
      Set the retry counter to the specified value.
    </ParamField>

    <ParamField body="force" type="boolean">
      Create the pending message entry even if certain IDs are not already pending.
    </ParamField>

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

## Response

<ResponseField type="Array<[string, string[]]> | string[]">
  Returns an array of claimed messages. If `justid` option is used, returns only message IDs.
</ResponseField>

<RequestExample>
  ```ts Basic claim theme={"system"}
  const result = await redis.xclaim(
    "mystream",
    "mygroup",
    "consumer1",
    60000,
    ["1638360173533-0", "1638360173533-1"]
  );
  ```

  ```ts With justid option theme={"system"}
  const result = await redis.xclaim(
    "mystream",
    "mygroup", 
    "consumer1",
    60000,
    ["1638360173533-0"],
    { justid: true, force: true }
  );
  ```
</RequestExample>

<ResponseExample>
  ```ts theme={"system"}
  [
    ["1638360173533-0", ["field1", "value1", "field2", "value2"]],
    ["1638360173533-1", ["field1", "value3", "field2", "value4"]]
  ]
  ```
</ResponseExample>
