Help Center/ ModelArts/ API Reference/ Training Management/ Querying the Algorithm List
Updated on 2025-08-20 GMT+08:00

Querying the Algorithm List

Function

This API is used to obtain the list of all algorithms on ModelArts.

This API applies to the following scenarios: When you need to view all available algorithms on the platform, you can call this API to obtain the algorithm list. Before using this API, ensure that you have the permission to view the algorithm list. After the query is complete, the platform returns an algorithm list. Information such as the algorithm name and ID is displayed. If you do not have the permission to perform operations, 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.

URI

GET /v2/{project_id}/algorithms

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition: Offset for querying algorithms

Constraints: The minimum value is 0. For example, if this parameter is set to 1, the query starts from the second one.

Range: N/A

Default Value: N/A

limit

No

Integer

Definition: Limit of algorithms to be queried

Constraints: The value ranges from 1 to 50.

Range: N/A

Default Value: N/A

sort_by

No

String

Definition: Metric for sorting algorithms to be queried

Constraints: N/A

Range: N/A

Default Value: create_time is used for sorting by default.

order

No

String

Definition: Order of queried algorithms

Constraints: N/A

Range:

  • asc: The queried algorithms are sorted in ascending order.

  • desc: The queried algorithms are sorted in descending order.

Default Value: desc

group_by

No

String

Definition: Condition for grouping the algorithms to be queried

Constraints: N/A

Range: N/A

Default Value: N/A

searches

No

String

Definition: Filter criteria for querying algorithms, for example, fuzzy match by the algorithm name

Constraints: N/A

Range: N/A

Default Value: N/A

workspace_id

No

String

Definition: Workspace ID.

Constraints: If no workspaces are available, the default value is 0. If a workspace is created and used, use the actual value. For details about how to obtain the ID, see Querying the Workspace List.

Range: N/A

Default Value: N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total

Integer

Definition: Total number of algorithms of the current user.

Range: N/A

count

Integer

Definition: Total number of algorithms that meet the search criteria of the current user.

Range: N/A

limit

Integer

Definition: Maximum number of obtained algorithms of the current user.

Range: N/A

offset

Integer

Definition: Offset of all algorithm obtained of the current user.

Range: N/A

sort_by

String

Definition: Fields used to sort obtained algorithms of the current user.

Range: N/A

order

String

Definition: Order of queried algorithms of the current user.

Range:

  • asc: ascending order

  • desc: descending order.

group_by

String

Definition: Grouping mode of obtained algorithms of the current user.

Range: N/A

items

Array of AlgorithmResponse objects

Definition: Details of the algorithms that meet the search criteria of the current user.

Table 4 AlgorithmResponse

Parameter

Type

Description

metadata

metadata object

Definition: Algorithm metadata, which describes basic algorithm information.

job_config

job_config object

Definition: Algorithm configuration, such as the boot file.

resource_requirements

Array of resource_requirements objects

Definition: Algorithm resource constraints. This parameter is optional. After this parameter is set, the console filters available public resource pools when the algorithm is used in training jobs.

advanced_config

advanced_config object

Definition: Advanced algorithm policy.

  • auto_search

Table 5 metadata

Parameter

Type

Description

id

Integer

Definition: Algorithm UUID. You do not need to set this parameter when creating an algorithm.

Range: N/A

name

String

Definition: Algorithm name. The value must contain 1 to 64 characters consisting of only digits, letters, underscores (_), and hyphens (-).

Range: N/A

description

String

Definition: Algorithm description, which consists of 0 to 256 characters. The default value is NULL.

Range: N/A

workspace_id

String

Definition: Workspace where a specified algorithm is located. The default value is 0. 0 is the default workspace.

Range: N/A

ai_project

String

Definition: AI project to which a specified algorithm belongs. The default value is default-ai-project. The AI project has been brought offline. Ignore it.

Range: N/A

user_name

String

  • Definition: Username.

Range: N/A

domain_id

String

Definition: Domain ID of a user.

Range: N/A

source

String

Definition: Algorithm source type.

Range: N/A

api_version

String

Definition: Algorithm API version, which shows whether it is new or old.

Range: N/A

is_valid

String

Definition: Algorithm availability.

Range: N/A

state

String

Definition: Algorithm status.

Range: N/A

tags

Array of Map<String,String> objects

Definition: Algorithm tag.

attr_list

Array of strings

