> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # CreateBackup # Package: operations # Namespace: BackupService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/cms/operations/backups/create-backup.md ## Permission Scopes: Manage Data Backups: SCOPE.DC-DATA.MANAGE-BACKUPS ## Introduction Creates an on-demand backup of live content in a site's collections. By default, all of the site's collections are included in the backup. For a partial backup, specify which collections to include in the `backup.collections` parameter. The process of creating a backup takes time. You can check whether a backup has completed successfully with List Backups. You can store up to 3 on-demand backups for each site. If 3 on-demand backups already exist, the oldest existing on-demand backup for the site is deleted when a new one is created. Automated backups are not affected. --- ## REST API ### Schema ``` Method: createBackup Description: Creates an on-demand backup of live content in a site's collections. By default, all of the site's collections are included in the backup. For a partial backup, specify which collections to include in the `backup.collections` parameter. The process of creating a backup takes time. You can check whether a backup has completed successfully with List Backups. You can store up to 3 on-demand backups for each site. If 3 on-demand backups already exist, the oldest existing on-demand backup for the site is deleted when a new one is created. Automated backups are not affected. URL: https://www.wixapis.com/wix-data/v2/backups Method: POST Return type: CreateBackupResponse - name: backup | type: Backup | description: Details of the requested backup. - name: id | type: string | description: Backup GUID. - name: status | type: Status | description: Backup status. - enum: - PENDING: Backup creation is in progress. - READY: Backup has been created successfully and can be used for data restoration. - FAILED: Backup creation has failed. - DELETED: Backup has been deleted. - CANCELED: Backup has been canceled. - name: type | type: Type | description: Type of backup, based on how it was triggered. - enum: - ON_DEMAND: Backup taken on demand. - AUTO: Backup taken automatically by the system on a regular schedule. - name: requestedDate | type: string | description: Date and time the backup was requested. - name: startedDate | type: string | description: Date and time the backup commenced. Value is `null` until the backup process begins in the background. - name: finishedDate | type: string | description: Date and time the backup process finished. Value is `null` until the backup process is completed in the background. - name: deletedDate | type: string | description: Date and time the backup was deleted. Value is `null` if that backup hasn't been deleted. - name: sizeInBytes | type: string | description: Backup size in bytes. Value is `null` until the backup process is completed. - name: collections | type: array | description: IDs and display names of collections the backup contains. - name: id | type: string | description: Collection GUID. - name: displayName | type: string | description: Collection display name. ``` ### Examples ### Create a backup ```curl curl -X POST \ 'https://www.wixapis.com/wix-data/v2/backups' \ -H "Accept: application/json" \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.operations.BackupService.createBackup() Description: Creates an on-demand backup of live content in a site's collections. By default, all of the site's collections are included in the backup. For a partial backup, specify which collections to include in the `backup.collections` parameter. The process of creating a backup takes time. You can check whether a backup has completed successfully with List Backups. You can store up to 3 on-demand backups for each site. If 3 on-demand backups already exist, the oldest existing on-demand backup for the site is deleted when a new one is created. Automated backups are not affected. Return type: PROMISE - name: backup | type: Backup | description: Details of the requested backup. - name: _id | type: string | description: Backup GUID. - name: status | type: Status | description: Backup status. - enum: - PENDING: Backup creation is in progress. - READY: Backup has been created successfully and can be used for data restoration. - FAILED: Backup creation has failed. - DELETED: Backup has been deleted. - CANCELED: Backup has been canceled. - name: type | type: Type | description: Type of backup, based on how it was triggered. - enum: - ON_DEMAND: Backup taken on demand. - AUTO: Backup taken automatically by the system on a regular schedule. - name: requestedDate | type: Date | description: Date and time the backup was requested. - name: startedDate | type: Date | description: Date and time the backup commenced. Value is `null` until the backup process begins in the background. - name: finishedDate | type: Date | description: Date and time the backup process finished. Value is `null` until the backup process is completed in the background. - name: deletedDate | type: Date | description: Date and time the backup was deleted. Value is `null` if that backup hasn't been deleted. - name: sizeInBytes | type: string | description: Backup size in bytes. Value is `null` until the backup process is completed. - name: collections | type: array | description: IDs and display names of collections the backup contains. - name: _id | type: string | description: Collection GUID. - name: displayName | type: string | description: Collection display name. ``` ### Examples ### createBackup ```javascript import { backups } from '@wix/data'; async function createBackup() { const response = await backups.createBackup(); }; ``` ### createBackup (with elevated permissions) ```javascript import { backups } from '@wix/data'; import { auth } from '@wix/essentials'; async function myCreateBackupMethod() { const elevatedCreateBackup = auth.elevate(backups.createBackup); const response = await elevatedCreateBackup(); } ``` ### createBackup (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { backups } from '@wix/data'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { backups }, // Include the auth strategy and host as relevant }); async function createBackup() { const response = await myWixClient.backups.createBackup(); }; ``` ---