About the Backups API

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:

  • If an automated backup is not scheduled soon, create an on-demand backup after updating your data, to ensure your new content is backed up as soon as possible.
  • Create an on-demand backup prior to a major update to a Wix site's collections, so you can restore your most recent pre-update data in the event something goes wrong during the update.

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.

Before you begin

It's important to note the following points before starting to code:

  • To enable Wix Data APIs to interact with a site, its code editor must be enabled.
  • Backups include only live content. They don't include content contained in the optional sandbox.
  • Backups include only collection content. They don't store a collection's schema or named views.
  • A site can store a maximum of 3 on-demand backups. If 3 on-demand backups already exist and you create a new backup, the oldest existing on-demand backup is deleted.
  • When you restore data from a backup, the restoration process replaces the collection's current data with the data in the backup. So if you add items to a collection after initiating a backup, and then you restore data from that backup, the new content may be lost.
  • If any content is submitted to a collection during the restoration process, that content may be lost.

Terminology

  • Backup: A full copy of the live content contained in a Wix site's collections.
    • Auto: A backup taken automatically by the system on a regular schedule.
    • On demand: A backup initiated manually.
  • Restoration: Regeneration of a Wix site's collection content from a prior backup.
Did this help?

Sample Flows

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.

Backing up data before a major update

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:

  1. Use Create Backup to generate a new on-demand backup of all live content in a Wix site's data collections.

  2. 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.

  3. Continue managing site data as usual. In most cases, you shouldn't need the later steps!

Restoring data from a backup

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:

  1. 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.

  2. Use Restore Backup with the ID of the backup you wish to restore data from.

  3. 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.

  4. 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.

Did this help?

GET

List Backups


Developer Preview

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.

Endpoint
GET
https://www.wixapis.com/wix-data/v2/backups

Query Params
statusArray <string>

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


typeArray <string>

Type to filter by. If provided, only backups of the specified type are listed.

Default: No filtering


paging.limitintegerminimum 0format int32

Number of items to load.


paging.offsetintegerminimum 0format int32

Number of items to skip in the current sort order.

Response Object
backupsArray <Backup>

Retrieved backups.


pagingMetadataPagingMetadata

Paging information.

List all backups for a site
Request
cURL
curl -X GET \ 'https://www.wixapis.com/wix-data/v2/backups' \ -H 'Content-Type: application/json' \ -H 'Authorization: <AUTH>'
Response
JSON
{ "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 } }
Did this help?

POST

Create Backup


Developer Preview

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.

Endpoint
POST
https://www.wixapis.com/wix-data/v2/backups

Request
This endpoint does not take any parameters.
Response Object
backupBackup

Details of the requested backup.

Create a backup
Request
cURL
curl -X POST \ 'https://www.wixapis.com/wix-data/v2/backups' \ -H "Accept: application/json" \ -H 'Content-Type: application/json' \ -H 'Authorization: <AUTH>'
Response
JSON
{ "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" } }
Did this help?

POST

Restore Backup


Developer Preview

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.

Endpoint
POST
https://www.wixapis.com/wix-data/v2/backups/{backupId}/restore

Path Params
backupIdstringRequired

ID of backup to be restored.

Response Object
restorationRestoration

Details of data restoration from backup.

Restore data from a backup
Request
cURL
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>'
Response
JSON
{ "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" } }
Did this help?

GET

List Restorations


Developer Preview

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.

Endpoint
GET
https://www.wixapis.com/wix-data/v2/backups/restorations

Query Params
statusArray <string>

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


paging.limitintegerminimum 0format int32

Number of items to load.


paging.offsetintegerminimum 0format int32

Number of items to skip in the current sort order.

Response Object
restorationsArray <Restoration>

Retrieved restorations.


pagingMetadataPagingMetadata

Paging information.

List all restorations for a site
Request
cURL
curl -X GET \ 'https://www.wixapis.com/wix-data/v2/backups/restorations' \ -H 'Content-Type: application/json' \ -H 'Authorization: <AUTH>'
Response
JSON
{ "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 } }
Did this help?

DELETE

Delete Backup


Developer Preview

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.

Endpoint
DELETE
https://www.wixapis.com/wix-data/v2/backups/{backupId}

Path Params
backupIdstringRequired

ID of the backup to be deleted.

Response Object
Returns an empty object.
Delete a backup
Request
cURL
curl -X DELETE \ 'https://www.wixapis.com/wix-data/v2/backups/df941cc7-603e-4926-8034-8d8dc5025325' \ -H 'Content-Type: application/json' \ -H 'Authorization: <AUTH>' \
Response
JSON
{}
Event TriggersThis method triggers the following events:
Did this help?

Backup State Changed


Developer Preview

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.

Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Body

The data payload will include the following as an encoded JWT:

JSON
{ "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 } } }
Did this help?

Backup Deleted


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Body

The data payload will include the following as an encoded JWT:

JSON
{ "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 } } }
Did this help?

Backup Restoration State Changed


Developer Preview

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.

Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Body

The data payload will include the following as an encoded JWT:

JSON
{ "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 } } }
Did this help?