CreateC2paBucketSignTask
Creates a batch C2PA content credential signing task for files in a specified OSS bucket.
Operation description
Creates a batch standard C2PA content credential signing task for an OSS bucket. The service recursively scans non-directory objects under SourcePrefix and supports JPEG/JPG, PNG, and MP4, as well as FLAC, M4A, MP3, and WAV audio files. By default, a single task includes up to 20,000 non-directory objects, and the size of a single file cannot exceed 800 MiB.
Before you call this operation, make sure that the AliyunServiceRoleForAIDeepSign service-linked role has been granted the OSS List and Get permissions on the source prefix, and the Get and Put permissions on the output prefix. SourceType, SoftwareAgent, and CustomAssertions are optional parameters. The values specified during creation are applied to each file in the batch.
A successful creation only indicates that the task has been accepted. Save the returned TaskId and call GetC2paSignResult to query the status and statistics. You can use PauseC2paBucketSignTask, ResumeC2paBucketSignTask, and CancelC2paBucketSignTask to control the task.
The signature files are written to ai-deepsign-signed/<TaskId>/<folder of the object relative to SourcePrefix>/<original file name>_signed.<extension> in the same bucket, preserving the relative subdirectory and source file extensions. The final JSON report is saved as ai-deepsign-signed/<TaskId>/c2pa_report.json.
This operation is metered based on the number of successfully signed files. The same account can create multiple tasks for the same bucket and prefix, and each task uses an independent output directory. Duplicate creations may result in duplicate signing and metering.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
aideepsign:CreateC2paBucketSignTask |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| BucketRegionId |
string |
Yes |
The region where the OSS bucket is located. The value can be up to 64 characters in length and must match the actual region of the bucket. Example: |
cn-hangzhou |
| BucketName |
string |
Yes |
The name of the OSS bucket. The name must be 3 to 63 characters in length. Before you call this operation, you must authorize the |
example-bucket |
| SourcePrefix |
string |
Yes |
The prefix of the objects to be processed. The prefix can be up to 1,023 UTF-8 bytes in length and must be |
ai-deepsign/images/ |
| SourceType |
string |
No |
The optional content source type. The value can be up to 128 characters in length. It supports 19 short names and their corresponding full HTTP URIs, which are case-sensitive. Examples: Valid values:
|
digitalCapture |
| SoftwareAgent |
string |
No |
The optional name of the software that generated or processed the content. The value can be up to 128 characters in length. Example: |
Adobe Photoshop 25.0 |
| CustomAssertions |
string |
No |
The optional list of custom assertions. Pass a JSON array string. The original JSON text can be up to 4,096 UTF-8 bytes in length and contain up to 64 assertions. Each item must and can only contain |
[{"label":"com.example.internal","data":{"meta_id":"emp001","generation":{"modelVersion":"2.1","count":3},"tags":["AI-generated","E-commerce"],"enabled":true,"optional":null}}] |
Parameter passing method
Both GET and POST are supported, and all business parameters are passed through the URL query. The parameter type of CustomAssertions is string. When you call the SDK, first serialize the assertion array into a JSON string, and then assign it to this parameter. The SDK or HTTP client performs normal URL encoding. Do not encode it repeatedly or submit the array as the request body.
SourceType: content source type
The value can be up to 128 characters in length and supports the following 19 short names and their corresponding full HTTP URIs. The matching is case-sensitive. Arbitrary strings, alternative HTTPS URIs, or additional URL parameters are not accepted. The service removes leading and trailing U+0000 to U+0020 characters and normalizes full URIs to short names. If this parameter is not passed or is empty after processing, no additional source type is declared. The corresponding standard URI is used in the content credential.
The full URI for the following 17 short names is http://cv.iptc.org/newscodes/digitalsourcetype/ followed by the short name:
digitalCapture
computationalCapture
negativeFilm
positiveFilm
print
humanEdits
algorithmicallyEnhanced
digitalCreation
dataDrivenMedia
trainedAlgorithmicMedia
algorithmicMedia
screenCapture
virtualRecording
composite
compositeCapture
compositeSynthetic
compositeWithTrainedAlgorithmicMedia
The other two values are:
| Short name | Full URI |
| empty | http://c2pa.org/digitalsourcetype/empty |
| trainedAlgorithmicData | http://c2pa.org/digitalsourcetype/trainedAlgorithmicData |
SoftwareAgent: software name
The optional software name, which can be up to 128 characters in length, is used to declare the software that generated or processed the content. Example: Example Studio 1.0. This value is written into the content credential and is independent of the source type and custom assertions.
CustomAssertions: custom assertions
CustomAssertions is an optional JSON array string. Each item uses a customer-defined label to identify the assertion name and data to carry the business data. The content is written into the manifest of the signature file, and readers can search by label and verify the integrity.
The original JSON text of the entire parameter can be up to 4,096 UTF-8 bytes in length, including outer whitespace, field names, and JSON escapes. It is calculated based on the parameter value after URL decoding, not the
%xxlength, and it is not 4,096 Chinese characters.Up to 64 assertions are allowed. Each item must and can only contain
labelanddata, both of which are required.labeluses the reverse domain name format and must contain at least two dot-separated components, such ascom.example.internal. Each component must start with an ASCII letter or digit, followed by ASCII letters, digits, hyphens-, and underscores_. The service does not verify domain name ownership.The first component of
labelcannot bec2pa,cawg, orstds. This reserved namespace check is case-insensitive.labelvalues within the same request cannot be duplicated, and the duplicate comparison is case-sensitive. Different assertions should use different base names. Do not distinguish them only by C2PA version numbers or instance suffixes.dataaccepts any valid JSON value: object, array, string, number, boolean, ornull.data: null, empty object{}, and empty array[]are all valid. Missing thedatafield is invalid.Objects and arrays can be nested up to 5 levels deep. The first object or array of
datais counted as the first level, and mixed nesting is counted together. The outer assertion array and the wrapper object containinglabelanddataare not counted. For example,data: {"a": [{"b": 1}]}is 3 levels.JSON integers (without a decimal point or exponent) must be within the range of -9223372036854775808 to 9223372036854775807, inclusive. This limit applies to
dataitself, object fields, and array elements. Use strings for out-of-range business IDs. The service does not automatically convert types.Duplicate keys are not allowed in any JSON object, including key names that are equivalent after Unicode escaping. Invalid Unicode is rejected. The keys of the
dataobject follow JSON string rules, allowing empty keys and whitespace keys.@type,$ref, etc., are only processed as common business fields.Business field names, JSON types, case, and internal whitespace of strings are preserved. Nested objects or arrays are not flattened into strings.
Not passing the parameter, passing an empty string, passing only JSON whitespace (spaces, tabs, carriage returns, line feeds), or passing a top-level empty array
[]all indicate that no custom assertions are added.
These assertions do not override SourceType or SoftwareAgent. The assertion content is not encrypted and is provided to content credential readers along with the signature file. The word internal in the name does not provide access control. Do not write sensitive information such as keys.
Batch task rules
Each file in the same batch uses the SourceType, SoftwareAgent, and CustomAssertions saved during creation. The original values continue to be used after the task is paused, resumed, or taken over by the service. The resume operation does not accept modifications. If different assertions are required, create single-file tasks separately or create batch tasks grouped by the same assertions.
This operation does not accept AliUid, RoleArn, STS credentials, object lists, idempotency keys, or file content. Directory objects are not processed. Files in unsupported formats are recorded as failed, but this does not abort the processing of other files.
If the parameters are invalid, InvalidParam is returned before the service-linked role verification, OSS listing, and task creation, and no TaskId is generated.
Request parameter example
The following JSON only shows the parameter names and values. In actual calls, parameters are still passed through the URL query.
{
"BucketRegionId": "cn-hangzhou",
"BucketName": "example-bucket",
"SourcePrefix": "ai-deepsign/photos/",
"SourceType": "trainedAlgorithmicMedia",
"SoftwareAgent": "Example Studio 1.0",
"CustomAssertions": "[{\"label\":\"com.example.internal\",\"data\":{\"meta_id\":\"emp001\",\"generation\":{\"modelVersion\":\"2.1\",\"count\":3},\"tags\":[\"AI-generated\",\"E-commerce\"],\"enabled\":true,\"optional\":null}}]"
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The task creation result. |
||
| RequestId |
string |
The request ID. |
01A03DCE-4091-1A91-9810-692C3D783877 |
| TaskId |
string |
The ID of the batch signing task for the bucket. You can use this ID to query, pause, resume, or stop the task. |
047b8305-9572-4eed-b7fb-8588b989b6e5 |
| Success |
boolean |
Indicates whether the request is successful. |
true |
| Message |
string |
The returned message. |
success |
| HttpStatusCode |
integer |
The HTTP status code. |
200 |
| Code |
string |
The return code. |
OK |
Success=true and Code=OK indicate that the creation call is successful, but do not indicate that all files have been signed. After a successful creation, the initial status of the task is PROCESSING. Save the TaskId and call GetC2paSignResult. RequestId is only used to locate this OpenAPI request and cannot be used to query or control the task.
After the batch task is completed, check the processing status based on the number of successes, the number of failures, and the file-by-file results in the JSON report. A successful batch task does not mean that every file is signed successfully.
Examples
Success response
JSON format
{
"RequestId": "01A03DCE-4091-1A91-9810-692C3D783877",
"TaskId": "047b8305-9572-4eed-b7fb-8588b989b6e5",
"Success": true,
"Message": "success",
"HttpStatusCode": 200,
"Code": "OK"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.