Updated on 2025-11-28 GMT+08:00

Manually Starting an Artifact Scan

Function

This API is used to start an artifact scan manually.

Constraints

This API is only supported by SWR Enterprise Edition instances v25.7.20 or later.

Calling Method

For details, see Calling APIs.

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, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    swr:repository:startManualScanning

    Write

    repository *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    -

    -

URI

POST /v2/{project_id}/instances/{instance_id}/namespaces/{namespace_name}/repositories/{repository_name}/artifacts/{reference}/scan

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

ID of an SWR Enterprise Edition instance.

namespace_name

Yes

String

Namespace name.

repository_name

Yes

String

Repository name.

reference

Yes

String

Artifact digest.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

The token can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 202

The request for starting the artifact scan has been accepted.

Status code: 400

Table 3 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Detailed rejection reason after encryption. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 401

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Detailed rejection reason after encryption. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Detailed rejection reason after encryption. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Detailed rejection reason after encryption. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Detailed rejection reason after encryption. You can call the API decode-authorization-message of STS to decrypt the reason.

Example Requests

POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/namespaces/{namespace_name}/repositories/{repository_name}/artifacts/{reference}/scan

Example Responses

None

Status Codes

Status Code

Description

202

The request for starting the artifact scan has been accepted.

400

Request error.

401

Authentication failed.

403

Access denied.

404

Resource not found.

500

Internal error.

Error Codes

See Error Codes.