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

Creating a Virtual Host

Function

This API is used to create a virtual host.

Calling Method

For details, see Calling APIs.

URI

PUT /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Virtual host name.

Constraints

  • The value can only include letters, digits, periods (.), percent signs (%), vertical bars (|), hyphens (-), underscores (_), and slashes (/).

  • Version 3.x.x: The range is 2 to 128 characters.

  • Version AMQP-0-9-1: The range is 2 to 32 characters. When calculating the length of a virtual host name for an AMQP-0-9-1 instance, each special character (period, percent sign, vertical bar, and slash) counts as three characters.

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Virtual host created.

None

Example Requests

Creating a virtual host named vhost-demo

PUT https://{endpoint}/v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts

{
  "name" : "vhost-demo"
}

Example Responses

None

Status Codes

Status Code

Description

200

Virtual host created.

Error Codes

See Error Codes.