Skip to main content

Delete backup schedule

This example demonstrates how to delete the current portal’s backup schedule in ONLYOFFICE DocSpace using the API.

Before you start

  1. Replace https://yourportal.onlyoffice.com and YOUR_API_KEY with your actual DocSpace portal URL and API key. Ensure you have the necessary data and permissions to perform migration operations.
  2. Before you can make requests to the API, you need to authenticate. Check out the Personal access tokens page to learn how to obtain and use access tokens.
Full example
// Config
const API_HOST = 'https://yourportal.onlyoffice.com';
const API_KEY = 'your_api_key';

// Headers with authentication
const HEADERS = {
Authorization: API_KEY,
};

function deleteBackupSchedule(dump) {
// Optional query parameter: Dump=True for dump-based schedules
const params = new URLSearchParams();
if (dump !== undefined && dump !== null) {
// Match Python's ?Dump=True/False (capitalized)
params.set('Dump', dump ? 'True' : 'False');
}

const qs = params.toString();
const url = `${API_HOST}/api/2.0/backup/deletebackupschedule${qs ? `?${qs}` : ''}`;

return fetch(url, {
method: 'DELETE',
headers: HEADERS,
})
.then((res) => {
if (res.status === 200) return res.json();
const text = await res.text();
console.log(`Backup schedule deletion failed. Status code: ${res.status}, Message: ${text}`);
return null;
})
.then((data) => {
if (!data) return null;
const result = data?.response;
console.log(`Backup schedule deleted: ${result}`);
return result;
})
.catch((err) => {
console.error(err.message);
});
}

// Run: delete backup schedule without specifying Dump
deleteBackupSchedule();

How it works

A DELETE request is sent to /api/2.0/backup/deletebackupschedule with an optional query parameter:

  • Dump — boolean flag indicating whether the operation targets a dump-based schedule.

If successful (200), the API returns:

  • response — boolean (true if deletion succeeded).
  • count, links, status, statusCode — additional metadata fields.

On success, the portal’s configured backup schedule is removed, and no further automatic backups will be executed until a new schedule is created.