Updated on 2025-09-15 GMT+08:00

Deploying a Service

Function

This API is used to deploy a service instance. It allows you to enter parameters such as the name, description, endpoint ID, instance specifications, minimum value, and maximum value. The API returns the instance ID. This process includes resource verification: the maximum value must be greater than or equal to the minimum value and cannot exceed the maximum number of endpoint resources. The total number of resources of all services under the same endpoint must also comply with the limits. The number of service instances will be automatically adjusted based on the load to ensure operation within the minimum and maximum values.

URI

POST /v1/workspaces/{workspace_id}/services/instances

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

workspace_id

Yes

String

Definition: Workspace ID.

Constraints: N/A.

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

Definition: Tenant token.

Constraints: N/A.

Range: N/A.

Default Value: N/A.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

source

Yes

SourceRef object

Definition: Source, including service and model.

Constraints: N/A.

name

Yes

String

Definition: Service instance name.

Constraints: N/A.

Range: 1 to 64 characters. Only letters, digits, hyphens (-), underscores (_), periods (.), and spaces are allowed.

Default Value: N/A.

description

No

String

Definition: Description.

Constraints: N/A.

Range: 0 to 1,024 characters, excluding the following characters: !<>=&'''

Default Value: N/A.

endpoint_id

Yes

String

  • Definition: endpoint ID.

  • Constraints: N/A.

  • Range: 1 to 36 characters. Only letters, numbers, and hyphens (-) are allowed.

  • Default Value: N/A.

config

No

ServiceInstanceConfig object

Definition: Configuration entered when a service instance is started, which is used in DeployService.

Constraints: N/A.

Table 4 SourceRef

Parameter

Mandatory

Type

Description

id

Yes

String

Definition: Source ID. There are different types. For an inference service instance, it refers to the model ID.

Constraints: N/A.

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A.

version_id

No

String

Definition: Version ID. There are different types. For an inference service instance, it refers to the model version ID.

Constraints: N/A.

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A.

Table 5 ServiceInstanceConfig

Parameter

Mandatory

Type

Description

model_instance_config

No

ModelServiceInstanceConfig object

Definition: Configuration of a model service instance, which is used in DeployService.

Constraints: N/A.

Table 6 ModelServiceInstanceConfig

Parameter

Mandatory

Type

Description

resource

Yes

ResourceDemand object

Definition: Resource requirement configuration.

Constraints: N/A.

Table 7 ResourceDemand

Parameter

Mandatory

Type

Description

min

Yes

Integer

Definition: Minimum number.

Constraints: N/A.

Range: [1, 1000].

Default Value: N/A.

max

Yes

Integer

Definition: Maximum number.

Constraints: N/A.

Range: [1, 1000].

Default Value: N/A.

spec_code

Yes

String

Definition: Resource specifications, which are queried from the specification list.

Constraints: N/A.

Range: [1, 64].

Default Value: N/A.

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

id

InstanceId object

Definition: Instance ID. For details about how to obtain an instance ID, see [Obtaining an Inference Instance ID] (dataartsfabric_03_0025.xml).

Constraints: N/A.

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A.

Table 9 InstanceId

Parameter

Type

Description

-

String

Definition: Instance ID. For details about how to obtain an instance ID, see [Obtaining an Inference Instance ID] (dataartsfabric_03_0025.xml).

Constraints: N/A.

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A.

Status code: 400

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Constraints: N/A.

Range: [8, 36].

Default Value: N/A.

error_msg

String

Definition: Error message.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

solution_msg

String

Definition: Solution description.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

Status code: 401

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Constraints: N/A.

Range: [8, 36].

Default Value: N/A.

error_msg

String

Definition: Error message.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

solution_msg

String

Definition: Solution description.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

Status code: 404

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Constraints: N/A.

Range: [8, 36].

Default Value: N/A.

error_msg

String

Definition: Error message.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

solution_msg

String

Definition: Solution description.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

Status code: 408

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Constraints: N/A.

Range: [8, 36].

Default Value: N/A.

error_msg

String

Definition: Error message.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

solution_msg

String

Definition: Solution description.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Constraints: N/A.

Range: [8, 36].

Default Value: N/A.

error_msg

String

Definition: Error message.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

solution_msg

String

Definition: Solution description.

Constraints: N/A.

Range: [2, 4096].

Default Value: N/A.

Example Requests

Deploy a service instance. The following is an example of the deployment parameters.

POST https://{endpoint}/v1/workspaces/{workspace_id}/services/instances

{
  "source" : {
    "id" : "0b5633ba2b904511ad514346f4d23d4b",
    "version_id" : "0b5633ba2b904511ad514346f4d23d4b"
  },
  "name" : "serviceInstanceName1",
  "description" : "description",
  "endpoint_id" : "b935d0ef-f4eb-4b95-aff1-9d33ae9f57b6",
  "config" : {
    "model_instance_config" : {
      "resource" : {
        "min" : 1,
        "max" : 1000,
        "spec_code" : "string"
      }
    }
  }
}

Example Responses

Status code: 400

BadRequest

{
  "error_code" : "common.01000001",
  "error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException"
}

Status code: 401

Unauthorized

{
  "error_code" : "APIG.1002",
  "error_msg" : "Incorrect token or token resolution failed"
}

Status code: 403

Forbidden

{
  "error" : {
    "code" : "403",
    "message" : "X-Auth-Token is invalid in the request",
    "title" : "Forbidden"
  },
  "error_code" : 403,
  "error_msg" : "X-Auth-Token is invalid in the request",
  "title" : "Forbidden"
}

Status code: 404

NotFound

{
  "error_code" : "common.01000001",
  "error_msg" : "response status exception, code: 404"
}

Status code: 408

Request Time-out

{
  "error_code" : "common.00000408",
  "error_msg" : "timeout exception occurred"
}

Status code: 500

InternalServerError

{
  "error_code" : "common.00000500",
  "error_msg" : "internal error"
}

Status Codes

Status Code

Description

200

OK

400

BadRequest

401

Unauthorized

403

Forbidden

404

NotFound

408

Request Time-out

500

InternalServerError

Error Codes

See Error Codes.