All Products
Search
Document Center

Intelligent Media Management:CreateFileCompressionTask

Last Updated:Jan 27, 2026

Package Download API

Operation description

Note

This API is in public preview. If you have any questions, join our DingTalk group to provide feedback. For the group number, see Contact us.

Note

This API currently supports packaging but not compression. The compression feature will be added later.

  • Before using this API, make sure you understand the billing methods and pricing of Intelligent Media Management (IMM).

    Important The completion time of asynchronous tasks is not guaranteed.

  • File count limit: You can package up to 80,000 files.

  • File size limit: The total size of all files before packaging must not exceed 200 GB.

  • This feature supports files of the Standard storage class on OSS. To package files of other storage classes, first convert their storage class.

  • This is an asynchronous API. After a task starts, its information is stored for 7 days. After 7 days, the information can no longer be retrieved. To view task information, call the GetTask or ListTasks operation with the returned TaskId. You can also set the Notification parameter to receive task information through asynchronous notification messages.

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

imm:CreateFileCompressionTask

create

*Project

acs:imm:{#regionId}:{#accountId}:project/{#ProjectName}

None None

Request parameters

Parameter

Type

Required

Description

Example

ProjectName

string

Yes

The name of the project. For more information, see Create a project.

test-project

Sources

array<object>

No

A list of files to package and their packaging rules.

Note

Specify either this parameter or `SourceManifestURI`. `Sources` supports a maximum of 100 packaging rules.

Warning If you have more than 100 packaging rules, use the `SourceManifestURI` parameter.

object

No

The OSS address of a file to package and its packaging rule.

URI

string

No

The OSS address of the directory or file to package.

The OSS address must be in the `oss://${Bucket}/${Object}` format. `${Bucket}` is the name of the OSS bucket that is in the same region as the current project. `${Object}` is described as follows:

  • To package a directory, `${Object}` is the directory name.

  • To package a file, `${Object}` is the full path of the file, including the file name extension.

oss://test-bucket/test-object

Alias

string

No

Specifies a new path or name for the source file within the output compressed file.

  • If you do not specify this parameter, the source directory structure is preserved. For example, if the source file is at oss://test-bucket/test-dir/test-object.doc, the path of the file in the compressed file is /test-dir/test-object.doc.

  • Rename the file. For example, if the source file is at oss://test-bucket/test-object.jpg and you set this parameter to /test-rename-object.jpg, the file in the compressed file is named test-rename-object.jpg.

  • Specify a new path for the source file in the compressed file. For example, if the source directory is oss://test-bucket/test-dir/ and you set this parameter to /new-dir/, all files in the source directory are compressed into the /new-dir/ path.

  • Set the value to / to remove the source directory structure. All files are placed directly in the root directory of the compressed file, and the original directory structure is not preserved.

  • Specify both a path and a file name. The file is renamed and moved to the specified path. For example, if you set this parameter to /new-dir/alias.doc, the file is renamed to alias.doc and placed in the /new-dir/ path of the compressed file.

Note
  • Avoid creating files with duplicate names during the renaming process. If duplicate names exist, you may not be able to decompress the file in the compressed package. This depends on the decompression program you use.

  • Format requirement: The value must start with a forward slash (`/`), such as /new-dir/alias.doc.

/new-dir/

Mode

string

No

The pattern matching mode for the packaging rule. Valid values include prefix (prefix matching) and fullname (exact matching). The default value is prefix.

  • prefix: In this mode, all files that match the prefix are packaged.

  • fullname: In this mode, only the file that exactly matches the rule is packaged.

Valid values:

  • prefix :

    prefix

  • fullname :

    fullname

fullname

CredentialConfig CredentialConfig

No

If you do not have special requirements, leave this parameter empty.

The chained authorization configuration. This parameter is not required. For more information, see Use chained authorization to access resources of other entities.

SourceManifestURI

string

No

The address where the file manifest is stored. The file manifest stores the `Sources` structure in JSON format on OSS. This is suitable for scenarios with many files to package.

Note

Specify either this parameter or Sources. In the manifest file, the URI parameter is required and the Alias parameter is optional. `SourceManifestURI` supports up to 80,000 packaging rules.

Warning When you save the content to OSS, specify the OSS address of the file for this parameter.

The following is an example of the file structure:

[{"URI":"oss://<bucket>/<object>", "Alias":"/new-dir/new-name"}]

oss://test-bucket/test-object.json

TargetURI

string

Yes

The OSS address of the output file. The compressed file is named after the file name in this path, such as name.zip.

The OSS address must be in the `oss://${Bucket}/${Object}` format. `${Bucket}` is the name of the OSS bucket that is in the same region as the current project. `${Object}` is the full path of the file, including the file name extension.

oss://test-bucket/test-target-object.zip

CompressedFormat

string

No

The compression format for file packaging.

Note

Currently, only the zip format is supported.

zip

UserData

string

No

Custom user data. This data is returned in the asynchronous notification message, which helps you associate the notification with your internal system. The maximum length is 2,048 bytes.

test-data

Notification Notification

No

The message notification configuration. For more information, see the Notification data type. For the format of asynchronous notification messages, see Asynchronous notification message format.

Note

IMM API callbacks do not currently support specifying a webhook address. Use MNS instead.

Examples of packaging rules for typical scenarios

The following examples show how to configure packaging rules for typical scenarios based on the sample file structure:

(bucket)
├── test-dir1
│   ├── file1.txt
│   ├── file2.doc
│   ├── file3.png
│   └── my-file.json
└── test-dir2
    ├── AAA
    │   └── file.txt
    ├── AAA
    ├── file6.doc
    ├── file7.doc
    └── file8.doc
Package a specified directory

To package all files in the test-dir1 directory into a specified directory named test-dir, use the following packaging rule:

[
    {
        "URI"   : "oss://bucket/test-dir1/",
        "Alias" : "/test-dir/"
    }
]

The structure of the generated compressed file is as follows:

.
└── test-dir
    ├── file1.txt
    ├── file2.doc
    ├── file3.png
    └── my-file.json
Package files with a specified prefix

To package all files with the prefix test-dir1/file into a specified directory named test-dir, use the following packaging rule:

[
    {
        "URI"   : "oss://bucket/test-dir1/file",
        "Alias" : "/test-dir/"
    }
]

The structure of the generated compressed file is as follows:

.
└── test-dir
    ├── file1.txt
    ├── file2.doc
    └── file3.png

Note that if you use the prefix mode for packaging and the prefix matches both a file and a folder, both the file and the folder are packaged into the compressed file. For example:

[
    {
        "URI"   : "oss://bucket/test-dir2/AAA",
        "Alias" : "/AAA/"
    }
]

The structure of the generated compressed file is as follows:

.
└── AAA
    ├── AAA
    └── file.txt
Package specified files

If you do not want to use the prefix mode, set the mode parameter to package only specified files:

[
    {
        "URI"   : "oss://bucket/test-dir2/AAA",
        "Alias" : "AAA",
        "mode"  : "fullname",
    },
    {
        "URI"   : "oss://bucket/test-dir1/",
        "Alias" : "/test-dir1/",
        "mode"  : "fullname",
    }
]

The structure of the generated compressed file is as follows:

.
├── AAA
└── test-dir1

Response elements

Element

Type

Description

Example

object

The response structure.

RequestId

string

The request ID.

EC564A9A-BA5C-4499-A087-D9B9E76E*****

EventId

string

The event ID.

0ED-1Bz8z71k5TtsUejT4UJ16Es*****

TaskId

string

The task ID.

FileCompression-3579a380-6f7a-4a9d-b9d2-65996*****

Examples

Success response

JSON format

{
  "RequestId": "EC564A9A-BA5C-4499-A087-D9B9E76E*****",
  "EventId": "0ED-1Bz8z71k5TtsUejT4UJ16Es*****",
  "TaskId": "FileCompression-3579a380-6f7a-4a9d-b9d2-65996*****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.