Help Center/ ModelArts/ API Reference/ Training Management/ Creating and Publishing an Algorithm
Updated on 2026-07-24 GMT+08:00

Creating and Publishing an Algorithm

Function

This API is used to create and publish algorithms in algorithm management.

This API is used when you have developed an algorithm and want to publish it as a reusable algorithm asset. Before using this API, ensure that you have logged in and have the permission to create and publish algorithms. After the creation and publishing, the system generates an algorithm and adds it to the algorithm asset list. You can manage and call the algorithm using its ID. If you do not have the required permission, the algorithm asset information is incomplete, or an algorithm asset with the same name already exists, the API will return an error message.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

URI

POST /v2/{project_id}/gallery-algorithm-publication

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Project ID. For details, see Obtaining a Project ID and Name.

Constraints: The value can contain 1 to 64 characters. Letters, digits, and hyphens (-) are allowed.

Range: N/A

Default Value: N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

content_id

No

String

Definition: Asset ID.

Constraints: N/A

Range: N/A

Default Value: N/A

content_info

No

ContentInfo object

Definition: Asset content.

Constraints: N/A

algorithm

No

AlgorithmInfo object

Definition: Algorithm content.

Constraints: N/A

Table 3 ContentInfo

Parameter

Mandatory

Type

Description

version_num

No

String

Definition: Number of versions.

Constraints: N/A

Range: N/A

Default Value: N/A

desc

No

String

Definition: description.

Constraints: N/A

Range: N/A

Default Value: N/A

Table 4 AlgorithmInfo

Parameter

Mandatory

Type

Description

id

No

String

Definition: Algorithm ID.

Constraints: N/A

Range: N/A

Default Value: N/A

Response Parameters

Status code: 202

Table 5 Response body parameters

Parameter

Type

Description

content_id

String

Definition: Asset ID.

Range: N/A

version_id

String

Definition: Version ID.

Range: N/A

version_num

String

Definition: Number of versions.

Range: N/A

content_uri

String

Definition: Asset URI.

Range: N/A

Example Requests

POST https://endpoint/v2/{project_id}/gallery-algorithm-publication

{
  "content_id" : "86c3cceb-8693-434c-853a-2a610c49xxxx",
  "content_info" : {
    "version_num" : "1.0.0",
    "desc" : "Test assets."
  },
  "algorithm" : {
    "id" : "86c3cceb-8693-434c-853a-2a610cxxxxxx"
  }
}

Example Responses

Status code: 202

Request succeeded.

{
  "content_id" : "86c3cceb-8693-434c-853a-2a610c49xxxx",
  "version_id" : "version-003",
  "version_num" : "1.0.0",
  "content_uri" : ""
}

Status Codes

Status Code

Description

202

Request succeeded.

Error Codes

See Error Codes.