Undo an automatic sync
restore_replacementUndo one automatic sync: destroy what is currently held for that period and put back the records the sync replaced, recorded as authorised by the member you name. THIS DESTROYS DATA. Everything currently held in that period goes — including anything uploaded or synced since — and is replaced by what was there before. Datavrn keeps a record of what this destroys, but it is NOT offered back on this surface; recovering from an undo is a support operation. Call preview_replacement_restore first, read both of its numbers to your user, get their explicit go-ahead, and send back the confirm_token it gave you with the EXACT destroy_count it returned as expected_destroy_count. Datavrn refuses and changes nothing if: the period’s data moved after you were shown those numbers, the period is locked by a finalised statement or a sealed run, someone already undid this sync, the 30-day window has closed, or the replacement was one a person previewed and confirmed themselves. On success it reports how many records were destroyed, how many were put back, and — under soft_reference_relink — how many links to the restored documents could not be re-established; tell your user that residual number rather than presenting the undo as complete.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_id | Yes | The replacement’s id — the same one you previewed. | |
| client_id | Yes | The entity (client) id — from list_clients. | |
| on_behalf_of | No | The email address your user signs in to Datavrn with. This records who authorised the change alongside the connection that made it. REQUIRED on an API-key connection — ask your user for it, do not guess. On an OAuth connection leave it out: the change is recorded as authorised by the member who connected; if you do supply it, it must be that member. | |
| confirm_token | Yes | The approval from preview_replacement_restore. Call it first and present both of its numbers to your user. | |
| connection_id | Yes | The connected data source’s id — the same one you previewed with. | |
| expected_destroy_count | Yes | The destroy_count preview_replacement_restore returned and you showed your user. Send it back unchanged — a different number is refused, because the approval covers the act your user actually saw. |