All Products
Search
Document Center

API Gateway:CreateService

Last Updated:Jul 09, 2026

Creates services.

Operation description

This operation supports creating multiple services.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

apig:CreateService

none

*Service

acs:apig:{#regionId}:{#accountId}:service/*

None None

Request syntax

POST /v1/services HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

gatewayId

string

No

The gateway ID.

gw-cq7l5s5lhtg***

sourceType

string

No

The service source. Valid values:

  • MSE_NACOS: a service in MSE Nacos.

  • K8S: a service in a Kubernetes cluster of Container Service.

  • VIP: a fixed address service.

  • DNS: a DNS domain name service.

  • FC3: a service in Function Compute.

  • SAE_K8S_SERVICE: an SAE Kubernetes service.

  • AI: an AI service.

  • AGENT: an Agent service.

Valid values:

  • AGENT :

    Agent service.

  • SAE_K8S_SERVICE :

    SAE_K8S_SERVICE

  • K8S :

    Container Service.

  • FC3 :

    Function Compute service.

  • DNS :

    DNS domain name.

  • AI :

    AI service.

  • VIP :

    Fixed address.

  • MSE_NACOS :

    MSE Nacos

MSE_NACOS

serviceConfigs

array<object>

No

The list of service configurations. At least one service configuration is required.

array<object>

No

The service configuration information.

name

string

No

The service name.

user-service

namespace

string

No

The namespace of the service.

  • If sourceType is set to K8S, this parameter specifies the namespace of the Kubernetes service.

  • If sourceType is set to MSE_NACOS, this parameter specifies the namespace in Nacos.

This parameter is required when sourceType is set to K8S or MSE_NACOS.

PUBLIC

groupName

string

No

The service group name. This parameter is required when sourceType is set to MSE_NACOS.

DEFAULT_GROUP

addresses

array

No

The list of domain names or fixed addresses.

string

No

The domain name or fixed address.

dev.com:8080

qualifier

string

No

The function version or alias.

LATEST

aiServiceConfig AiServiceConfig

No

The AI service configuration.

agentServiceConfig AgentServiceConfig

No

The Agent service configuration. This parameter is required when sourceType is set to AGENT.

modelProviderId

string

No

The model provider ID.

mp-xxx****

dnsServers

array

No

The list of DNS server addresses.

string

No

The DNS server address.

100.100.1.156:53

sourceId

string

No

The service source ID. This parameter is required in multi-Nacos instance scenarios.

nacos-instance-001

validationOptions

object

No

The validation options. Configuration options related to service validation.

skipVerifyAIChatCompletion

boolean

No

Specifies whether to skip AI chat completion verification.

expressType

string

No

The service expression type. Identifies the special type or mode of the service.

Standard

resourceGroupId

string

No

The resource group ID.

rg-xxx

clientToken

string

No

The client token.

xxx

Response elements

Element

Type

Description

Example

object

The response body.

requestId

string

The request ID.

C67DED2B-F19B-5BEC-88C1-D6EB854CD0D4

code

string

The response status code.

Ok

message

string

The response message.

success

data

object

The response data.

serviceIds

array

The list of service IDs.

string

The service ID.

svc-crbgq0dlhtgrdb***

Examples

Success response

JSON format

{
  "requestId": "C67DED2B-F19B-5BEC-88C1-D6EB854CD0D4",
  "code": "Ok",
  "message": "success",
  "data": {
    "serviceIds": [
      "svc-crbgq0dlhtgrdb***"
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.