The Backups API enables your app to create and manage backups of the live content in a Wix site's collections.
With Backups, your app can:
Backups enable you to restore a Wix site's collections' content in the event of data corruption, erroneous deletions, or other mistakes.
The system creates a backup automatically every 7 days. In addition, you can use the Backups API to create an on-demand backup when significant changes are made to your data. For example:
For information on how site owners can back up the content of a Wix site's collections using the Content Manager, see Backing Up Your Collections.
It's important to note the following points before starting to code:
This article shares some possible use cases your app could support, as well as a sample flow that could support each use case. You're certainly not limited to these use cases, but they can be a helpful jumping off point as you plan your app's implementation.
Suppose your app is about to update many items in a site's collections. For example, it is updating inventory with the most recent stock quantities in a store. Before such a major update, your app can back up site data as follows:
Use Create Backup to generate a new on-demand backup of all live content in a Wix site's data collections.
To check whether the new backup has been completed successfully, use List Backups. A completed backup's status
property has the value READY
. This means it can be used to restore the site's data.
Continue managing site data as usual. In most cases, you shouldn't need the later steps!
What if a site owner accidentally entered incorrect data? For example, suppose they inadvertently provided figures from the wrong month. Your app can provide the option of reverting site data to a prior state as follows:
To restore site data from a backup, you first need to choose which backup to restore.
Use List Backups with the status
parameter value READY
to retrieve a list of all backups that can be used for a restoration, ordered from newest to oldest.
You need the ID of the backup you wish to restore data from. If you wish to restore data from the most recent backup, save the ID of the first backup in the list.
Use Restore Backup with the ID of the backup you wish to restore data from.
To check whether the data restoration has been completed successfully, use List Restorations. A completed restoration's status
property has the value COMPLETED
. This means the content of site collections has reverted to its state at the time of the selected backup.
After restoring data from a backup, you may wish to delete the backup you restored from. This way, you can retain older backups which may have been created at important junctures, while also freeing a slot for a new backup. To do this, use Delete Backup with the ID of the backup you restored data from.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a list of all backups for a site.
Results are sorted by requested date, with the newest first.
You can use this method to check whether a backup initiated with Create Backup has been completed successfully.
Statuses to filter by.
If provided, only backups with the specified statuses are listed.
For example, to list only completed backups, use ?status=READY
.
To list completed and pending backups, use ?status=READY&status=PENDING
.
Default: No filtering
Type to filter by. If provided, only backups of the specified type are listed.
Default: No filtering
Number of items to load.
Number of items to skip in the current sort order.
Retrieved backups.
Paging information.
curl -X GET \
'https://www.wixapis.com/wix-data/v2/backups' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>'
{
"backups": [
{
"id": "8c683199-dbd9-4591-883f-32b0298ecaf2",
"requestedDate": "2022-05-25T15:12:06.797Z",
"startedDate": "2022-05-25T15:12:07.025Z",
"finishedDate": null,
"deletedDate": null,
"sizeInBytes": null,
"status": "PENDING",
"type": "ON_DEMAND"
},
{
"id": "11384bcd-2106-416d-8ec6-19fbb7d92c20",
"requestedDate": "2022-05-25T15:10:56.394Z",
"startedDate": "2022-05-25T15:10:56.603Z",
"finishedDate": "2022-05-25T15:10:56.913Z",
"deletedDate": null,
"sizeInBytes": "1584",
"status": "READY",
"type": "ON_DEMAND"
}
],
"paging_metadata": {
"count": 2,
"offset": 0
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
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.
Details of the requested backup.
curl -X POST \
'https://www.wixapis.com/wix-data/v2/backups' \
-H "Accept: application/json" \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>'
{
"backup": {
"id": "8af59df8-4915-45d1-b4d3-a31592d9311c",
"requestedDate": "2022-07-27T13:14:59.903407Z",
"startedDate": null,
"finishedDate": null,
"deletedDate": null,
"sizeInBytes": null,
"status": "PENDING",
"type": "ON_DEMAND"
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Restores all data from a backup.
The process of restoring data from a backup takes time. You can check whether your restoration has completed successfully with List Restorations.
ID of backup to be restored.
Details of data restoration from backup.
curl -X POST \
'https://www.wixapis.com/wix-data/v2/backups/restore/bfab4dac-c835-4cf7-8b47-adbe1ca1ea34' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>'
{
"restoration": {
"id": "0bd30197-2012-4c35-a4f0-a0d5ef7ecea0",
"requestedDate": "2022-05-26T07:17:02.209Z",
"startedDate": null,
"finishedDate": null,
"backup": {
"id": "bfab4dac-c835-4cf7-8b47-adbe1ca1ea34",
"requestedDate": "2022-05-25T15:10:56.394Z",
"startedDate": "2022-05-25T15:10:56.603Z",
"finishedDate": "2022-05-25T15:10:56.913Z",
"deletedDate": null,
"sizeInBytes": "1584",
"status": "READY",
"type": "ON_DEMAND"
},
"status": "PENDING"
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a list of all data restorations from backups.
Results are sorted by requested date, with the newest first.
You can use this method to check whether a restoration initiated with Restore Backup has been completed successfully.
Statuses to filter by. If provided, only restorations with the specified statuses are listed.
For example, to list only completed restorations, use ?status=COMPLETED
.
To list completed and pending restorations, use ?status=COMPLETED&status=PENDING
.
Default: No filtering
Number of items to load.
Number of items to skip in the current sort order.
Retrieved restorations.
Paging information.
curl -X GET \
'https://www.wixapis.com/wix-data/v2/backups/restorations' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>'
{
"restorations": [
{
"id": "0bd30197-2012-4c35-a4f0-a0d5ef7ecea0",
"requestedDate": "2022-05-27T07:17:02.209Z",
"startedDate": "2022-05-27T07:17:02.394Z",
"finishedDate": "2022-05-27T07:17:03.452Z",
"backup": {
"id": "11384bcd-2106-416d-8ec6-19fbb7d92c20",
"requestedDate": "2022-05-25T15:10:56.394Z",
"startedDate": "2022-05-25T15:10:56.603Z",
"finishedDate": "2022-05-25T15:10:56.913Z",
"deletedDate": null,
"sizeInBytes": "1584",
"status": "READY",
"type": "ON_DEMAND"
},
"status": "PENDING"
},
{
"id": "d51f5c89-1f7c-4610-a60e-92f81ad2231a",
"requestedDate": "2022-05-26T07:17:02.209Z",
"startedDate": "2022-05-26T07:17:02.394Z",
"finishedDate": "2022-05-26T07:17:03.452Z",
"backup": {
"id": "acb5af51-3332-471d-aad4-9b3c52ff5b07",
"requestedDate": "2022-05-24T15:10:56.394Z",
"startedDate": "2022-05-24T15:10:56.603Z",
"finishedDate": "2022-05-24T15:10:56.913Z",
"deletedDate": null,
"sizeInBytes": "1087",
"status": "READY",
"type": "ON_DEMAND"
},
"status": "COMPLETED"
}
],
"paging_metadata": {
"count": 2,
"offset": 0
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Deletes a backup.
The process of deleting a backup takes time. You can check whether a backup has been deleted successfully with List Backups.
ID of the backup to be deleted.
curl -X DELETE \
'https://www.wixapis.com/wix-data/v2/backups/df941cc7-603e-4926-8034-8d8dc5025325' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
{}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a backup's status is changed. This includes when a backup is created and its status is set to PENDING
.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.data.v2.backup_backup_state_changed",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.data.v2.backup_deleted",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a restoration's status is changed. This includes when a new restoration is initiated and its status is PENDING
.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.data.v2.backup_restoration_state_changed",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}