All Products
Search
Document Center

ApsaraMQ for RocketMQ:CreateTopic

Last Updated:Jun 18, 2025
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Create Topic

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
rocketmq:CreateTopiccreate
*Topic
acs:rocketmq:{#regionId}:{#accountId}:instance/{#InstanceId}/topic/{#TopicName}
    none
none

Request syntax

POST /instances/{instanceId}/topics/{topicName} HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
instanceIdstringYes

The ID of the instance to which the topic to be created belongs.

rmq-cn-7e22ody****
topicNamestringYes

The name of the topic to be created, used for identifying the topic, and it must be globally unique.

Value specifications are as follows:

  • Character restrictions: Supports letters a~z or A~Z, numbers 0~9, and underscores (_), hyphens (-).
  • Length restrictions: 1 to 60 characters.

For reserved character restrictions, please refer to Parameter Restrictions.

topic_test
bodyobjectNo

The information about the topic.

messageTypestringNo

The type of messages in the topic that you want to create.

Valid values:

  • TRANSACTION: transactional messages
  • FIFO: ordered messages
  • DELAY: scheduled or delayed messages
  • NORMAL: normal messages
Note The type of messages in the topic must be the same as the type of messages that you want to send. For example, if you create a topic whose message type is ordered messages, you can use the topic to send and receive only ordered messages.
NORMAL
remarkstringNo

The description of the topic that you want to create.

This is the remark for test.
maxSendTpslongNo

The maximum TPS for message sending.

1500

Response parameters

ParameterTypeDescriptionExample
object

Result

requestIdstring

Request ID, each request's ID is unique and can be used for troubleshooting and problem localization.

AF9A8B10-C426-530F-A0DD-96320B39****
successboolean

Indicates whether the execution was successful.

true
databoolean

Return result.

true
codestring

Error code.

Topic.Existed
messagestring

Error message.

The topic already exists.
httpStatusCodeinteger

HTTP status code.

400
dynamicCodestring

Dynamic error code.

TopicName
dynamicMessagestring

Dynamic error message.

topicName

Examples

Sample success responses

JSONformat

{
  "requestId": "AF9A8B10-C426-530F-A0DD-96320B39****",
  "success": true,
  "data": true,
  "code": "Topic.Existed",
  "message": "The topic already exists.",
  "httpStatusCode": 400,
  "dynamicCode": "TopicName",
  "dynamicMessage": "topicName"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2025-01-02The internal configuration of the API is changed, but the call is not affectedView Change Details
2024-12-23The internal configuration of the API is changed, but the call is not affectedView Change Details