Create Topic


Updated: May 14, 2015

Creates a new topic. Once created, this topic’s resource manifest is immutable. This operation is idempotent. Repeating the create call after a queue with same name has been created successfully, results in a “409 conflict” error message.

Please note the following:

  • The topic is not immediately deleted. It is marked for deletion and the resource management agent retrieves this deletion request within 5 minutes. However, the UI should reflect this operation immediately according to the received HTTP code.

  • The topic name is actually the URI path. The following regular expression validates each segment in the URI path after removing possible % encoding.

  • The topic name should comply with the following RegEx.

    public static readonly Regex SafeMessagingEntityNameExpression = new Regex(@"^[\w-\.\$]*/?$", RegexOptions.Compiled | RegexOptions.ECMAScript);

    This means the following:

    • Entity segments can contain only letters, numbers, periods (.), hyphens (-), and underscores (_).

    • Multiple segments are allowed (for example, if queue name = “a/b/c”, it contains three segments).

    • Forward slash (/) is not allowed as a prefix or suffix of the queue name.

    • Maximum number of characters is 50.


Request URI

HTTP version

PUT{subscription ID}/services/ServiceBus/Namespaces/{Namespace}/Topics/{Topic Path}


The following table describes required and optional request headers.

Request Header






Note that the request also requires a client certificate. This certificate must match the certificate you uploaded for that particular subscription.

The following table describes the key elements of the request body:

Property Name





Unsigned Integer


This parameter specifies the maximum topic size in megabytes. Any attempt to enqueue a message that causes the topic to exceed this value will fail. Only user content counts towards this value. Settable at topic creation time and at runtime:

  • Range: 1–5*1024.

  • Default: 1*1024.


Unsigned Integer

Read only. Not required at creation time.

This parameter reflects the actual number of bytes that messages in the topic currently occupy relative to the topic quota.

Range: 0 – MaxTopicSizeinMegaBytes


XML Datetime


Based on whether dead lettering is enabled, if a message has been stored in the topic for more than the specified time, it is automatically moved to the dead letter queue or deleted. This value is overwritten by a TTL specified on the message if the message TTL is smaller than the TTL set on the topic. This value is immutable after the topic has been created:

  • Range: 1 second – 14 days.

  • Default: 14 days.




Settable only at topic creation time.

  • Default for durable topic: False.




Settable only at topic creation time.

  • Default: False.

This field determines how Service Bus handles a message with an expired TTL. If it is enabled and a message expires, Service Bus moves the message from the topic into the dead-letter subqueue for that topic. If disabled, the message is permanently deleted from the topic.


Time Span


A property that specifies the time span during which Service Bus detects message duplication.

  • Range: 1 second – 7 days.

  • Default: 10 minutes.



Read only. Not required at creation time.

Number of topic subscriptions.



Read only.

One of the following values:

  •             Creating: when still in the creation phase.

  •             Active: by default after creation, or when the user activates it after last time suspended.

  •             Suspended: when the user updates the entity to be suspended.

The response includes an HTTP status code and a set of response headers.


If you create a topic with a name that contains special or encoded characters (for example, "test?Name=value&", which is encoded to "test%3FName%3Dvalue%26"), a (401) Unauthorized exception is generated.




Topic created successfully.


Invalid request body.


Authorization failure.


Quota exceeded; queue not updated.


Internal error.

For information about status codes, see Status and Error Codes.

Response Header




The topic description is returned, because if some description properties were missing from the PUT request, they might contain default values.