# Get consumer

URL: https://docs.hanzo.ai/docs/openapi/mq/get-mq-stream-by-stream-consumer-by-name

> Returns one consumer's configuration and delivery state.

`GET /v1/mq/stream/{stream}/consumer/{name}`

> [MQ →](https://docs.hanzo.ai/docs/openapi/mq) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                              |
| ------------- | ------------------------------------------------------------ |
| **Address**   | `https://api.hanzo.ai/v1/mq/stream/{stream}/consumer/{name}` |
| **Method**    | `GET`                                                        |
| **Operation** | `get_mq_stream_by_stream_consumer_by_name`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`                       |

Returns one consumer's configuration and delivery state.

## Request

2 fields.

| Field    | In   | Type   | Required | Description                               |
| -------- | ---- | ------ | -------- | ----------------------------------------- |
| `stream` | path | string | yes      | Stream is the stream name, from the path. |
| `name`   | path | string | yes      | Name is the consumer name, from the path. |

## Response

| Status    | Body            | Meaning |
| --------- | --------------- | ------- |
| `200`     | mq.Consumer     | ok      |
| `default` | problem-details | refused |

`200` body — 25 fields.

| Field                    | In   | Type               | Always | Description                                                                                                              |
| ------------------------ | ---- | ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------ |
| `ack_floor`              | body | mq.Sequences       | —      |                                                                                                                          |
| `ack_floor.consumer_seq` | body | integer (uint64)   | —      | Consumer is the consumer's own sequence.                                                                                 |
| `ack_floor.stream_seq`   | body | integer (uint64)   | —      | Stream is the corresponding stream sequence.                                                                             |
| `config`                 | body | mq.Durable         | —      |                                                                                                                          |
| `config.ack_policy`      | body | string             | —      | Ack is the acknowledgment policy: explicit (default), all, or none.                                                      |
| `config.ack_wait`        | body | string             | —      | AckWait is how long the broker waits for an ack before redelivering, e.g. "30s" (default).                               |
| `config.deliver_policy`  | body | string             | —      | Deliver is where delivery starts: all (default), last, new, by\_start\_sequence, by\_start\_time, or last\_per\_subject. |
| `config.description`     | body | string             | —      | Description says what this consumer is for.                                                                              |
| `config.durable_name`    | body | string             | —      | Name is the durable consumer name (alphanumeric, hyphens, underscores).                                                  |
| `config.filter_subject`  | body | string             | —      | Filter delivers only messages on this org-relative subject (wildcards supported).                                        |
| `config.max_ack_pending` | body | integer (int64)    | —      | MaxAckPending caps unacknowledged messages in flight (default 1000).                                                     |
| `config.max_deliver`     | body | integer (int64)    | —      | MaxDeliver caps delivery attempts per message; -1 (default) is unlimited.                                                |
| `config.opt_start_seq`   | body | integer (uint64)   | —      | StartSeq is the starting sequence for deliver\_policy by\_start\_sequence.                                               |
| `config.opt_start_time`  | body | string (date-time) | —      | StartTime is the starting instant for deliver\_policy by\_start\_time.                                                   |
| `config.replay_policy`   | body | string             | —      | Replay is the replay pacing: instant (default) or original.                                                              |
| `created`                | body | string (date-time) | —      | Created is when the consumer was created.                                                                                |
| `delivered`              | body | mq.Sequences       | —      |                                                                                                                          |
| `delivered.consumer_seq` | body | integer (uint64)   | —      | Consumer is the consumer's own sequence.                                                                                 |
| `delivered.stream_seq`   | body | integer (uint64)   | —      | Stream is the corresponding stream sequence.                                                                             |
| `name`                   | body | string             | —      | Name is the consumer name.                                                                                               |
| `num_ack_pending`        | body | integer (int64)    | —      | AckPending is the number of delivered, not yet acknowledged messages.                                                    |
| `num_pending`            | body | integer (uint64)   | —      | Pending is the number of messages yet to be delivered.                                                                   |
| `num_redelivered`        | body | integer (int64)    | —      | Redelivered is the number of messages currently being redelivered.                                                       |
| `num_waiting`            | body | integer (int64)    | —      | Waiting is the number of pull requests waiting for messages.                                                             |
| `stream_name`            | body | string             | —      | Stream is the stream this consumer reads.                                                                                |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo mq stream consumer get <stream> <name>
```

**SDK**

**.ts**

```ts
import { Configuration, MqApi } from 'hanzoai';

const api = new MqApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getMqStreamByStreamConsumerByName({ stream: 'stream', name: 'name' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import MqApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = MqApi(client).get_mq_stream_by_stream_consumer_by_name(stream='stream', name='name')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.MqAPI.GetMqStreamByStreamConsumerByName(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, mq_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = mq_api::get_mq_stream_by_stream_consumer_by_name(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.MqApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new MqApi(client).getMqStreamByStreamConsumerByName();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/mq/stream/<stream>/consumer/<name> \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `mq`, op `get_mq_stream_by_stream_consumer_by_name` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "mq",
         "arguments": {
           "op": "get_mq_stream_by_stream_consumer_by_name",
           "input": {
             "stream": "<stream>",
             "name": "<name>"
           }
         }
       }
     }'
```

---

[MQ API](https://docs.hanzo.ai/docs/openapi/mq) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
