Creates a topic.


You can call this operation to create a topic.

The name of the topic is a string that can be a maximum of 255 characters in length and can contain letters, digits, and hyphens (-). It must start with a letter or digit.


Each request consists of the following parts:

  • Request line

    PUT /topics/$TopicName HTTP/1.1

  • Operation-specific request headers


  • Request Body

    The request body is in the XML format. It contains the following parameters that are used to create a topic.

    Parameter Required Description Value
    MaximumMessageSize No The maximum size of the message body. Unit: bytes. Valid values: 1024 B to 65536 B. Data type: integer. Default value: 65536 B.
    LoggingEnabled No Indicates whether the log management feature is enabled for the queue. Valid values:
    • True: The log management feature is enabled.
    • False: The log management feature is disabled.
    Default value: False.


Each response consists of the following parts:

  • HTTP Status Code

    HTTP/1.1 201 Created

    The name of each topic must be unique in a region within an Alibaba Cloud account. If you create a topic whose name already exists, errors may occur. For example, if the parameters of the two topics are the same, the error code 204 (No Content) is returned. If the parameters of the two topics are different, the error code 409 (Conflict) is returned.

  • Operation-specific response headers
    Parameter Description
    Location The URL of the topic that was created. Syntax: http://$AccountId.mns. <Region>$TopicName.

    For more information about other response headers, see Common parameters.

  • Response Body



Sample requests

PUT /topics/$TopicName HTTP/1.1
Host: $
Date: Tue, 08 Dec 2015 05:57:57 GMT
x-mns-version: 2015-06-06
Authorization:MNS 15B4D3461F177624206A:eCtaUwfGS0oEfznzJEhWFxpf****

<? xml version="1.0" encoding="utf-8"? >
<Topic xmlns="">

Sample success responses

HTTP/1.1 201 Created
x-mns-version: 2015-06-06
Location: http://$$TopicName

Special error

Error code Error message HTTP status code
TopicAlreadyExist The topic you want to create is already exists. 409
TopicNameLengthError Topic name length is out of range, should be between 1 and 255. 400