Set Replication Targets

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

Replaces the replication targets for a bucket you own, overwriting the existing list entirely. Removing a target that a rule still references automatically disables that rule. See Replication for the target/rule model.

Path Parameters

bucketName
string required
The name of the bucket.

Request Body

targets
array required
Up to 4 targets. Each target has the fields below.

Target fields

id
string required
The target's UUID. Send the all-zero UUID (00000000-0000-0000-0000-000000000000) for a new target - the server assigns a real id and returns it.
endpoint
string required
The remote S3-compatible service's base URL. http or https only; endpoints resolving to private, loopback, or link-local addresses can only be set by administrators.
targetBucket
string required
The destination bucket name on the remote service.
accessKeyId
string required
Access key id used to sign outbound requests to the target.
secretAccessKey
string required
Secret access key used to sign outbound requests to the target.
region
string required
Region to sign requests for. Must exactly match the target's own configured region - real AWS S3, or another Alarik instance's ALARIK_REGION (see Installation). A mismatch fails every replication attempt for this target with an authorization error.
enabled
boolean required
Whether the target is active. Rules referencing a disabled target never deliver.

Example

{
    "targets": [
        {
            "id": "00000000-0000-0000-0000-000000000000",
            "endpoint": "https://remote.example.com",
            "targetBucket": "backup-bucket",
            "accessKeyId": "AKIA...",
            "secretAccessKey": "...",
            "region": "us-east-1",
            "enabled": true
        }
    ]
}

Response

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

Errors

StatusReason
400Missing bucket name, invalid endpoint, missing destination bucket/credentials, or more than 4 targets
403A non-admin tried to set a private/loopback endpoint
404Bucket not found (or not owned by you)