Start a restore batch
Restores the server's accounts one after another, each from its newest backup that can be restored (at or before as_of when given), with the same choices for every account. Name the accounts in hosting_account_ids, or leave it out for every account that can be restored; an account with no such backup is left out. Answers 201 with the batch; its first restore is queued at once. 409 while another batch runs on the server. 422 when the batch cannot start, with the reason in message: no Plesk or cPanel, the integration switched off, an agent too old, or no chosen account with a backup that can be restored.
/api/v1/servers/{server}/restore-batches
curl -X POST 'https://app.clokeep.com/api/v1/servers/12/restore-batches' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"as_of": "2026-11-20T00:00:00+00:00",
"hosting_account_ids": [
17
],
"components": [
"files",
"databases"
],
"apply_settings": false,
"rollback_live": false,
"database_mode": "new",
"mail_overwrite": false
}'<?php
$ch = curl_init('https://app.clokeep.com/api/v1/servers/12/restore-batches');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_TOKEN',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'as_of' => '2026-11-20T00:00:00+00:00',
'hosting_account_ids' => [
17,
],
'components' => [
'files',
'databases',
],
'apply_settings' => false,
'rollback_live' => false,
'database_mode' => 'new',
'mail_overwrite' => false,
]),
]);
$response = curl_exec($ch);
echo $response;
const response = await fetch("https://app.clokeep.com/api/v1/servers/12/restore-batches", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
"as_of": "2026-11-20T00:00:00+00:00",
"hosting_account_ids": [
17,
],
"components": [
"files",
"databases",
],
"apply_settings": false,
"rollback_live": false,
"database_mode": "new",
"mail_overwrite": false,
}),
});
console.log(await response.text());
import requests
response = requests.post(
"https://app.clokeep.com/api/v1/servers/12/restore-batches",
headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"as_of": "2026-11-20T00:00:00+00:00",
"hosting_account_ids": [
17,
],
"components": [
"files",
"databases",
],
"apply_settings": False,
"rollback_live": False,
"database_mode": "new",
"mail_overwrite": False,
},
)
print(response.text)
{
"data": {
"id": 64,
"server_id": 12,
"status": "running",
"status_label": "Running",
"choices": {
"components": [
"files",
"databases"
],
"apply_settings": false,
"rollback_live": false,
"database_mode": "new",
"database_modes": [],
"mail_overwrite": false
},
"as_of": null,
"accounts": {
"restored": 0,
"restored_with_warnings": 0,
"failed": 0,
"skipped": 0,
"cancelled": 0,
"left": 1,
"total": 1
},
"initiated_by_user_id": 8,
"retry_of_batch_id": null,
"stop_reason": null,
"stop_requested_at": null,
"started_at": "2026-11-20T10:40:00+00:00",
"finished_at": null,
"items": [
{
"position": 1,
"hosting_account_id": 17,
"domain_name": "example.com",
"component": null,
"backup_artifact_id": 2291,
"backup_run_id": 1875,
"status": "completed",
"status_label": "Completed",
"reason": null
}
],
"created_at": "2026-11-20T10:40:00+00:00",
"updated_at": "2026-11-20T10:40:00+00:00"
}
}{
"message": "Unauthenticated."
}{
"message": "This token lacks the required ability."
}{
"message": "No query results for model [App\\Models\\Server] 12"
}{
"message": "A restore batch is already running on web-01. Stop it, or wait for it to end."
}{
"message": "The components field is required.",
"errors": {
"components": [
"The components field is required."
]
}
}{
"message": "Too Many Attempts."
}New to the API? Read Restore many accounts at once.
Path Parameters
-
serverintegerrequired
The ID of the server.
Example:
12
Body Parameters
-
as_ofstring · date-timenullable
Restore each account from its newest backup at or before this moment (ISO 8601, not in the future). Leave it out for the newest backup.
Example:
2026-11-20T00:00:00+00:00 -
hosting_account_idsinteger[]
The accounts of this server to restore. Leave it out for every account that can be restored. As in the panel, retired accounts and accounts without a backup that can be restored are left out of the batch;
GET /servers/{server}/restore-candidateslists them with the reason.Example:
[17] -
componentsstring[]required
The parts to restore for every account:
settings,files,databases,mail.One of:
settings,files,databases,mailExample:
["files","databases"] -
apply_settingsboolean
With
settings: apply them. Re-creates a deleted subscription or account; on cPanel it also rolls a live account's configuration back.Default:
falseExample:
false -
rollback_liveboolean
Plesk, with
settingsandapply_settings: also roll back subscriptions that still exist. Their settings and every password go back to the backup's.Default:
falseExample:
false -
database_modestringnullable
newrestores each database asname_restoredand leaves the original alone;overwriteempties the original and loads the backup into it, for every account. When left out it is decided per account when the batch is created, as in the single restore:overwritefor an account that was missing from the server at the last account sync whenapply_settingsre-creates it (its databases come back empty),newfor every other account. The batch'schoicesthen showper_accountand each account's mode.One of:
new,overwrite,nullExample:
new -
mail_overwriteboolean
Overwrite messages that already exist.
Default:
falseExample:
false
Response
201
-
dataobject
Show properties
-
data.idinteger
-
data.server_idinteger
-
data.statusstring
runningwhile accounts are restored,stoppingwhile the restore in progress finishes after a stop; thencompleted,completed_with_failuresorstopped.One of:
running,stopping,completed,completed_with_failures,stopped -
data.status_labelstring
One of:
Running,Stopping,Completed,Completed with failures,Stopped -
data.choicesobject
The choices applied to every account.
database_modeisper_accountwhen it was left out with settings applied: thendatabase_modesgives each account's mode (overwritefor an account missing from the server at the last sync when the batch was created,newfor the others), keyed by hosting account id; it is an empty list[]otherwise.Show properties
-
data.choices.componentsstring[]
One of:
settings,files,databases,mail -
data.choices.apply_settingsboolean
-
data.choices.rollback_liveboolean
-
data.choices.database_modestring
One of:
new,overwrite,per_account -
data.choices.database_modesobject
-
data.choices.mail_overwriteboolean
-
-
data.as_ofstring · date-timenullable
Each account is restored from its newest backup at or before this moment; null for its newest backup.
-
data.accountsobject
What happened to each account, counted per account: an account restored one component at a time counts once.
Show properties
-
data.accounts.restoredinteger
-
data.accounts.restored_with_warningsinteger
-
data.accounts.failedinteger
-
data.accounts.skippedinteger
-
data.accounts.cancelledinteger
-
data.accounts.leftinteger
-
data.accounts.totalinteger
-
-
data.initiated_by_user_idintegernullable
The user who started the batch.
-
data.retry_of_batch_idintegernullable
The ended batch whose failed accounts this one restores again; null for a first batch.
-
data.stop_reasonstringnullable
Why the batch was stopped:
Stopped by a user(a stop from the panel or the API) orClient suspended; null unless it was stopped. -
data.stop_requested_atstring · date-timenullable
When the stop was asked for; null unless the batch was stopped.
-
data.started_atstring · date-timenullable
-
data.finished_atstring · date-timenullable
When the batch ended; null while it is running or stopping.
-
data.itemsobject[]
Show properties
-
data.items.positioninteger
The item's place in the batch, from 1. Items run in this order.
-
data.items.hosting_account_idintegernullable
The account restored; null once the account was deleted.
-
data.items.domain_namestringnullable
The account's domain; null once the account was deleted.
-
data.items.componentstringnullable
The one component this item restores when the plan keeps one backup per component; null when the backup holds them all.
One of:
settings,files,databases,mail,null -
data.items.backup_artifact_idintegernullable
The backup restored; null once it was deleted.
-
data.items.backup_run_idintegernullable
The restore run of this item, once it was queued; null before.
-
data.items.statusstring
One of:
pending,running,completed,failed,skipped,cancelled -
data.items.status_labelstring
One of:
Pending,Running,Completed,Failed,Skipped,Cancelled -
data.items.reasonstringnullable
Why the item failed or was skipped, or what a restore that completed only in part left out; null otherwise.
-
-
data.created_atstring · date-timenullable
-
data.updated_atstring · date-timenullable
-
401
The request carries no valid token: the Authorization: Bearer header is missing, or its token is unknown, revoked or past its expiry date. Send a current personal access token.
-
messagestring
Always
Unauthenticated.
403
The token may not do this. The message says why: This token lacks the required ability. (a read token), Your role does not permit this action. (its owner is not an Admin or Operator in the client), This account is disabled., This token is not bound to a client you belong to., or Client suspended.
-
messagestring
What went wrong.
404
Not found
-
messagestring
What went wrong.
409
A restore batch is already running or stopping on the server.
-
messagestring
What went wrong.
422
The body or the query is invalid. message names the first problem and errors lists every problem by field. A batch that cannot start is refused with a message only: the server has no Plesk or cPanel, that panel's integration is switched off, its agent is too old for the choices, or none of the chosen accounts has a backup that can be restored.
-
messagestring
The first problem, and how many more there are.
-
errorsobject
Every problem, by field.
429
More than 120 requests a minute for this user. Wait the seconds in Retry-After, then retry.
-
messagestring
What went wrong.