---
title: XCLAIM
description: 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="justId" type="boolean">
      Return only the message IDs instead of the full message data.
    </ParamField>
  </Expandable>
</ParamField>

<Note>
Upstash Redis does not support the `IDLE`, `TIME`, `RETRYCOUNT`, `FORCE`, and `LASTID` options of XCLAIM, so the SDK's `idleMS`, `retryCount`, `force`, and `lastId` options fail with an error. `timeMS` is only sent together with `idleMS`, so on its own it is ignored.
</Note>

## 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
const result = await redis.xclaim(
  "mystream",
  "mygroup",
  "consumer1",
  60000,
  ["1638360173533-0", "1638360173533-1"]
);
```

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

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