All Products
Search
Document Center

Security Center:CreateFileDetect

Last Updated:Aug 25, 2026

Pushes a file to the cloud for detection.

Operation description

Pushes a file to the cloud for detection.

File upload methods

Two file upload methods are supported: pre-upload and download URL.

If you use the pre-upload method, confirm that the file is uploaded before you invoke this operation. For information about how to upload a file, refer to the CreateFileDetectUploadUrl operation.

If you use the download URL method, pass in a download URL that supports public network access by using the DownloadUrl parameter.

File unique identifier

All file detection operations include the HashKey parameter, which represents the unique identifier of the file being detected and is used to query detection results.

Calculate the HashKey before calling the operation. Only the MD5 or SHA-256 of the complete file content is supported.

To calculate the MD5 or SHA-256 value of the file content, follow these two steps:

  1. Use the MD5 or SHA-256 algorithm to encrypt the data and generate a 128-bit or 256-bit hash value. Available libraries include Java MessageDigest and Python hashlib.

  2. Encode the generated hash value as a hexadecimal string. Available libraries include Java Codec and Python hex function. Make sure the final string is a combination of digits and lowercase letters. The MD5 string is 32 characters, and the SHA-256 string is 64 characters.

Note: The push and query operations for a single detection must use the same HashKey. Otherwise, the detection cannot be correctly pushed and the results cannot be queried.

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-sas:CreateFileDetect

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

SourceIp

string

No

The IP address of the access source.

115.213.XX.XX

Type

integer

Yes

The type of file to detect. Valid values:

  • 0: malicious file detection

0

HashKey

string

No

The unique identifier of the file. This parameter is required and must be the MD5 or SHA-256 of the file.

0a212417e65c26ff133cfff28f6c****

OssKey

string

No

The storage key of the file in the OSS bucket.

If you push the file for detection by using DownloadUrl, this parameter is optional. This parameter is obtained from the CreateFileDetectUploadUrl operation.

1/2022/06/23/15/41/16559701077444693a0c6-33b2-4cc2-a99f-9f38b8b8****

DownloadUrl

string

No

The download URL of the file. You can pass in a file download URL (public URL) to directly trigger file detection without uploading the file in advance.

https://xxxxxxxx.oss-cn-hangzhou-1.aliyuncs.com/xxxxx/xxxxxxxxxxxxxx?Expires=1671448125&OSSAccessKeyId=xxx

Decompress

boolean

No

Specifies whether to identify and decompress compressed files. Valid values:

  • true: Yes.

  • false: No.

false

DecompressMaxLayer

integer

No

The maximum number of decompression layers when compressed files are nested within a compressed package. Maximum value: 5.

This parameter is required when Decompress is set to true.

1

DecompressMaxFileCount

integer

No

The maximum number of files to decompress. Maximum value: 1000.

This parameter is required when Decompress is set to true.

100

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID, which is a unique identifier generated by Alibaba Cloud for the request. You can use it to troubleshoot issues.

7E0618A9-D5EF-4220-9471-C42B5E92719F

HashKey

string

The file identifier.

0a212417e65c26ff133cfff28f6c****

Examples

Success response

JSON format

{
  "RequestId": "7E0618A9-D5EF-4220-9471-C42B5E92719F",
  "HashKey": "0a212417e65c26ff133cfff28f6c****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 RequestTooFrequently Request too frequently, please try again later
400 GetFileError Get file error, please check input params and file size, and make sure upload file success.
400 InvalidDownloadUrl Invalid file download URL.
400 FileSizeOverLimit File size over limit.
500 ServerError ServerError
500 SystemBusy System busy, please try again later.
403 NoPermission caller has no permission You are not authorized to do this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.