Replace stream

Reconfigures an existing stream; the path names the stream, and the immutable fields (storage, retention) must restate what they are.

PUT /v1/mq/stream/{name}

Addresshttps://api.hanzo.ai/v1/mq/stream/{name}
MethodPUT
Operationput_mq_stream_by_name
AuthAuthorization: Bearer $HANZO_API_KEY

Reconfigures an existing stream; the path names the stream, and the immutable fields (storage, retention) must restate what they are.

Request

10 fields, body application/json (required).

FieldInTypeRequiredDescription
namepathstringyesName is the stream name, unique within the org (alphanumeric, hyphens, underscores).
max_agebodystring—MaxAge caps message age, e.g. "24h" or "7d"; "0" (default) is unlimited.
max_bytesbodyinteger (int64)—MaxBytes caps the stream's total stored bytes; -1 (default) is unlimited.
max_msg_sizebodyinteger (int32)—MaxMsgSize caps one message's size in bytes; -1 (default) is the broker's limit.
max_msgsbodyinteger (int64)—MaxMsgs caps the number of stored messages; -1 (default) is unlimited.
namebodystring—Name is the stream name, unique within the org (alphanumeric, hyphens, underscores).
num_replicasbodyinteger (int64)—Replicas is the number of stream replicas (1–5); this plane runs 1.
retentionbodystring—Retention is the retention policy: limits (default), interest, or workqueue.
storagebodystring—Storage is the storage backend: file (default) or memory.
subjectsbodystring[]—Subjects are the org-relative subjects bound to this stream (wildcards supported).

Response

StatusBodyMeaning
200mq.Streamok
defaultproblem-detailsrefused

200 body — 22 fields.

FieldInTypeAlwaysDescription
configbodymq.Config—
config.max_agebodystring—MaxAge caps message age, e.g. "24h" or "7d"; "0" (default) is unlimited.
config.max_bytesbodyinteger (int64)—MaxBytes caps the stream's total stored bytes; -1 (default) is unlimited.
config.max_msg_sizebodyinteger (int32)—MaxMsgSize caps one message's size in bytes; -1 (default) is the broker's limit.
config.max_msgsbodyinteger (int64)—MaxMsgs caps the number of stored messages; -1 (default) is unlimited.
config.namebodystring—Name is the stream name, unique within the org (alphanumeric, hyphens, underscores).
config.num_replicasbodyinteger (int64)—Replicas is the number of stream replicas (1–5); this plane runs 1.
config.retentionbodystring—Retention is the retention policy: limits (default), interest, or workqueue.
config.storagebodystring—Storage is the storage backend: file (default) or memory.
config.subjectsbodystring[]—Subjects are the org-relative subjects bound to this stream (wildcards supported).
createdbodystring (date-time)—Created is when the stream was created.
namebodystring—Name is the stream name within the org.
statebodymq.State—
state.bytesbodyinteger (uint64)—Bytes is the total stored size.
state.consumer_countbodyinteger (int64)—Consumers is the number of consumers attached to this stream.
state.first_seqbodyinteger (uint64)—FirstSeq is the sequence of the first stored message.
state.first_tsbodystring (date-time)—FirstTS is the timestamp of the first stored message.
state.last_seqbodyinteger (uint64)—LastSeq is the sequence of the last stored message.
state.last_tsbodystring (date-time)—LastTS is the timestamp of the last stored message.
state.messagesbodyinteger (uint64)—Messages is the number of messages currently stored.
state.num_deletedbodyinteger (int64)—Deleted is the number of deleted messages (sequence gaps).
state.num_subjectsbodyinteger (uint64)—Subjects is the number of distinct subjects stored.

Failure carries the platform error shape — see Errors.

Examples

hanzo mq stream set <name>
import { Configuration, MqApi } from 'hanzoai';

const api = new MqApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.putMqStreamByName({ name: 'name', max_age: "<max_age>", max_bytes: 0 });
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).put_mq_stream_by_name(name='name', max_age="<max_age>", max_bytes=0)
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.MqAPI.PutMqStreamByName(context.Background()).Execute()
if err != nil {
	return err
}
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::put_mq_stream_by_name(&cfg, Default::default()).await?;
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).putMqStreamByName();
curl -X PUT https://api.hanzo.ai/v1/mq/stream/<name> \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "max_age": "<max_age>",
       "max_bytes": 0
     }'

MCP reaches mq through the mq tool, which names its 15 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "get_mq_health"
         }
       }
     }'

MQ API · All Hanzo APIs · Interactive reference

Was this page useful?