All Products
Search
Document Center

API Gateway:CreateService

Last Updated:Dec 17, 2025
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Creates a service.

Operation description

You can call this operation to create multiple services at a time.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
apig:CreateServicenone
*Service
acs:apig:{#regionId}:{#accountId}:service/*
    none
none

Request syntax

POST /v1/services HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
bodyobjectNo

The request body.

gatewayIdstringNo

The gateway instance ID.

gw-cq7l5s5lhtg***
sourceTypestringNo

The service source. Valid values:

  • MSE_NACOS: a service in an MSE Nacos instance
  • K8S: a service in a Kubernetes (K8s) cluster in Container Service for Kubernetes (ACK)
  • VIP: a fixed IP address
  • DNS: a Domain Name System (DNS) domain name
  • FC3: a service in Function Compute
  • SAE_K8S_SERVICE: a service in a K8s cluster in Serverless App Engine (SAE)

Enumerated values:

  • SAE_K8S_SERVICE
  • K8S
  • FC3
  • DNS
  • VIP
  • MSE_NACOS
MSE_NACOS
serviceConfigsarray<object>No

The list of service configurations.

objectNo

The service configurations.

namestringNo

The service name.

user-service
namespacestringNo

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

  • If sourceType is set to K8S, this parameter specifies the namespace where the K8s service resides.
  • If sourceType is set to MSE_NACOS, this parameter specifies a namespace in Nacos.
PUBLIC
groupNamestringNo

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

DEFAULT_GROUP
addressesarrayNo

The list of domain names or fixed addresses.

stringNo

The domain name or fixed address.

dev.com:8080
qualifierstringNo

The function version or alias.

LATEST
aiServiceConfigAiServiceConfigNo

The AI service configurations.

dnsServersarrayNo

The list of DNS service addresses.

stringNo

The DNS service address.

100.100.2.136:53
resourceGroupIdstringNo

The resource group ID.

rg-xxx

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

requestIdstring

The request ID.

C67DED2B-F19B-5BEC-88C1-D6EB854CD0D4
codestring

The status code.

Ok
messagestring

The returned message.

success
dataobject

The response data.

serviceIdsarray

The list of service IDs.

serviceIdstring

The service ID.

svc-crbgq0dlhtgrdb***

Examples

Sample success responses

JSONformat

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

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2025-06-26The internal configuration of the API is changed, but the call is not affectedView Change Details
2025-02-27The internal configuration of the API is changed, but the call is not affectedView Change Details