A self-service backup solution empowers users with control, improves efficiency, and scales seamlessly as needs grow. With JetBackup’s API, you have the tools to build a custom-branded backup system that adapts to your business while delivering the control and convenience customers demand. 

Why Build a Custom Backup System?

Every hosting environment has its own set of unique demands. Whether developing a custom control panel, working with a self-built hosting stack, or catering to clients with specialized needs, a custom backup system enables you to create backup schedules precisely aligned with your business requirements and client expectations, including specific timing and retention policies. JetBackup’s API is designed to help you reach these goals by providing extensive control over backup and restore operations. With JetBackup’s API, you have the tools to build a backup solution that perfectly fits your custom control panel or hosting environment.

JetBackup API Overview

With JetBackup’s API, you can create, schedule, and monitor backup jobs, manage and initiate restores for specific accounts, databases, or files, customize backup schedules, and configure retention to suit your exact requirements. The API also supports monitoring and reporting features that provide access to detailed logs and backup status reports, ensuring you can monitor backup health effectively. These features make it possible to design a robust backup solution uniquely suited to your infrastructure’s requirements.

Backup Strategy and Interface Essentials

The first step is deciding if you are backing up entire accounts, specific files, databases, or a combination. Also, it’s essential to think about the frequency, whether you want hourly, daily, or event-driven backups. With this outline, you will know precisely how to configure and present options in the interface for customers. Decide on your storage destinations as well, whether local, cloud-based, or remote, and consider restore capabilities, from full account restores to more detailed file-level recovery.

At the core of this custom solution is an intuitive interface. Your dashboard should give customers visibility into their backup activity, allowing them to adjust settings, view backup history, and initiate restores, all without backend access. Consider using popular JavaScript frameworks like React, Vue, or Angular to develop a user-friendly front end that integrates smoothly with JetBackup’s API.

Setting Up Secure API Access

JetBackup’s API requires JSON Web Tokens (JWT) for authentication and will vary depending on the control panel you are using. Start by generating an authentication token with the auth token endpoint. This token will be included in the headers for each API request, creating a secure bridge between your interface and JetBackup’s services. Here’s how an example curl authentication request will look:

curl -H ‘<Control-Panel Authorization/Token Header>’ -X POST ‘<Control-Panel JetBackup API Endpoint>’ -H ‘Content-type: application/json’ -d ‘<JetBackup API json request>’

Once you have the token, all future interactions with the API are secured, allowing you to handle customer data confidently.

For more information, view the API Docs: https://docs.jetbackup.com/v5.3/api/common.html#retrieveapitoken

For API Access Token on Panel-less servers, visit: https://docs.jetbackup.com/v5.3/adminpanel/settings.html#api-access-tokens-linux

Customizing Backup Scheduling with JetBackup API

Tailored backup schedules are core to a self-service approach. With JetBackup’s jobs endpoint, customers can create or adjust backup jobs according to their unique needs, whether they need daily backups for all accounts or hourly backups for essential databases.

For instance, here’s how to set up a full account incremental daily backup at 2:00 AM with a seven-day retention period.

curl -H '<Control-Panel Authorization/Token Header>' -X POST “<Control-Panel JetBackup API Endpoint>” -H "Content-Type: application/json"  -d '{

    "name": "JetBackup API Job",

    "destination": [ "<destination_id>" ],

    "type": 1,

    "contains": 511,

    "structure": 1,

    "time": 0200,

    "schedules": [   {

            "_id": "<schedule_id>",

            "retain": 7,

        } ],

    "action": "create",

    "function": "manageBackupJob"

}’


To find the destination_id and schedule_id, please use the listDestinations and listSchedules API calls accordingly.

This configuration ensures that backups are created daily and stored for a week. Customers can select timing and frequency that fits their requirements within the interface, like choosing longer retention for critical files or more frequent backups for high-traffic databases.

Enabling Seamless Restore Management

The JetBackup API’s key benefit is the flexibility of data restores. Using the restore endpoint, customers can choose restore points and data types, restoring anything from entire accounts to individual files or databases.

For example, to restore the latest version of an account to its original location, first you’ll need to fetch the latest available backup for the account using the listBackupForType API call:

