ListScanTasksByTarget

Updated at:
Copy as MD

Queries the scan tasks of a specified scan target for AI Red Teaming with paging, and supports filtering by detection intensity, task status, and scan mode.

Operation description

Queries the list of scan tasks under a specified scan target with paging. Only returns the tasks of targets that belong to the current tenant.

Query scope and sorting:

  • Only returns tasks created within the last 366 days.

  • Sorts tasks in descending order of creation time.

  • TaskStatus filters tasks by status. ScanType filters tasks by scan mode. The scan mode is stored in the task execution parameters. Tasks that do not have a recorded scan mode are processed as attack.

Paging rules:

  • PageNumber starts from 1. If the value is less than 1, it is normalized to 1.

  • PageSize defaults to 10, with a maximum of 100 per page. If the value is greater than 100, it is clamped to 100. If the value is less than 1, a 400 error is returned.

  • The PageNumber and PageSize in the response are the actual effective values after normalization.

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

yundun-aisc:ListScanTasksByTarget

get

*All Resource

*

None None

Request syntax

GET  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

TargetId

string

Yes

The unique identifier of the scan target. Only tasks under this target are queried. If the target does not exist or does not belong to the current tenant, a 400 error is returned.

target-abc123def4567

PageSize

string

Yes

The number of entries per page. Default value: 10. Maximum value: 100. If the value is greater than 100, it is clamped to 100. If the value is less than 1, a 400 error is returned.

10

PageNumber

string

Yes

The page number. Pages start from 1. If the value is less than 1, it is normalized to 1.

1

SampleLevel

string

No

Filters tasks by detection intensity. If this parameter is not specified, tasks are not filtered by intensity.

Valid values:

  • 1 :

    Quick.

  • 2 :

    Standard.

  • 3 :

    Deep.

2

TaskStatus

string

No

Filters tasks by task status. If this parameter is not specified, tasks of all statuses are returned.

Valid values:

  • running :

    Processing.

  • canceled :

    Canceled.

  • preparing :

    Preparing samples.

  • report_generating :

    Generating report.

  • pending :

    Pending.

  • completed :

    Completed.

  • failed :

    Execution failed.

  • timeout :

    Execution timed out.

completed

ScanType

string

No

Filters tasks by scan mode. If this parameter is not specified, tasks of all modes are returned.

Valid values:

  • attack :

    Security attack and defense scan.

  • tc260 :

    TC260 filing scan.

attack

Response elements

Element

Type

Description

Example

object

RequestId

string

The unique identifier of the request. It is used for troubleshooting and log tracing.

1EBD0C05-6C1F-4C95-9C63-B7AB7B5A9C8E

TotalCount

integer

The total number of scan tasks that meet the filter conditions within the last 366 days.

42

PageSize

integer

The actual effective number of entries per page after normalization. This value may not be equal to the input parameter.

10

PageNumber

integer

The actual effective page number after normalization. This value may not be equal to the input parameter.

1

Data

array<object>

The list of scan tasks on the current page.

object

EndTime

integer

The end time of the task. The value is a millisecond timestamp (Unix epoch in milliseconds). If the task has not ended, the value is null.

1735689600000

ExecuteCaseCount

integer

The number of samples that have been executed for the task.

80

CreateTime

integer

The creation time of the task. The value is a millisecond timestamp (Unix epoch in milliseconds).

1735689600000

ScannerTaskMessage

string

The task message. If the task fails, this parameter indicates the cause of the failure. If the task succeeds or no message is available, this parameter is empty.

Execution timed out

RiskLevel

string

The risk level of the task result. If the task is not completed or no risk assessment is generated, the value is null.

Valid values:

  • high :

    High risk.

  • low :

    Low risk.

  • medium :

    Medium risk.

high

SampleLevel

integer

The detection intensity of the task.

Valid values:

  • 1 :

    Quick.

  • 2 :

    Standard.

  • 3 :

    Deep.

2

StartTime

integer

The start time of the task. The value is a millisecond timestamp (Unix epoch in milliseconds). If the task has not started, the value is null.

1735689600000

ScannerTaskStatus

string

The current status of the task.

Valid values:

  • running :

    Processing.

  • canceled :

    Canceled.

  • preparing :

    Preparing samples.

  • report_generating :

    Generating report.

  • pending :

    Pending.

  • completed :

    Completed.

  • failed :

    Execution failed.

  • timeout :

    Execution timed out.

completed

TaskName

string

The name of the task. If no name is specified during creation, the default value is Target Scan - target name.

Target Scan - My Model Studio target

ScannerTaskId

string

The unique identifier of the scan task. It can be used to download results and track status.

task-abc123def4567

TotalCaseCount

integer

The total number of samples planned to be executed for the task.

120

ScanType

string

The scan mode of the task. For historical tasks that do not have a recorded scan mode, the value is normalized to attack.

Valid values:

  • attack :

    Security attack and defense scan.

  • tc260 :

    TC260 filing scan.

attack

SampleLanguage

string

The sample language.

Valid values:

  • ms :

    ms

  • en :

    en

  • zh :

    zh

zh

ReportLanguage

string

The report language.

Valid values:

  • ms :

    ms

  • en :

    en

  • zh :

    zh

zh

ScannerType

string

The actual execution mode used by the scan task, which is obtained from the scannerType field of the task. classic indicates the sample mode. agent indicates the autonomous multi-round attack mode of the agent. executor is a historical compatibility value, which is equivalent to classic.

Valid values:

  • classic
  • agent
  • executor

classic

Examples

Success response

JSON format

{
  "RequestId": "1EBD0C05-6C1F-4C95-9C63-B7AB7B5A9C8E",
  "TotalCount": 42,
  "PageSize": 10,
  "PageNumber": 1,
  "Data": [
    {
      "EndTime": 1735689600000,
      "ExecuteCaseCount": 80,
      "CreateTime": 1735689600000,
      "ScannerTaskMessage": "Execution timed out",
      "RiskLevel": "high",
      "SampleLevel": 2,
      "StartTime": 1735689600000,
      "ScannerTaskStatus": "completed",
      "TaskName": "Target Scan - MyModelTarget",
      "ScannerTaskId": "task-abc123def4567",
      "TotalCaseCount": 120,
      "ScanType": "attack",
      "SampleLanguage": "zh",
      "ReportLanguage": "zh",
      "ScannerType": "classic"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.