Definition: Algorithm attributes.

version_num

Integer

Definition: Number of algorithm versions. The default value is 0.

Range: N/A

size

Integer

Definition: Algorithm size.

Range: N/A

create_time

Long

Definition: Algorithm creation timestamp.

Range: N/A

update_time

Long

Definition: Algorithm update timestamp.

Range: N/A

Table 6 job_config

Parameter

Type

Description

code_dir

String

Definition: Algorithm code directory, for example, /usr/app/. This parameter must be used together with boot_file.

Range: N/A

boot_file

String

Definition: Code boot file of the algorithm, which must be stored in the code directory, for example, /usr/app/boot.py. This parameter must be used with code_dir.

Range: N/A

command

String

Definition: Container boot command of a custom image algorithm.

Range: N/A

parameters

Array of ParameterResp objects

Definition: Running parameters of an algorithm.

inputs

Array of inputs objects

Definition: Data input of an algorithm.

outputs

Array of outputs objects

Definition: Data output of an algorithm.

engine

engine object

Definition: Algorithm engine.

code_tree

Array of code_tree objects

Definition: Algorithm directory tree.

parameters_customization

Boolean

Definition: Specifies whether the algorithm allows hyperparameter customization during training job creation.

Range:

  • true: allowed

  • false: not allowed

Table 7 ParameterResp

Parameter

Type

Description

name

String

Definition: Parameter name.

Range: N/A

value

String

Definition: Parameter value.

Range: N/A

description

String

Definition: Parameter description.

Range: N/A

constraint

constraint object

Definition: Parameter attribute.

i18n_description

i18n_description object

Definition: Internationalization description.

Table 8 constraint

Parameter

Type

Description

type

String

Definition: Parameter type.

Range: N/A

editable

Boolean

Definition: Whether the parameter can be edited.

Range:

  • true: editable

  • false: Not uneditable

required

Boolean

Definition: Whether the parameter is mandatory.

Range:

  • true: mandatory

  • false: optional

sensitive

Boolean

Definition: Whether the parameter is sensitive. This function is unavailable currently.

Range:

  • true: sensitive

  • false: insensitive

valid_type

String

Definition: Valid type.

Range: N/A

valid_range

Array of strings

Definition: Valid range.

Table 9 i18n_description

Parameter

Type

Description

language

String

Definition: Internationalization language. The options are as follows:

  • zh-cn: Chinese

  • en-us: English

Range: N/A

description

String

Definition: Internationalization language description.

Range: N/A

Table 10 inputs

Parameter

Type

Description

name

String

Definition: Name of the data input channel.

Range: N/A

description

String

Definition: Description of the data input channel.

Range: N/A

remote_constraints

Array of remote_constraints objects

Definition: Data input constraint.

Table 11 remote_constraints

Parameter

Type

Description

data_type

String

Definition: Data input type, including the data storage location and dataset.

Range: N/A

attributes

Array of Map<String,String> objects

Definition: Attributes when the data input type is a dataset. The value can be:

  • data_format: data format

  • data_segmentation: data segmentation method

  • dataset_type: data labeling type

Table 12 outputs

Parameter

Type

Description

name

String

Definition: Name of the data output channel.

Range: N/A

description

String

Definition: Description of the data output channel.

Range: N/A

Table 13 engine

Parameter

Type

Description

engine_id

String

Definition: Engine ID selected for an algorithm.

Range: N/A

engine_name

String

Definition: Engine version name selected for an algorithm. If engine_id is specified, leave this parameter blank.

Range: N/A

engine_version

String

Definition: Engine version name selected for an algorithm. If engine_id is specified, leave this parameter blank.

Range: N/A

image_url

String

Definition: Custom image URL selected for an algorithm.

Range: N/A

Table 14 code_tree

Parameter

Type

Description

name

String

Definition: Name of the current directory in the algorithm directory tree.

Range: N/A

children

Object

Definition: Subfiles and subdirectories in the current directory of the algorithm directory tree.

Table 15 resource_requirements

Parameter

Type

Description

key

String

Definition: Resource constraints.

Range:

  • flavor_type: Flavor type, which can be CPU, Ascend, or GPU.

  • device_distributed_mode: Specifies whether to support multi-card training. The value can be multiple (supported) or singular (not supported).

  • host_distributed_mode: Specifies whether to support distributed training. The value can be multiple (supported) or singular (not supported).