curl -H '<Control-Panel Authorization/Token Header>' -X POST “<Control-Panel JetBackup API Endpoint>” -H "Content-Type: application/json"  -d ‘{

    "type": 1,

    "contains": 1,

    "account_id": "<account_id>",

    "limit": 1,

    "function": "listBackupForType"

}’

You should receive a similar response:

{
    "success": 1,

    "message": "",

    "data": {

        "backups": [

            {

                "_id": "<backup_id>",

                "parent_id": "<parent_id>",

                "account_id": "<account_id>",

                "destination": "<destination_id>",

                "destination_name": "Destination Name",

                "name": "Account Name",

                "created": "2024-12-31T00:00:00+00:00",

                "path": "config",

                "backup_type": 1,

                "backup_contains": 1,

                      ….<snipped>
}

You will then take note of the parent_id and plug that into the addQueueItems API call along with type 2 indicating it is a restore:

curl -H '<Control-Panel Authorization/Token Header>' -X POST “<Control-Panel JetBackup API Endpoint>” -H "Content-Type: application/json"  -d ‘{

    "type": 2,

    "Snapshot_id": “<parent_id>”,

    "files": {},

    "options": {

        "exclude": [],

        "suspend": false

    },

    "encryption_key": "",

    "function": "addQueueItems"

}

You should expect a similar response indicating that the selected backup is queued for a restore successfully:

{

    "success": 1,

    "message": "Items added to the queue Successfully",

    "data": {

        "_id": "<snapshot_id>",

        "owner": "<accountr_id>",

        "owner_name": "<account_name>",

        "created": "2024-12-31T00:00:00+00:00",

        "started": "2024-12-31T00:00:00+00:00",

        …..<snipped>

}

With a simple selection feature on the front end, users can easily pick restore points by timestamp or labeled backup version and initiate the restore process. This makes the recovery process both accessible and efficient.

Monitoring Backup Health and Performance

Reliable backups require proactive monitoring. JetBackup’s API provides real-time insights into backup health and logs for completed jobs. Use the jobs job_id endpoint to track job status and gather logs, which can be displayed on your interface’s dedicated “Backup Health” page or notification center.

To check the status of a specific backup job, the request might look like this:

curl -H '<Control-Panel Authorization/Token Header>' -X POST “<Control-Panel JetBackup API Endpoint>” -H "Content-Type: application/json"  -d ‘{

    "sort": {

        "start_time": -1

    },

    "skip": 0,

    "limit": 50,

    "find": {

        "type": 1,

        "info.ID": "<backup_job_id>"

    },

    "filter": "",

    "function": "listLogs"

}’

The key arguments you need to specify here is the find array where you specify the type, 1 in this example indicating backup job logs, and info.ID where in you specify the ID for the Backup Job you’d like to check the status of.

You may use listBackupJobs to find your backup_job_id.

With JetBackup, it’s easy to set up alerts for customers to notify them of errors or potential issues. This ensures that they are informed and can take action before problems escalate.

Enhancing Security for Backup Data

Today, security is a priority in any backup system. JetBackup’s API supports encrypted storage through the destinations endpoint, allowing for secure backup storage on remote or cloud destinations. Customers can manage their security settings by offering encryption options directly within the interface, adding an extra control layer. For heightened security, consider adding role-based access, restricting sensitive backup and restore operations to authorized users only.

Scaling for Growth with JetBackup’s API

JetBackup’s API allows easy scalability as your infrastructure or customer base grows. You can adjust schedules dynamically, add new storage destinations, and update retention policies directly within your interface. These flexible controls allow customers to change their schedules, storage locations, and retention preferences to meet evolving needs. This scalability allows your backup system to grow without compromising data integrity or customer experience.

Not ready to reinvent the wheel? JetBackup integrates seamlessly with top control panels like cPanel, Plesk, DirectAdmin, and more, offering you a complete “self-service” solution right out of the box. We even provide a WordPress plugin for WordPress hosting that allows your customers to control their backups directly from their WordPress Admin Panel. 

Explore JetBackup’s API documentation and choose the approach that best suits your business needs, from building a custom control panel to leveraging the power of our fully integrated solutions. https://docs.jetbackup.com/v5.3/api/