Set Replication Rules

Replace the replication rules of a bucket you own.
EndpointMethodAdmin Required
/api/v1/buckets/:bucketName/replication/rulesPUTNo

Replaces the replication rules for a bucket you own, overwriting the existing configuration entirely. Send an empty rules array to remove all rules. A non-empty rule set requires the bucket's versioning to be Enabled - see Replication.

Path Parameters

bucketName
string required
The name of the bucket.

Request Body

rules
array required
Up to 4 rules. Each rule has the fields below.

Rule fields

id
string required
The rule's UUID. Send the all-zero UUID (00000000-0000-0000-0000-000000000000) for a new rule - the server assigns a real id and returns it.
targetId
string required
The id of a target already configured on this bucket (see Set Replication Targets). Referencing an unknown target is rejected.
prefix
string
Optional key prefix filter - only objects whose key starts with this value are replicated. Omit or leave empty to replicate the whole bucket.
replicateDeletes
boolean required
Whether deletes of the current object are mirrored to the target. Defaults to false - opt-in only.
replicateExisting
boolean required
Whether objects that existed before this rule was created are eligible for a resync. Defaults to false - opt-in only, and doesn't replicate anything by itself.
synchronous
boolean
Whether writes wait for delivery to this rule's target before responding to the client. See Synchronous vs. asynchronous replication. Defaults to false (async).
enabled
boolean required
Whether the rule is active. Disabled rules are stored but never deliver.

Example

{
    "rules": [
        {
            "id": "00000000-0000-0000-0000-000000000000",
            "targetId": "6ff08747-4ec0-48fd-a0b1-f5adda6d3161",
            "prefix": "uploads/",
            "replicateDeletes": false,
            "replicateExisting": true,
            "synchronous": false,
            "enabled": true
        }
    ]
}

Response

Returns the saved rules, each with its server-assigned id. Shaped identically to Get Replication Rules.

Errors

StatusReason
400Missing bucket name, unknown targetId, bucket versioning not Enabled, or more than 4 rules
404Bucket not found (or not owned by you)