--
:api: revert-model-snapshot
:request: RevertModelSnapshotRequest
:response: RevertModelSnapshotResponse
--
[role="xpack"]

[id="{upid}-{api}"]
=== Revert model snapshots API

Reverts to a previous {ml} model snapshot.
It accepts a +{request}+ object and responds
with a +{response}+ object.

[id="{upid}-{api}-request"]
==== Revert model snapshots request

A +{request}+ requires the following arguments:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Constructing a new request referencing existing `jobId` and `snapshotId` values.

==== Optional arguments

The following arguments are optional:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-delete-intervening-results]
--------------------------------------------------
<1> A flag indicating whether or not results in the period between the timestamp on the reverted snapshot and the latest results should be deleted


include::../execution.asciidoc[]

[id="{upid}-{api}-response"]
==== Revert job response

A +{response}+ contains the full representation of the reverted `ModelSnapshot`.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The reverted `ModelSnapshot`
