All Products
Search
Document Center

API Gateway:Create a WebSocket API

Last Updated:Jun 03, 2026

WebSocket APIs enable bidirectional communication between clients and servers, ideal for real-time applications such as chat, notifications, and games. Create a WebSocket API in the Cloud-native API Gateway console.

Use cases

You can create APIs either within or outside an instance. Each method suits different use cases.

Create an API within an instance

  • Dedicated resource management: The API is used exclusively within a specific instance to manage specific resources or internal logic.

  • Security and isolation: Data or features require strict isolation and can be called only from within the instance.

  • Simplified service configuration: This method simplifies API management by confining configuration to a specific instance.

Create an API outside an instance

  • Cross-instance shared access: Allows multiple instances to share a single API definition.

  • Centralized management and monitoring: Unified permission control, logging, and traffic management.

Important
  • APIs created within an instance are visible and can be managed only in that instance.

  • APIs created outside an instance cannot be edited or deleted within an instance. You must manage them from the external API list.

Procedure

  1. Create APIs within or outside an instance:

    Outside an instance

    1. Log on to the Cloud-native API Gateway console. In the left-side navigation pane, select API, and select a region in the top menu bar.

    2. Click Create API, and click Create on the WebSocket API card.

    Within an instance

    1. Log on to the Cloud-native API Gateway console. In the left-side navigation pane, select Instance, and select a region in the top menu bar.

    2. On the Instance page, click the target instance ID. In the left-side navigation pane, select API, and click Create API in the upper-right corner.

    3. On the WebSocket API card, click Create.

  2. On the Create WebSocket API page, enter an API Name and Description, and select a target resource.

    Parameter

    Description

    API Name

    Specify a globally unique name for the API.

    Description

    Enter a description for the API.

    resource

    Select a resource group. Click Create Resource Group on the right to create one.