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

Sending a Message

Function

This API is used to send a message.

URI

POST /v2/{engine}/{project_id}/instances/{instance_id}/messages

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

engine

Yes

String

Definition

Engine.

Constraints

N/A

Range

  • rocketmq: RocketMQ message engine.

  • reliability: RocketMQ message engine alias.

Default Value

N/A

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

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

topic

Yes

String

Definition

Topic name.

Constraints

N/A

Range

N/A

Default Value

N/A

body

Yes

String

Definition

Message content.

Constraints

N/A

Range

N/A

Default Value

N/A

property_list

No

Array of SendMessagePropertiesReqEntity objects

Definition

Feature list.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 SendMessagePropertiesReqEntity

Parameter

Mandatory

Type

Description

name

No

String

Definition

Feature name.

Constraints

N/A

Range

  • KEYS: message ID, which is a string that uniquely identifies a message and is usually associated with the service primary key.

  • TAGS: tag, which is used to classify messages in the same topic.

Default Value

N/A

value

No

String

Definition

Feature value.

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

topic

String

Definition

Topic name.

Range

N/A

body

String

Definition

Message content.

Range

N/A

property_list

Array of SendMessagePropertiesRespEntity objects

Definition

Feature list.

msg_id

String

Definition

Message ID.

Range

N/A

queue_id

Number

Definition

Queue ID.

Range

N/A

queue_offset

Number

Definition

Queue offset.

Range

N/A

broker_name

String

Definition

Broker name.

Range

N/A

Table 5 SendMessagePropertiesRespEntity

Parameter

Type

Description

name

String

Definition

Feature name.

Range

  • KEYS: message ID, which is a string that uniquely identifies a message and is usually associated with the service primary key.

  • TAGS: tag, which is used to classify messages in the same topic.

  • UNIQ_KEY: built-in global unique identifier of RocketMQ.

value

String

Definition

Feature value.

Range

N/A

Example Requests

Sending a message

POST https://{endpoint}/v2/{engine}/{project_id}/instances/{instance_id}/messages

{
  "topic" : "aaaaaaaaaaaa",
  "body" : "test",
  "property_list" : [ ]
}

Example Responses

Status code: 200

Message sent.

{
  "topic" : "aaaaaaaaaaaa",
  "body" : "test",
  "property_list" : [ {
    "name" : "UNIQ_KEY",
    "value" : "644F0069A35A0FC5A0FC5AB7244F4573A03FA"
  } ],
  "msg_id" : "644F0E2A315323EAB33D8F4733110009",
  "queue_id" : 0,
  "queue_offset" : 0,
  "broker_name" : "broker-0"
}

Status Codes

Status Code

Description

200

Message sent.

Error Codes

See Error Codes.