Updated on 2026-04-30 GMT+08:00

Creating a Consumer Group or Batch Deleting Consumer Groups

Function

This API is used to create a consumer group or batch deleting consumer groups.

URI

POST /v2/{project_id}/instances/{instance_id}/groups

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For details about how to obtain it, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID. You can call the API for querying all instances to obtain the instance ID. The instance ID is in the response body.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

action

No

String

This parameter is used to delete consumer groups in batches. If it is not set, a consumer group will be created. delete: Delete consumer groups in batches.

Request Parameters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

groups

No

Array of DeleteConsumerGroupInBatch objects

Definition

List of consumer groups to be deleted.

Constraints

Mandatory for batch consumer group deletion.

Range

N/A

Default Value

N/A

name

No

String

Definition

Consumer group name.

Constraints

Enter 3 to 64 characters. Use only letters, digits, percent (%), vertical bars (|), hyphens (-), and underscores (_).

Mandatory for consumer group creation.

Range

N/A

Default Value

N/A

brokers

No

Array of strings

Definition

List of associated brokers.

Constraints

This parameter is mandatory only when you create a consumer group for a RocketMQ 4.8.0 instance.

Range

N/A

Default Value

N/A

broadcast

No

Boolean

Definition

Whether to set to broadcast consumption. Specify this parameter when creating a consumer group.

Constraints

N/A

Range

  • true: Yes

  • false: No

Default Value

N/A

retry_max_time

No

Integer

Definition

Maximum number of retries. Specify this parameter when creating a consumer group.

Constraints

N/A

Range

1–16

Default Value

N/A

enabled

No

Boolean

Definition

Whether to allow consumption. Specify this parameter when creating a consumer group.

Constraints

N/A

Range

  • true: Yes

  • false: No

Default Value

N/A

consume_orderly

No

Boolean

Definition

Whether to consume in order.

Constraints

This parameter is required only for RocketMQ 5.x instances. Specify this parameter when creating a consumer group.

Range

  • true: Yes

  • false: No

Default Value

N/A

group_desc

No

String

Definition

Consumer group description. Specify this parameter when creating a consumer group.

Constraints

N/A

Range

0–200

Default Value

N/A

Table 4 DeleteConsumerGroupInBatch

Parameter

Mandatory

Type

Description

name

No

String

Definition

Consumer group name.

Constraints

Enter 3 to 64 characters. Use only letters, digits, percent (%), vertical bars (|), hyphens (-), and underscores (_).

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

job_id

String

Definition

ID of the consumer group deletion task.

Constraints

N/A

Range

N/A

Default Value

N/A

name

String

Definition

Name of the created consumer group.

Constraints

N/A

Range

N/A

Default Value

N/A

Example Requests

  • For RocketMQ 4.8.0 instances: Creating a consumer group with broadcast consumption disabled, associated with broker-0, and max. 16 retries.

    POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/groups
    
    {
      "name" : "consumer-group-test",
      "group_desc" : "group_description",
      "brokers" : [ "broker-0" ],
      "broadcast" : false,
      "retry_max_time" : 16
    }
  • Deleting consumer group consumer-group-test.

    POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/groups?action=delete
    
    {
      "groups" : [ "group-1", "group-2" ]
    }

Example Responses

Status code: 200

A consumer group is created or multiple consumer groups are deleted in batches.

  • Creating a consumer group

    {
      "name" : "consumer-group-test"
    }
  • Consumer groups deleted

    {
      "job_id" : "ff8080829ae99a23019b240d388b4e47"
    }

Status Codes

Status Code

Description

200

A consumer group is created or multiple consumer groups are deleted in batches.

Error Codes

See Error Codes.