All Products
Search
Document Center

Container Registry:CreateRepoSyncRule

Last Updated:Aug 07, 2026

Creates a synchronization rule for an image repository.

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

cr:CreateSyncRule

create

*Repository

acs:cr:{#regionId}:{#accountId}:repository/{#instanceid}

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The ID of the source instance.

cri-hpdfkc6utbaq****

NamespaceName

string

No

The namespace name of the source instance.

ns1

RepoName

string

No

The repository name of the source instance.

repo1

TargetRegionId

string

Yes

The region ID of the target instance.

cn-shanghai

TargetInstanceId

string

Yes

The ID of the target instance.

cri-ibxs3piklys3****

TargetNamespaceName

string

No

The namespace name of the target instance.

ns1

TargetRepoName

string

No

The image repository name of the target instance.

repo1

NamespaceNameFilter

string

No

The instance-level namespace regex filter.

Note

This parameter takes effect only when SyncScope is set to INSTANCE.

.*

RepoNameFilter

string

No

The repository filter rule.

Note

This parameter takes effect only when SyncScope is set to INSTANCE or NAMESPACE.

.*

TagFilter

string

Yes

The tag filter rule.

.*

SyncScope

string

Yes

The synchronization type. Valid values:

  • REPO: Synchronizes by image repository.

  • NAMESPACE: Synchronizes by namespace.

  • INSTANCE: Synchronizes by namespace regex and repository regex.

REPO

SyncRuleName

string

Yes

The name of the synchronization rule.

rule

SyncTrigger

string

No

The trigger for the synchronization action. Valid values:

  • INITIATIVE: Manual trigger.

  • PASSIVE: Automatic trigger.

PASSIVE

TargetUserId

string

No

The UID of the account to which the target instance belongs.

Note

This parameter is required for cross-account image synchronization.

12645940***

LinkId

string

No

The ID of the custom synchronization link.

stl-72cjfd3fayno8***

Priority

integer

No

The execution priority of the synchronization task. Synchronization tasks are executed in descending order of priority. Tasks with the same priority are executed in random order.

Valid values: 1 to 5.

Default value: 3.

3

Response elements

Element

Type

Description

Example

object

Code

string

The response code.

success

SyncRuleId

string

The ID of the synchronization rule.

crsr-gk5p2ns1kzns****

IsSuccess

boolean

Indicates whether the request was successful.

true

RequestId

string

The request ID.

8F8A0BA6-7F06-4BAE-B147-10BD6A25****

Examples

Success response

JSON format

{
  "Code": "success",
  "SyncRuleId": "crsr-gk5p2ns1kzns****",
  "IsSuccess": true,
  "RequestId": "8F8A0BA6-7F06-4BAE-B147-10BD6A25****"
}

Error codes

HTTP status code

Error code

Error message

Description

500 SystemError Unknown error.
403 NoPrivilege Access denied for this user.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.