All Products
Search
Document Center

API Gateway:Manage REST APIs

Last Updated:May 27, 2026

Publish, import, export, and unpublish REST APIs in the Cloud-native API Gateway console. You can also generate an SDK and its documentation in one click.

Publish an API

Prerequisites

Before you publish an API, ensure that its operations are defined and created.

Procedure

Cloud-native API Gateway supports two API types: Shared APIs and Instance-scoped APIs.

Shared API

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

  2. Click the name of the target API. In the upper-right corner, click Publish.

  3. In the Publish API panel, configure the parameters and click Publish.

    Parameter

    Description

    Domain Name

    Select a domain name. The API is accessible through this domain after publishing.

    If no domain name is available, click Add Domain Name. For more information, see Create a domain name.

    Instance

    Select a gateway instance. Use different instances to isolate environments.

    Scenario

    Scenarios include basic and canary release. For backend service types, see Routing.

    Basic scenarios

    • Mock: Returns a mock response based on the operation's mock configuration. Operations without a mock configuration are inaccessible.

      Note

      To publish in the mock scenario, at least one operation must have a mock configuration enabled. Otherwise, publication fails.

    • Single Service: Routes all requests to a single backend service. Most common use case.

    Canary release scenarios

    • By Percentage (Multi-service): Distributes traffic to backend services by percentage. Used for traffic shifting and canary releases.

      Note

      The sum of the weights for all services must be 100.

    • By Content (Multi-service): Routes traffic to different backend services based on matching conditions. The rule marked as Default handles unmatched traffic.

      • Supported match types: Equal, Prefix, and Regex.

      • Supported parameter locations: Query and Header.

      Multiple conditions are combined using AND logic.

      Important

      Only one rule can be set as the Default. All other rules must have a non-empty matching condition.

    • By Tag (Proportion-based Routing): Distributes traffic by percentage across versions of multiple backend services. For full-link canary releases, single-service routing is recommended.

    Backend Services

    Associate a backend service in the gateway or VPC. If none is available, click Create Service to Create a service.

    Publish Description

    Enter a description for this publication.

Instance-scoped API

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

  2. On the Instance page, click the ID of the target gateway instance. In the navigation pane on the left, choose API, and then click the target API.

  3. In the upper-right corner, click Publish. In the Publish API panel, configure the parameters and click Publish.

    Parameter

    Description

    Instance

    The instance where the API is published. Use different instances to isolate environments.

    VPC

    The VPC where the instance is located.

    Publish Scope

    The scope of API operations to publish. Click an operation name to view details.

    Publish Description

    Enter a description for this publication.

Add an API version

Important

Currently, you can add versions only to Shared APIs.

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

  2. Click the target API. In the upper-right corner, select More > Add Version, and configure the following parameters:

    Parameter

    Description

    Usage

    Supported methods: Path, Query, and Header.

    Note
    • If you select Query as the Usage, you must configure the Add Query parameter.

    • If you select Header as the Usage, you must configure the Add Header parameter.

    • When using the Path method, the full request path must be: /APIBasePath/VersionNumber/OperationPath.

    • When using the Query method, use the path /APIBasePath/OperationPath and include the version number in the query parameter specified by Add Query.

    • When using the Header method, use the path /APIBasePath/OperationPath and include the version number in the request header specified by Add Header.

  3. (Optional) After adding the version, click the Version tab at the top of the page to switch between versions.

View publish history

Note

The last 10 publication records are retained.

  1. View the publish history for Shared APIs or Instance-scoped APIs.

    Shared API

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

    2. Click the target API, and then click the Publish History tab.

    Instance-scoped API

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

    2. On the Instance page, click the ID of the target gateway instance. In the navigation pane on the left, choose API, click the target API, and then click the Publish History tab.

  2. In the Actions column for a historical version, click View to see its details.

Generate an SDK and documentation

  1. Generate an SDK and documentation for Shared APIs or Instance-scoped APIs.

    Shared API

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

    2. Click the target API. In the upper-right corner, select More > Generate SDK & Documentation.

    Instance-scoped API

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

    2. On the Instance page, click the ID of the target gateway instance. In the navigation pane on the left, choose API, and then click the target API.

    3. In the upper-right corner, select More > Generate SDK & Documentation.

  2. In the More > Generate SDK & Documentation dialog box, configure the parameters and click Generate and Download.

    Parameter

    Description

    API Version

    Select the API version for SDK and documentation generation.

    Note
    • Instance-scoped APIs do not support versioning, so this option is not available.

    • For Shared APIs, this option is available only if you enabled version management when you created the API.

    Language

    Supported SDK languages: Java, Golang, Python, Node.js, TypeScript, and Swift.

  3. The compressed package downloads automatically to your browser's default folder.

    Note

    After decompressing the package, see the README.md file for SDK usage instructions.

Import an API

  1. Import an API definition for Shared APIs or Instance-scoped APIs.

    Shared API

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

    2. Click the target API. In the upper-right corner, select More > Import.

    Instance-scoped API

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

    2. On the Instance page, click the ID of the target gateway instance. In the navigation pane on the left, choose API, and then click the target API.

    3. In the upper-right corner, select More > Import.

  2. In the Create File based on OpenAPI panel, configure the parameters, and then click Precheck and Create.

Export an API

  1. Export an API definition for Shared APIs or Instance-scoped APIs.

    Shared API

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

    2. Click the target API. In the upper-right corner, select More > Import.

    Instance-scoped API

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

    2. On the Instance page, click the ID of the target gateway instance. In the navigation pane on the left, choose API, and then click the target API.

    3. In the upper-right corner, select More > Import.

  2. In the Export dialog box, click OK. The API definition downloads to your browser's default download folder.

Unpublish an API

Important

After you unpublish an API, its operations become inaccessible through associated domain names. Requests are no longer processed, but configuration and publish history are retained. Proceed with caution.

  1. Unpublish a Shared API or Instance-scoped API.

    Shared API

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

    2. Click the target API. In the upper-right corner, select More > Shutdown.

    Instance-scoped API

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

    2. On the Instance page, click the ID of the target gateway instance. In the navigation pane on the left, choose API, and then click the target API.

    3. In the upper-right corner, select More > Shutdown.

  2. In the Confirm Unpublish dialog box, click Shutdown.

Delete an API

Important
  • Before you can delete a published API, you must first unpublish it from all instances.

  • Deleting an API permanently removes its configuration, documentation, and history. This action cannot be undone. Proceed with caution.

  1. Delete a Shared API or Instance-scoped API.

    Shared API

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

    2. Click the target API. In the upper-right corner, select More > Delete.

    Instance-scoped API

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

    2. On the Instance page, click the ID of the target gateway instance. In the navigation pane on the left, choose API, and then click the target API.

    3. In the upper-right corner, select More > Delete.

  2. In the Confirm deletion dialog box, click Delete.