value

Array of strings

Definition: Value of the resource constraint key.

operator

String

Definition: Relationship between keys and values. Currently, only in is supported. For example, flavor_type in [CPU,GPU].

Range: N/A

Table 16 advanced_config

Parameter

Type

Description

auto_search

auto_search object

Definition: Hyperparameter search policy.

Table 18 reward_attrs

Parameter

Type

Description

name

String

Definition: Metric name.

Range: N/A

mode

String

Definition: Search mode.

Range:

  • max: A larger metric value is preferred.

  • min: A smaller metric value is preferred.

regex

String

Definition: Regular expression of a metric.

Range: N/A

Table 19 search_params

Parameter

Type

Description

name

String

Definition: Hyperparameter name.

Range: N/A

param_type

String

Definition: Parameter type.

Range:

  • continuous: The hyperparameter is of the continuous type. When an algorithm is used in a training job, continuous hyperparameters are displayed as text boxes on the console.

  • discrete: The hyperparameter is of the discrete type. When an algorithm is used in a training job, discrete hyperparameters are displayed as drop-down lists on the console.

lower_bound

String

Definition: Lower bound of the hyperparameter.

Range: N/A

upper_bound

String

Definition: Upper bound of the hyperparameter.

Range: N/A

discrete_points_num

String

Definition: Number of discrete points of a hyperparameter with continuous values.

Range: N/A

discrete_values

String

Definition: Discrete hyperparameter values.

Range: N/A

Table 20 algo_configs

Parameter

Type

Description

name

String

Definition: Search algorithm name.

Range: N/A

params

Array of AutoSearchAlgoConfigParameterResp objects

Definition: Search algorithm parameters.

Table 21 AutoSearchAlgoConfigParameterResp

Parameter

Type

Description

key

String

Definition: Parameter key.

Range: N/A

value

String

Definition: Parameter value.

Range: N/A

type

String

Definition: Parameter type.

Range: N/A

Example Requests

The following shows how to query all algorithms in jobs whose names contain TestModelArtsalgorithm and maximum number of algorithms is set to 1.

GET https://endpoint/v2/{project_id}/algorithms?limit=1&searches=name%3ATestModelArtsalgorithm

Example Responses

Status code: 200

ok

{
  "total" : 1,
  "count" : 1,
  "limit" : 1,
  "offset" : 0,
  "sort_by" : "create_time",
  "order" : "desc",
  "group_by" : "",
  "items" : [ {
    "metadata" : {
      "id" : "2e5451fe-913f-4492-821a-2981031382f7",
      "name" : "TestModelArtsalgorithm",
      "description" : "This is a ModelArts algorithm",
      "create_time" : 1636600721742,
      "workspace_id" : "0",
      "ai_project" : "default-ai-project",
      "user_name" : "",
      "domain_id" : "xxxxxxxxxxxxxxxxxxxxxxxxxx",
      "source" : "custom",
      "api_version" : "",
      "is_valid" : true,
      "state" : "",
      "size" : 4791,
      "tags" : null,
      "attr_list" : null,
      "version_num" : 0,
      "update_time" : 0
    },
    "job_config" : {
      "code_dir" : "/algo-test/pytorch/work1/code/",
      "boot_file" : "/algo-test/pytorch/work1/code/test-pytorch.py",
      "command" : "",
      "parameters" : [ {
        "name" : "test-parameter",
        "description" : "",
        "i18n_description" : null,
        "value" : "10",
        "constraint" : {
          "type" : "String",
          "editable" : true,
          "required" : false,
          "sensitive" : false,
          "valid_type" : "None",
          "valid_range" : [ ]
        }
      } ],
      "parameters_customization" : true,
      "inputs" : [ {
        "name" : "data_url",
        "description" : "name to translate"
      } ],
      "outputs" : [ {
        "name" : "train_url",
        "description" : "name to translate"
      } ],
      "engine" : {
        "engine_id" : "pytorch-cp36-1.3.0",
        "engine_name" : "PyTorch",
        "engine_version" : "PyTorch-1.3.0-python3.6"
      },
      "code_tree" : {
        "name" : "code/",
        "children" : [ {
          "name" : "test-pytorch.py"
        } ]
      }
    },
    "resource_requirements" : null,
    "advanced_config" : { }
  } ]
}

Status Codes

Status Code

Description

200

ok

Error Codes

See Error Codes.