CubeBackup API Reference
INTRODUCTION
Starting with version 4.9, CubeBackup for Google Workspace provides an API for administrators to integrate the backup service with their own systems. This powerful and flexible API can be used to set up a new CubeBackup instance, access and monitor backup status, automate backup management and license assignment, as well as many other routine tasks.
The CubeBackup for Google Workspace API is organized around REST. It has predictable resource-oriented URLs, accepts form-encoded data and JSON payloads in the HTTP request body, and returns standard HTTP response codes with human-readable or JSON-encoded responses.
The following docs will demonstrate using curl to interact with the CubeBackup API over HTTP.
AUTHENTICATION
Step 1. Enable the API feature on your CubeBackup instance
For security purposes, the CubeBackup API is disabled by default. To enable the API on your CubeBackup for Google Workspace instance, please modify the configuration file:
Open the config file config.toml on the backup server using a text editor.
Note:
Starting with version 4.7, the configuration file is located at <installation directory>/etc/config.toml for fresh installations of CubeBackup. For installations upgraded through the console, or versions prior to 4.7, the configuration file is still located at <installation directory>/bin/config.toml.
On Windows, the installation directory is located at C:\Program Files\CubeBackup4 by default.
On Linux, the installation directory is located at /opt/cubebackup by default.In the [API] section, please change the value of
Enabledtotrue, and remove the comment character#from the beginning of the line. If your config.toml file doesn't contain an [API] section, please add it manually at the end of your configuration file. The [API] section should be formatted like the example below after modification.[API] Enabled = true IPWhitelist = ["192.168.10.1/24", "2001:0db8::1428:57ab"]
Note:
1. For security concerns, we strongly recommend that you enable the IP whitelist to restrict access to your CubeBackup API. Under the [API] section, add a list of trusted IP addresses to theIPWhitelistarray, and remove the comment character#from the beginning of the line. TheIPWhitelistfield accepts values in the format of IPv4, IPv6, or IP ranges of your office network.
2. For even more granular settings, you can go further and add theIPWhiteListfield to a specific API client in the corresponding [[API.Clients]] section after creating an API client. This will restrict API requests for this particular client to only the whitelisted IP addresses.
Step 2. Create an API client
Before interacting with the API on your CubeBackup for Google Workspace instance, you will need to create an API client. Supply a valid client name, and a unique API key will be returned after running the following command:
cbackup addAPIClient <"client_name">
Tip:
On Windows, the cbackup.exe file is located in C:\Program Files\CubeBackup4\bin directory by default.
On Linux, the cbackup file is located in /opt/cubebackup/bin directory by default.
Options
-keyOnlyUsing this option, this command will only return the API key in the response, which may help automate the API client creation in your CubeBackup integration.
-adminBy default, an individual CubeBackup API client will be granted with system admin privileges. However, CubeBackup also supports creating a linked API client for an existing CubeBackup admin, with identical permissions based on the role of the CubeBackup admin .
Using this option, you only need to pass along a CubeBackup admin email address, which will be automatically be assigned as the API client name. For example:
cbackup addAPIClient -admin [email protected]
NOTE:
The API key will only be displayed once when it is created and cannot be retrieved in the future. Please be sure to save it in a secure location for future usage.
This command requires Administrator/root privilege.
If CubeBackup runs on Windows, please run this command as an Administrator.
If CubeBackup runs on Linux, please use sudo … in the bash shell.
Step 3. Authenticate requests with API key
The CubeBackup API authenticates your HTTP request using the API keys of each API client. You can pass the API key into a REST API call using the Authorization header.
curl --request POST ".../api/v1/..." \ --header "Authorization:{API key}"
Step 4. Manage your API clients
All active API clients are listed in the configuration file config.toml on your backup server.
As in the sample, you can view the list of enabled API clients on a CubeBackup instance, and disable any API client by commenting out or deleting the corresponding record in the config.toml file.
... [[API.Clients]] Name = "client1" Id = "da1c122158...ad14b3240f7" Admin = false [[API.Clients]] Name = "[email protected]" Id = "b83ffc173e...e648daa96bb" Admin = true ...
Step 5. Keep your API keys safe
CubeBackup API keys carry many privileges and can be used to make any API call such as modifying system settings or retrieving user information. Please be sure to keep them secure and do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
ERRORS
CubeBackup uses conventional HTTP response codes to indicate the success or failure of an API request. In general,
- Codes in the
2xxrange indicate success. - Codes in the
4xxrange indicate an error, giving a brief human-readable explanation in theMessagefield (such as insufficient permissions, the requested resource does not exist, required parameter missing or wrong format of the form body, etc.). - Codes in the
5xxrange indicate an unexpected error.
CORE RESOURCES
Setup
The API can be used to set up a new CubeBackup instance. You can use it to retrieve the initial setup status, as well as create a system admin account during the final steps of the setup process.
To grant your CubeBackup instance access to your Google Workspace data, you can also use the API to upload a GCP service account during the initial setup. Additionally, you can retrieve the service account currently on record using this API.
Related guide:
- How to complete the initial configuration and add new domains to back up using CubeBackup APIs .
- A sample Python script for the initial setup using CubeBackup APIs can be found in our Git repository .
GET /api/v1/setup/status POST /api/v1/setup/complete POST /api/v1/google/sat GET /api/v1/google/sat
Retrieve the setup status
Retrieve the current setup status to check if the initial setup is done.
PARAMETERSNo parameters.
RESPONSE
Returns the setup status string in the response body:
"done"if the setup is complete"pending"if the setup is not complete
Message attribute in the response body.
GET /api/v1/setup/status
curl -L ".../api/v1/setup/status" \ --header "Authorization:255c6...88111"
Create a system admin during initial setup
Creating a valid system admin for the CubeBackup web console is the last step of CubeBackup initial setup. This API will check the storage and service account setup status before successfully creating the system admin, and will be disabled once the initial setup is marked as done.
AdminName requiredName of the newly-created system admin.
AdminEmail requiredEmail address for the newly-created system admin.
Password requiredPassword of the newly-created system admin.
RESPONSE
Returns
"OK" if the CubeBackup admin is successfully created and the initial setup is complete.Otherwise, returns an error with a detailed
Message attribute in the response body.
Tip: A common source of error is that the service account key is not yet uploaded, or the storage location is not configured yet.
POST /api/v1/setup/complete
curl -L \ --request POST ".../api/v1/setup/complete"\ --header "Authorization:255c6...88111" \ --data AdminName="CubeSysAdmin" \ --data AdminEmail="[email protected]" \ --data Password="12...bc"
The Service account object
A valid Google Cloud Platform(GCP) Service account object contains the following attributes. All required attributes are already included in the service account key file downloaded from your GCP console. Follow the detailed instructions on how to generate a service account for CubeBackup .
Attributestype stringproject_id stringprivate_key_id stringprivate_key stringclient_email stringclient_id stringauth_uri stringtoken_uri stringauth_provider_x509_cert_url stringclient_x509_cert_url string{
"type": "service_account",
"project_id": "cubebackup...test",
"private_key_id": "03cf6...e1165",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIE...v9zkg\n-----END PRIVATE KEY-----\n",
"client_email": "test...iam.gserviceaccount.com",
"client_id": "10279...82949",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/...test.iam.gserviceaccount.com"
}
Upload a service account
This API can help upload your GCP service account during the initial setup or update it with a new one to rotate or replace an invalid service account.
Please be sure to add the Content-Type: application/json header to this HTTP request.
PARAMETERS
The Service account object requiredAfter generating the service account key file in GCP, you can open the JSON file using a text editor. Copy and paste the values to populate the Service account object.
RESPONSE
Returns
"OK" if the service account is successfully uploaded.
Or this call returns an error code with a detailed Message attribute in the response body if the service account key or other properties are invalidly formatted, or if any other error occurs.
POST /api/v1/google/sat
curl -L \ --request POST ".../api/v1/google/sat" \ --header "Authorization:255c6...88111" \ --header "Content-Type: application/json"\ --data '{ "type": "service_account", "project_id": "cubebackup...test", "private_key_id": "03cf6...e1165", "private_key": "-----BEGIN PRIVATE KEY-----\nMIIE...v9zkg\n-----END PRIVATE KEY-----\n", "client_email": "test...iam.gserviceaccount.com", "client_id": "10279...82949", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/...test.iam.gserviceaccount.com" }'
Retrieve the current service account
Retrieve the current service account key.
PARAMETERSNo parameters.
RESPONSE
Returns
the Service account object if a valid one has been successfully uploaded; otherwise, returns an error.
GET /api/v1/google/sat
curl -L ".../api/v1/google/sat" \ --header "Authorization:255c6...88111"
Storage
The Storage object represents the backup repository of your CubeBackup instance. It contains the storage location, access credentials, and other storage settings.
Related guide:POST /api/v1/storage/settings PATCH /api/v1/storage/settings GET /api/v1/storage/settings GET /api/v1/storage/status
The Storage object
Fields in the Storage object vary depending on the storage type. For a detailed explanation and sample of the required attributes, please click the appropriate tab below for your storage type and operating system.
EncryptEnabled booleanWhether or not the backup data should be encrypted.
Type enumThe storage type.
LOCAL refers to Local disk.
IndexPath stringThe storage location for the data index.
DataPath stringThe storage location for the backup repository.
{
"EncryptEnabled": true,
"Type": "LOCAL",
"IndexPath": "/opt/cubebackup/index",
"DataPath": "/var/cubebackup_data"
}
EncryptEnabled booleanWhether or not the backup data should be encrypted.
Type enumThe storage type.
WINS refers to Windows network location.
IndexPath stringThe storage location for the data index.
WinsLocation stringThe network storage location of the backup repository.
WinsUsername stringThe username used to access the network location on Windows.
WinsPassword stringThe password used to access the network location on Windows.
{
"EncryptEnabled": true,
"Type": "WINS",
"IndexPath": "C:\\Program Files\\CubeBackup4\\index",
"WinsLocation": "\\\\BACKUPNAS\\homes\\gsuitebackups",
"WinsUsername": "BACKUPNAS\\cube",
"WinsPassword": "12345"
}
EncryptEnabled booleanWhether or not the backup data should be encrypted.
Type enumThe storage type.
NAS refers to Mounted Network storage.
IndexPath stringThe storage location for the data index.
DataPath stringThe mounted network storage location for the backup data.
{
"EncryptEnabled": true,
"Type": "NAS",
"IndexPath": "/opt/cubebackup/index",
"DataPath": "/var/cubebackup_data"
}
EncryptEnabled booleanWhether or not the backup data should be encrypted.
Type enumThe storage type.
S3 refers to Amazon S3 storage.
IndexPath stringThe storage location for the data index.
S3Bucket stringThe name of the S3 bucket.
S3Region stringThe region of the S3 bucket. For AWS S3 storage regions, please refer to this doc .
S3AccessKeyId stringThe IAM Access key ID used to access the bucket.
S3SecretAccessKey stringThe IAM Secret Access key used to access the bucket.
S3CoolStorageClass enumThe storage class for the backup data in Amazon S3.
Possible enum values:
STANDARDfor StandardSTANDARD_IAfor Standard-IAONEZONE_IAfor One Zone-IAINTELLIGENT_TIERINGfor Intelligent-TieringGLACIER_IRfor Glacier Instant Retrieval
{
"EncryptEnabled": true,
"Type": "S3",
"IndexPath": "/opt/cubebackup/index",
"S3Bucket": "cubebackup-beta-ubuntu",
"S3Region": "us-east-1",
"S3AccessKeyId": "AKIAW...4YZEYUY",
"S3SecretAccessKey": "gCA0U...pgiDX",
"S3CoolStorageClass": "STANDARD_IA"
}
EncryptEnabled booleanWhether or not the backup data should be encrypted.
Type enumThe storage type.
GOOGLE refers to Google Cloud storage.
IndexPath stringThe storage location for the data index.
GoogleBucket stringThe name of the Google Cloud Storage bucket.
GoogleCoolStorageClass enumThe storage class for the backup data in Google Cloud.
Possible enum values:
STANDARDfor StandardNEARLINEfor NearlineCOLDLINEfor ColdlineARCHIVEfor Archive
{
"EncryptEnabled": true,
"Type": "GOOGLE",
"IndexPath": "/opt/cubebackup/index",
"GoogleBucket": "cubebackup-beta",
"GoogleCoolStorageClass": "COLDLINE"
}
EncryptEnabled booleanWhether or not the backup data should be encrypted.
Type enumThe storage type.
AZURE refers to Microsoft Azure Blob storage.
IndexPath stringThe storage location for the data index.
AzureAccountName stringThe name of the Azure storage account.
AzureAccountKey stringThe Access Key to the storage account.
AzureContainer stringThe container in the storage account.
AzureCoolStorageClass enumThe access tier for the backup data in Azure Blob storage.
Possible enum values:
Hotfor HotCoolfor CoolColdfor Cold
{
"EncryptEnabled": true,
"Type": "AZURE",
"IndexPath": "/opt/cubebackup/index",
"AzureAccountName": "cube-account",
"AzureAccountKey": "XihUF...SEYA==",
"AzureContainer": "cube-container",
"AzureCoolStorageClass": "Cool"
}
EncryptEnabled booleanWhether or not the backup data should be encrypted.
Type enumThe storage type.
S3C refers to S3 compatible storage.
IndexPath stringThe storage location for the data index.
S3Endpoint stringThe appropriate service URL for the storage region of the bucket.
S3Bucket stringThe name of the S3 compatible bucket.
S3Region stringThe region of the S3 compatible bucket.
S3AccessKeyId stringThe Access key ID used to access the bucket.
S3SecretAccessKey stringThe Secret Access key used to access the bucket.
{
"EncryptEnabled": true,
"Type": "S3C",
"IndexPath": "/opt/cubebackup/index",
"S3Endpoint": "https://s3.us-west-000.backblazeb2.com",
"S3Bucket": "cubebackup-bucket",
"S3Region": "us-west-000",
"S3AccessKeyId": "000b4...00007",
"S3SecretAccessKey": "K000A...I4r7A"
}
Create the backup storage
This API can be used to configure the storage location during the initial setup of a CubeBackup instance, and will be disabled once the setup is marked as done in CubeBackup.
Please be sure to add the Content-Type: application/json header to this HTTP request.
PARAMETERS
The Storage object requiredPlease include all the required attributes for the storage type you have chosen.
RESPONSE
Returns
the Storage object if the storage has been successfully configured.Otherwise, returns an error with a detailed
Message attribute in the response body if the storage writing test fails or any other error occurs.
POST /api/v1/storage/settings
curl -L \ --request POST ".../api/v1/storage/settings"\ --header "Authorization:255c6...88111" \ --header "Content-Type: application/json"\ --data '{ "EncryptEnabled": true, "Type": "LOCAL", "IndexPath": "...", "DataPath": "..." }'
Update the storage settings
Update the storage settings of your current backup repository.
NOTE: This API should only be used to rename the storage location or update storage credentials. To change the backup repository location and migrate the backup data, please refer to How to migrate my Google Workspace backups to another storage location .
Please be sure to add the Content-Type: application/json header to this HTTP request.
PARAMETERS
The Storage object optionalOptional fields in the Storage object.
RESPONSE
Returns
the Storage object if the storage settings have been successfully updated.Otherwise, returns an error with a detailed
Message attribute in the response body if the storage writing test fails or any other error occurs.
PATCH /api/v1/storage/settings
curl -L \ --request PATCH ".../api/v1/storage/settings"\ --header "Authorization:255c6...88111" \ --header "Content-Type: application/json"\ --data '{ "S3AccessKeyId": "AKIAW...4YZEYUY", "S3SecretAccessKey": "gCA0U...pgiDX" }'
Retrieve the storage settings
Retrieve the storage settings of your current backup repository.
PARAMETERSNo parameters.
RESPONSE
Returns
the Storage object if it has been successfully configured; otherwise, returns an error.
GET /api/v1/storage/settings
curl -L ".../api/v1/storage/settings"\ --header "Authorization:255c6...88111"
The Storage status object
Type enumPossible enum values:
LOCALfor local diskWINSfor Windows network locationNASfor mounted network storage on LinuxS3for Amazon S3GOOGLEfor Google Cloud storageAZUREfor Azure Blob storageS3Cfor S3 compatible storage
Desc stringDescription of the storage type.
Location stringStorage path or bucket name of cloud storage.
StorageTotal integerThe total storage space of the backup destination directory in bytes. Returns
-1 for unlimited storage space of a cloud storage bucket.StorageFree integerThe available storage space for the backup destination directory in bytes. Returns
-1 for unlimited available storage space of a cloud storage bucket.IndexPath stringStorage location of the local data index.
IndexTotal integerThe total storage space of the index directory in bytes.
IndexFree integerThe available storage space for the index directory in bytes.
{
"Type": "LOCAL",
"Desc": "Local disk",
"Location": "/var/cubebackup_data",
"StorageTotal": 17167265792,
"StorageFree": 15123443712,
"IndexPath": "/opt/cubebackup/index",
"IndexTotal": 17167265792,
"IndexFree": 15123443712
}
Retrieve the storage status
Retrieve the storage status of your current backup repository.
PARAMETERSNo parameters.
RESPONSE
Returns
the Storage status object; otherwise, returns an error.
GET /api/v1/storage/status
curl -L ".../api/v1/storage/status" \ --header "Authorization:255c6...88111"
License
The license object represents the currently active license for your CubeBackup instance. It allows you to retrieve the license status to track usage, or activate a license code on your CubeBackup instance.
Related guide: How to monitor the CubeBackup service status (backup/storage/license) programmatically using CubeBackup APIs .GET /api/v1/license GET /api/v1/license/display POST /api/v1/license/activate
The License object
Stat hashThe Stat object contains data associated with the CubeBackup license usage.
Stat.DomainCount numberThe number of domains currently being protected in a CubeBackup instance.
Stat.UserCount numberThe number of Google Workspace users in all domains.
Stat.ProtectedUserCount numberThe number of users currently being backed up in all domains.
License hashThe License object contains data associated with the CubeBackup license status.
License.UUID stringThe unique ID of a CubeBackup license subscription.
License.Code stringThe license code.
License.Type enumPossible enum values:
trialfor the 14-day free trial versionnormalfor business and enterprise organizationsedufor educational and non-profit organizationssitefor other types of organizations
License.Status enumPossible enum values:
normalfor an active CubeBackup licensedisabledfor a disabled CubeBackup license
License.Error stringDetailed error message for a disabled license, if any.
License.CreatedTime timestampWhen the subscription was created. Measured in seconds since the Unix epoch.
License.UpdatedTime timestampThe last time the license information was updated with the CubeBackup license server. Measured in seconds since the Unix epoch.
License.DueTime timestampWhen the current subscription expires. Measured in seconds since the Unix epoch.
License.AccountNumber integerNumber of accounts in the current CubeBackup subscription.
License.ContactEmail stringContact Email address for the CubeBackup subscription. All renewal notifications and invoices will be sent to this email address.
License.ContactName stringName of the contact person for the CubeBackup subscription.
IsExpired booleanWhether or not the current license has expired.
UpdateURL stringURL for the CubeBackup customer portal.
PurchaseURL stringURL for the pricing page for CubeBackup licenses.
TrialDaysLeft integerThe number of days left in a
trial license.DueDate stringThe human-readable expiration date for the CubeBackup subscription.
CodeDisplay stringA string containing the formatted license code.
{
"Stat": {
"DomainCount": 1,
"UserCount": 500,
"ProtectedUserCount": 300
},
"License": {
"UUID": "ly3vv...iah2g",
"Code": "p4c8r...sy5cc",
"Type": "edu",
"Status": "normal",
"Error": "",
"CreatedTime": 1662425706,
"UpdatedTime": 1665963900,
"DueTime": 1665792000,
"AccountNumber": 500,
"ContactEmail": "[email protected]",
"ContactName": "admin"
},
"IsExpired": true,
"UpdateURL": "https://www.cubebackup.com/subscriptions/n1tqe...7v1lx",
"PurchaseURL": "https://www.cubebackup.com/pricing",
"TrialDaysLeft": 0,
"DueDate": "Oct 15, 2023",
"CodeDisplay": "P4C8R...SY5CC"
}
Retrieve the license status
Retrieve the current license status.
PARAMETERSNo parameters.
RESPONSE
Returns the
License attribute of the License object; otherwise, returns an error.
GET /api/v1/license
curl -L ".../api/v1/license" \ --header "Authorization:255c6...88111"
Retrieve the license usage
Retrieve the current license usage.
PARAMETERSNo parameters.
RESPONSE
Returns
the License object; otherwise, returns an error.
GET /api/v1/license/display
curl -L ".../api/v1/license/display" \ --header "Authorization:255c6...88111"
Activate a CubeBackup license
Activate a CubeBackup license.
PARAMETERSCode requiredA string containing the CubeBackup license code.
RESPONSE
Returns the
License attribute of the License object if the license is successfully activated.Or this call returns an error code with a detailed
Message attribute in the response body if you provide an invalid license code or any other error occurs.
POST /api/v1/license/activate
curl -L \ --request POST ".../api/v1/license/activate" \ --header "Authorization:255c6...88111" \ --data Code="P4Q9...DKCC"
Domains
The domain object represents a Google Workspace domain added to your CubeBackup instance. It allows you to add and update the domain as well as retrieve the backup status and summary.
Related guide:
GET /api/v1/domains
POST /api/v1/domains
PATCH /api/v1/domains/{{domainName}}
GET /api/v1/domains/{{domainName}}/summary
GET /api/v1/domains/{{domainName}}/settings
PATCH /api/v1/domains/{{domainName}}/settings
The Domain object
Name stringA Google Workspace domain name.
AdminEmail stringEmail address of the Google Workspace domain admin.
TotalDataSize integerThe total data size of the domain data in bytes.
StorageSize integerThe size of the domain backup data in bytes.
IndexSize integerThe size of the domain data index in bytes.
Status enumPossible enum values:
created: the domain has just been added to the domain list, and will not be displayed in the CubeBackup web console.active: the domain has been activated and listed in the CubeBackup web console.
{
"Name": "mydomain.com",
"AdminEmail": "[email protected]",
"TotalDataSize": 0,
"StorageSize": 0,
"IndexSize": 0,
"Status": "created"
}
Add a domain
Add a Google Workspace domain to be backed up, and test on the access permissions of this domain.
NOTE: The domain will be added withcreatedstatus. To proceed and manage the domain in the CubeBackup web console, please update the domain status toactive.
PARAMETERS
DomainName requiredName of a valid Google Workspace domain.
AdminEmail requiredEmail address in the Google Workspace domain admin.
RESPONSE
Returns
the Domain object if the domain is successfully added.Or this call returns an error code with a detailed
Message attribute in the response body if the permission testing fails or any other error occurs.
POST /api/v1/domains
curl -L \ --request POST ".../api/v1/domains" \ --header "Authorization:255c6...88111" \ --data DomainName="mydomain.com" \ --data AdminEmail="[email protected]"
Update a domain
Update the Google Workspace admin email address on file, or update the domain status.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
NOTE:PARAMETERS
1. This API call will not test the access permissions for your CubeBackup instance. Please be careful when you input the new admin email address.
2. The domain will only be displayed in the CubeBackup web console when the status isactive.
Status optionalThe possible status value is either
created or active.AdminEmail optionalEmail address of the Google Workspace domain admin.
RESPONSE
Returns
the Domain object if the domain has been successfully updated.Otherwise, returns an error with a detailed
Message attribute in the response body.
PATCH /api/v1/domains/{{domainName}}
curl -L \ --request PATCH ".../api/v1/domains/mydomain.com" \ --header "Authorization:255c6...88111" \ --data AdminEmail="[email protected]" \ --data Status="active"
List all domains
Retrieve a list of all domains in a CubeBackup instance.
PARAMETERSNo parameters.
RESPONSE
Returns an array of
the Domain object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains
curl -L ".../api/v1/domains" \ --header "Authorization:255c6...88111"
The Domain summary object
Name stringA Google Workspace domain name.
UserCount integerNumber of users in the domain.
UserBackupedCount integerNumber of users that are currently being backed up for the domain.
SharedDriveCount integerNumber of Shared drives in the domain.
SharedDriveBackupedCount integerNumber of Shared drives that are currently being backed up for the domain.
DriveIndexSize integerTotal size in bytes of the data index for Google Drive backups for the domain.
DriveStorageSize integerTotal size in bytes of the backup data for Google Drive backups for the domain.
GmailIndexSize integerTotal size in bytes of the data index for Gmail backups for the domain.
GmailStorageSize integerTotal size in bytes of the backup data for Gmail backups for the domain.
CalendarIndexSize integerTotal size in bytes of the data index for Google Calendar backups for the domain.
CalendarStorageSize integerTotal size in bytes of the backup data for Google Calendar backups for the domain.
ContactsIndexSize integerTotal size in bytes of the data index for Google Contacts backups for the domain.
ContactsStorageSize integerTotal size in bytes of the backup data for Google Contacts backups for the domain.
SitesIndexSize integerTotal size in bytes of the data index for Google Sites backups for the domain.
SitesStorageSize integerTotal size in bytes of the backup data for Google Sites backups for the domain.
SharedDriveIndexSize integerTotal size in bytes of the data index for Shared drive backups for the domain.
SharedDriveStorageSize integerTotal size in bytes of the backup data for Shared drive backups for the domain.
{
"Name": "mydomain.com",
"UserCount": 3,
"UserBackupedCount": 3,
"SharedDriveCount": 50,
"SharedDriveBackupedCount": 50,
"DriveIndexSize": 0,
"DriveStorageSize": 0,
"GmailIndexSize": 0,
"GmailStorageSize": 0,
"CalendarIndexSize": 0,
"CalendarStorageSize": 0,
"ContactsIndexSize": 0,
"ContactsStorageSize": 0,
"SitesIndexSize": 0,
"SitesStorageSize": 0,
"SharedDriveIndexSize": 0,
"SharedDriveStorageSize": 0
}
Retrieve domain summary status
Retrieve the domain usage summary.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns
the Domain summary object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/summary
curl -L ".../api/v1/domains/mydomain.com/summary" \ --header "Authorization:255c6...88111"
The Domain settings object
Gmail hashGmail backup settings for the domain.
Gmail.Backup booleanWhether or not backups are enabled for Gmail.
Drive hashGoogle Drive backup settings for the domain.
Drive.Backup booleanWhether or not backups are enabled for Google Drive.
Drive.BackupFilesSharedWithMe booleanWhether or not the "Backup files shared with me" option is enabled.
Drive.DisableAutoBackupNewSharedDrive booleanWhether or not CubeBackup automatically backs up newly created Shared drives.
Drive.ExcludeRule stringString representing the file exclusion rules for Google Drive backups.
Calendar hashGoogle Calendar backup settings for the domain.
Calendar.Backup booleanWhether or not backups are enabled for Google Calendar.
Contacts hashGoogle Contacts backup settings for the domain.
Contacts.Backup booleanWhether or not backups are enabled for Google Contacts.
Sites hashGoogle Sites backup settings for the domain.
Sites.Backup booleanWhether or not backups are enabled for Google Sites.
Backup hashDomain backup settings.
Backup.DataRetentionMaxDays integerBackup retention policy settings for this domain.
0 represents the default CubeBackup retention policy with unlimited versions. A positive integer represents the number of days for which the oldest version histories will be preserved.
{
"Gmail": {
"Backup": true
},
"Drive": {
"Backup": true,
"BackupFileSharedWithMe": false,
"DisableAutoBackupNewSharedDrives": false,
"ExcludeRule": "size>10GB"
},
"Calendar": {
"Backup": true
},
"Contacts": {
"Backup": true
},
"Sites": {
"Backup": false
},
"Backup": {
"DataRetentionMaxDays": 365
}
}
Retrieve domain settings
Retrieve the domain backup settings.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns
the Domain settings object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/settings
curl -L ".../api/v1/domains/mydomain.com/settings" \ --header "Authorization:255c6...88111"
Update domain settings
Update the domain backup settings.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
Please be sure to add the Content-Type: application/json header to this HTTP request.
PARAMETERS
The Domain settings object optionalOptional fields in the Domain settings object.
RESPONSE
Returns
the Domain object if the domain is successfully updated.Otherwise, returns an error with a detailed
Message attribute in the response body.
PATCH /api/v1/domains/{{domainName}}/settings
curl -L \ --request PATCH ".../api/v1/domains/mydomain.com/settings" \ --header "Authorization:255c6...88111" \ --header "Content-Type: application/json"\ --data '{ "Gmail": { "Backup": false }, "Drive": { "BackupFileSharedWithMe": false, "DisableAutoBackupNewSharedDrives": false, "ExcludeRule": "size>10GB" } }'
Organization Units
The Organization Unit object represents an Organization Unit in your Google Workspace domain. It allows you to batch update the auto-backup status as well as retrieve the OU list for the domain.
Related guide: How to automate backup management and license assignment programmatically using CubeBackup APIs .
GET /api/v1/domains/{{domainName}}/ous
POST /api/v1/domains/{{domainName}}/ous/batch-update-auto-backup-status
The Organization Unit object
Name stringName of an Organization Unit.
Description stringAn arbitrary string used to describe an Organization Unit.
AutoEnableBackup booleanWhether or not new users in this Organization Unit are automatically backed up.
OrgUnitPath stringFull path for an Organization Unit.
ParentOrgUnitPath stringFull path for the parental unit of an Organization Unit.
{
"Name": "Financial",
"Description": "",
"AutoEnableBackup": true,
"OrgUnitPath": "/Departments/Financial",
"ParentOrgUnitPath": "/Departments"
}
List all Organization Units
Retrieve a list of all Organization Units in the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns an array of
the Organization Unit object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/ous
curl -L ".../api/v1/domains/mydomain.com/ous" \ --header "Authorization:255c6...88111"
Batch update OU auto-backup status
Update the auto-backup option of Organization Units in the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
Please be sure to add the Content-Type: application/json header to this HTTP request.
PARAMETERS
EnabledUnitPaths optionalAn array of the Organization Unit full paths to be enabled.
DisabledUnitPaths optionalAn array of the Organization Unit full paths to be disabled.
RESPONSE
Returns
"OK" if the Organization Unit backup status has been successfully updated.Otherwise, returns an error with a detailed
Message attribute in the response body.
POST /api/v1/domains/{{domainName}}/ous/batch-update-auto-backup-status
curl -L \ --request POST ".../api/v1/domains" \ --header "Authorization:255c6...88111" \ --header "Content-Type: application/json"\ --data '{ "EnabledUnitPaths":["/Department/OUa",...], "DisabledUnitPaths":["/Department/OUb",...] }'
Users
The user object represents a user in your Google Workspace. It allows you to batch update the backup status of multiple users, as well as retrieve the backup status summary for a specific user.
Related guide:
GET /api/v1/domains/{{domainName}}/users
GET /api/v1/domains/{{domainName}}/users/{{userId}}
GET /api/v1/domains/{{domainName}}/users/{{userId}}/photo
POST /api/v1/domains/{{domainName}}/users/sync
POST /api/v1/domains/{{domainName}}/users/batch-update-backup-status
The User object
Id stringID of the Google Workspace user.
PrimaryEmail stringPrimary email address of the Google Workspace user.
FullName stringFull name of the Google Workspace user.
OrgUnitPath stringFull path of the organization unit to which the user is assigned.
IsAdmin booleanWhether or not the user has Google Workspace Super Admin privileges or not.
Suspended booleanWhether or not a user is suspended in Google Workspace.
Deleted booleanWhether or not a user has been deleted in Google Workspace.
TotalDataSize integerTotal size in bytes for backups for the user.
TotalStorageSize integerSize in bytes of the backup data for the user.
TotalIndexSize integerSize in bytes of the data index for the user.
DriveIndexSize integerSize in bytes of the data index for Google Drive backups for the user.
DriveStorageSize integerSize in bytes of the backup data for Google Drive backups for the user.
GmailIndexSize integerSize in bytes of the data index for Gmail backups for the user.
GmailStorageSize integerSize in bytes of the backup data for Gmail backups for the user.
CalendarIndexSize integerSize in bytes of the data index for Google Calendar backups for the user.
CalendarStorageSize integerSize in bytes of the backup data for Google Calendar backups for the user.
ContactsIndexSize integerSize in bytes of the data index for Google Contacts backups for the user.
ContactsStorageSize integerSize in bytes of the backup data for Google Contacts backups for the user.
SitesIndexSize integerSize in bytes of the data index for Google Sites backups for the user.
SitesStorageSize integerSize in bytes of the backup data for Google Sites backups in a user.
BackupEnabled booleanWhether or not a user is part of the active backup set.
{
"Id": "11386...68194",
"PrimaryEmail": "[email protected]",
"FullName": "user A",
"OrgUnitPath": "/Departments/Financial",
"IsAdmin": false,
"Suspended": false,
"Deleted": false,
"TotalDataSize": 0,
"TotalIndexSize": 0,
"TotalStorageSize": 0,
"DriveStorageSize": 0,
"DriveIndexSize": 0,
"GmailStorageSize": 0,
"GmailIndexSize": 0,
"CalendarStorageSize": 0,
"CalendarIndexSize": 0,
"ContactsStorageSize": 0,
"ContactsIndexSize": 0,
"SitesStorageSize": 0,
"SitesIndexSize": 0,
"BackupEnabled": true
}
List all users
Retrieve a list of all users in the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
The following parameters are optional and should be added as URL queries in this API call.
IncludeDeleted optional boolean Whether or not to include deleted users in the list. Set to
false by default.IncludeSuspended optional boolean Whether or not to include suspended users in the list. Set to
false by default.IncludeArchived optional boolean Whether or not to include archived users in the list. Set to
false by default.RESPONSE
Returns an array of
the User object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/users
curl -L ".../api/v1/domains/mydomain.com/users?IncludeDeleted=true&IncludeSuspended=true&IncludeArchived=true" \ --header "Authorization:255c6...88111"
Retrieve user details
Retrieves the details for a user. Supply the unique {{userId}} that was returned from your previous request, and CubeBackup will return the corresponding user information and backup status.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns
the User object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/users/{{userId}}
curl -L ".../api/v1/domains/mydomain.com/users/11386...68194" \ --header "Authorization:255c6...88111"
Retrieve user photo
Retrieves the Google profile photo for the user. Supply the unique {{userId}} that was returned from your previous request, and CubeBackup will return the corresponding user profile photo.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns the user profile photo in PNG format.
Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/users/{{userId}}/photo
curl -L ".../api/v1/domains/mydomain.com/users/11386...68194/photo" \ --header "Authorization:255c6...88111"
Sync user list with Google
Update the user list to sync the latest changes from Google Workspace for the domain into your CubeBackup instance.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns
"OK" if the user list is successfully updated.Otherwise, returns an error with a detailed
Message attribute in the response body.
POST /api/v1/domains/{{domainName}}/users/sync
curl -L \ --request POST ".../api/v1/domains/mydomain.com/users/sync" \ --header "Authorization:255c6...88111"
Batch update user backup status
Include or exclude a list of users from the backup for the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
Please be sure to add the Content-Type: application/json header to this HTTP request.
You can also update the user backup status using a list of email addresses in CSV format. A sample Python script can be found in our Git repository .
PARAMETERS
EnabledUserIds optionalAn array of the user IDs to be enabled.
DisabledUserIds optionalAn array of the user IDs to be disabled.
RESPONSE
Returns
"OK" if the user backup status is successfully updated.Otherwise, returns an error.
POST /api/v1/domains/{{domainName}}/users/batch-update-backup-status
curl -L \ --request POST ".../api/v1/domains/mydomain.com/users/batch-update-backup-status" \ --header "Authorization:255c6...88111" \ --header "Content-Type: application/json"\ --data '{ "EnabledUserIds":["11386...68194",...], "DisabledUserIds":["18326...42981",...] }'
Shared drives
The Shared drive object represents a Shared drive in your Google Workspace for the domain. It allows you to batch update the backup status of multiple Shared drives or retrieve the backup status summary for a specific Shared drive.
Related guide:
GET /api/v1/domains/{{domainName}}/shareddrives
GET /api/v1/domains/{{domainName}}/shareddrives/{{sharedDriveId}}
POST /api/v1/domains/{{domainName}}/shareddrives/sync
POST /api/v1/domains/{{domainName}}/shareddrives/batch-update-backup-status
The Shared drive object
Id stringUnique ID of a Google Workspace Shared drive.
Name stringName of a Google Workspace Shared drive.
BackgroundImageLink stringThe publicly accessible URL of the Shared drive background image.
TotalDataSize integerTotal size in bytes for backups for the Shared drive.
IndexSize integerSize in bytes of the data index for the Shared drive.
StorageSize integerSize in bytes of the backup data for the Shared drive.
Deleted booleanWhether or not the Shared drive has been deleted in Google Workspace.
BackupEnabled booleanWhether or not the Shared drive is part of the active backup list.
{
"Id": "0ANE...9PVA",
"Name": "MySharedDrive",
"BackgroundImageLink": "https://ssl.gstatic.com/...jpg",
"TotalDataSize": 0,
"IndexSize": 0,
"StorageSize": 0,
"Deleted": false,
"BackupEnabled": true
}
List all Shared drives
Retrieve a list of all Shared drives in the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
The following parameters are optional and should be added as URL queries in this API call.
IncludeDeleted optional boolean Whether or not to include deleted Shared drives in the list. Set to
false by default.RESPONSE
Returns an array of
the Shared drive object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/shareddrives
curl -L ".../api/v1/domains/mydomain.com/shareddrives?includeDeleted=true" \ --header "Authorization:255c6...88111"
Retrieve Shared drive details
Retrieves the details for a Shared drive. Supply the unique {{sharedDriveId}} that was returned from your previous request, and CubeBackup will return the corresponding Shared drive information and backup status.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns
the Shared drive object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/shareddrives/{{sharedDriveId}}
curl -L ".../api/v1/domains/mydomain.com/shareddrives/0ANE...9PVA" \ --header "Authorization:0ANEw...k9PVA"
Sync Shared drive list with Google
Update the Shared drive list to sync the latest changes from Google Workspace for the domain into your CubeBackup instance.
PARAMETERSNo parameters.
RESPONSE
Returns
"OK" if the Shared drive list is successfully updated.Otherwise, returns an error with a detailed
Message attribute in the response body.
POST /api/v1/domains/{{domainName}}/shareddrives/sync
curl -L \ --request POST ".../api/v1/domains/mydomain.com/shareddrives/sync" \ --header "Authorization:255c6...88111"
Batch update Shared drive backup status
Include or exclude a list of Shared drives from the backup for the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
Please be sure to add the Content-Type: application/json header to this HTTP request.
PARAMETERS
EnabledSharedDriveIds optionalAn array of Shared drive IDs to be enabled.
DisabledSharedDriveIds optionalAn array of Shared drive IDs to be disabled.
RESPONSE
Returns
"OK" if the Shared drive backup status is successfully updated.Otherwise, returns an error.
POST /api/v1/domains/{{domainName}}/shareddrives/batch-update-backup-status
curl -L \ --request POST ".../api/v1/domains/mydomain.com/shareddrives/batch-update-backup-status" \ --header "Authorization:255c6...88111" \ --header "Content-Type: application/json" \ --data '{ "EnabledSharedDriveIds":["0ANM...9PVA",...], "DisabledSharedDriveIds":["03VE...AEV1",...] }'
Backup
The Backup object represent the backup status and settings for one domain, and can also help automate backup management by allowing you to trigger or stop a backup process on demand.
Related guide:
GET /api/v1/domains/{{domainName}}/backup/status
POST /api/v1/domains/{{domainName}}/backup/start
POST /api/v1/domains/{{domainName}}/backup/cancel
GET /api/v1/domains/{{domainName}}/backup/tasks
GET /api/v1/domains/{{domainName}}/backup/tasks.csv
GET /api/v1/domains/{{domainName}}/backup/tasks/{{BackupId}}/errors
GET /api/v1/domains/{{domainName}}/backup/tasks/{{BackupId}}/errors.csv
The backup status object
Status enumThe current backup status of the domain.
Possible enum values:
notask: No ongoing backup process.doing: A backup process is currently underway.
RXBandwidth integerThe current download speed in bps of the CubeBackup service from Google's servers.
TXBandwidth integerThe current upload speed in bps of the CubeBackup service to cloud storage. This attribute is not returned for local storage.
NextBackupStartIn integerTime in seconds until the next automatic backup will start. This attribute is only returned if the
Status is notask.
CompletedSharedDriveCount integerThe number of Shared drives which have been successfully completed in the currently running backup job.
CompletedUserCount integerThe number of users which have been successfully completed in the currently running backup job.
SharedDriveCount numberThe number of Shared drives in the active backup list.
UserCount numberThe number of users in the active backup list.
Detail array of ongoing backup status for each user / Shared driveList of objects currently being backed up with up-to-date backup progress details.
Detail.Id stringID of the user or Shared drive currently being backed up.
Detail.DisplayName stringName of the user or Shared drive currently being backed up.
Detail.GmailItem stringSubject of the Gmail message currently being backed up.
Detail.DriveItem stringName of the Drive file currently being backed up.
Detail.CalendarItem stringName of the Calendar event currently being backed up.
Detail.ContactsItem stringName of the contact currently being backed up.
Detail.SitesItem stringName of the Sites file currently being backed up.
{
"Status": "doing",
"RXBandwidth": 1048660,
"TXBandwidth": 883,
"CompletedSharedDriveCount": 6,
"CompletedUserCount": 0,
"UserCount": 0,
"SharedDriveCount": 6,
"Detail": [
{
"Id": "[email protected]",
"DisplayName": "[email protected]",
"GmailItem": "Done",
"DriveItem": "GoogleSpreadsheet",
"CalendarItem": "Done",
"ContactsItem": "-",
"SitesItem": "-"
},
{
"Id": "[email protected]",
"DisplayName": "[email protected]",
"GmailItem": "Email from admin",
"DriveItem": "Movie",
"CalendarItem": "Done",
"ContactsItem": "-",
"SitesItem": "-"
},
]
}
Retrieve the current backup task status
Retrieve the status of the ongoing backup process, or the scheduled time of the next backup for the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns
the backup status object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/backup/status
curl -L ".../api/v1/domains/mydomain.com/backup/status" \ --header "Authorization:255c6...88111"
Start a backup
Trigger a backup event for the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns
"OK" if the backup successfully starts or there is already an ongoing backup process.Otherwise, returns an error with a detailed
Message attribute in the response body.
POST /api/v1/domains/{{domainName}}/backup/start
curl -L \ --request POST ".../api/v1/domains/mydomain.com/backup/start" \ --header "Authorization:255c6...88111"
Stop a backup
Stop the current backup process for the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns
"OK" if the backup stops or there is no ongoing backup process.Otherwise, returns an error with a detailed
Message attribute in the response body.
POST /api/v1/domains/{{domainName}}/backup/cancel
curl -L \ --request POST ".../api/v1/domains/mydomain.com/backup/cancel" \ --header "Authorization:255c6...88111"
The backup event object
Id stringID of the backup event.
StartTime timestampBackup start time. Measured in seconds since the Unix epoch.
Duration numberBackup duration in seconds.
Status enumThe status of the backup event.
Possible enum values:
success: The backup event completed successfully.finishedWithErrors: The backup event finished with errors.failed: The backup event failed with errors.canceled: The backup event was canceled.
UserCount numberThe number of users in the backup.
CompletedUserCount numberThe number of users which were successfully backed up.
SharedDriveCount numberThe number of Shared drives in the backup.
CompletedSharedDriveCount numberThe number of Shared drives which were successfully backed up.
MailCount numberThe number of Gmail messages backed up in the backup event.
MailTotalSize numberThe Gmail backup size in bytes for the backup event.
DriveFileCount numberThe number of Google Drive files backed up in the backup event.
DriveTotalSize numberThe Google Drive backup size in bytes for the backup event.
CalendarEventsCount numberThe number of Google Calendar events backed up in the backup event.
CalendarTotalSize numberThe Google Calendar backup size in bytes for the backup event.
ContactsCount numberThe number of contacts backed up in the backup event.
ContactsTotalSize numberThe Google Contacts backup size in bytes for the backup event.
SitesFileCount numberThe number of Google Sites files backed up in the backup event.
SitesTotalSize numberThe Google Sites backup size in bytes for the backup event.
TotalFileCount numberThe total number of items backed up in the backup event.
TotalFileSize numberThe total backup size in bytes for the backup event.
ErrorCount numberThe number of errors for the backup event.
{
"Id": 43,
"StartTime": 1665735604,
"Duration": 6,
"Status": "success",
"UserCount": 0,
"CompletedUserCount": 0,
"SharedDriveCount": 0,
"CompletedSharedDriveCount": 0,
"DriveFileCount": 0,
"DriveTotalSize": 0,
"MailCount": 0,
"MailTotalSize": 0,
"CalendarEventsCount": 0,
"CalendarTotalSize": 0,
"ContactsCount": 0,
"ContactsTotalSize": 0,
"SitesFileCount": 0,
"SitesTotalSize": 0,
"TotalFileCount": 0,
"TotalFileSize": 0,
"ErrorCount": 0
}
Retrieve the backup history
Retrieve a list of backup histories for the domain.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
The following parameters are optional and should be added as URL queries in this API call.
FailedOnly optional booleanWhether or not to only retrieve failed backup events in the response. Set to
false by default.StartDate optional timestampTime of the earliest backup event to be retrieved. Measured in seconds since the Unix epoch.
EndDate optional timestampTime of the latest backup event to be retrieved. Measured in seconds since the Unix epoch.
Limit optionalThe number of objects to be displayed on a single page in the response. Set to
20 by default.PageNum optionalThe current page number to display out of the total result list. Set to
1 by default.SortBy optionalReturn the backup history sorted by the specific attribute. Set to
StartTime by default.Possible enum values:
StartTime: Sort the backup events by start time.Duration: Sort the backup events by duration.ErrorCount: Sort the backup events by number of errors.MailTotalSize: Sort the backup events by total backup size for Gmail.DriveTotalSize: Sort the backup events by total backup size for Google Drive.CalendarTotalSize: Sort the backup events by total backup size for Google Calendar.ContactsTotalSize: Sort the backup events by total backup size for Google Contacts.SitesTotalSize: Sort the backup events by total backup size for Google Sites.TotalFileSize: Sort the backup events by total backup size.
SortOrder optionalDefine whether the list should be sorted in ascending or descending order. Set to
desc by default. Possible enum values:
asc: Return the backup event list in ascending order.desc: Return the backup event list in descending order.
GET /api/v1/domains/{{domainName}}/backup/tasks
curl -L ".../api/v1/domains/myDomain.com/backup/tasks?FailedOnly=true" \ --header "Authorization:255c6...88111"
Returns a dictionary with a
List property that contains a sorted array of backup event objects, using pages containing up to Limit number of objects, beginning at page PageNum. The total number of matching backup events is returned in the ItemCount property.Otherwise, returns an error with a detailed
Message attribute in the response body.
{
"ItemCount": 43,
"PageNum": 1,
"Limit": 20,
"List": [
{
"Id": 43,
"StartTime": 1665735604,
"Duration": 6,
"Status": "success"
...
},
...
]
}
Retrieve backup history in CSV format
Retrieve a list of backup histories for the domain in CSV format.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
The following parameters are optional and should be added as URL queries in this API call.
FailedOnly optional booleanWhether or not to only retrieve failed backup events in the response. Set to
false by default.StartDate optional timestampTime of the earliest backup event to be retrieved. Measured in seconds since the Unix epoch.
EndDate optional timestampTime of the latest backup event to be retrieved. Measured in seconds since the Unix epoch.
RESPONSE
Returns a CSV file containing a filtered array of
backup event objects.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/backup/tasks.csv
curl -L ".../api/v1/domains/myDomain.com/backup/tasks.csv?FailedOnly=true&StartDate=0&EndDate=16...93" --header "Authorization:255c6...88111"
The backup error object
Id stringThe unique ID of this error.
BackupId stringThe ID of the backup event.
OwnerId stringThe unique ID of a Google Workspace user or Shared drive which is the owner of the item being processed when the error occurred.
OwnerType enumWhether the error occurred when backing up an item for a user or Shared drive.
Possible enum values:
user: Usershareddrive: Shared drive
OwnerName stringThe name of the user or Shared drive.
App enumThe application type for which this backup error occurred.
common: A general service error.drive: Google Drive backup error.gmail: Gmail backup error.contact: Google Contacts backup error.calendar: Google Calendar backup error.site: Google Sites backup error.
HttpCode numberThe HTTP code returned from the CubeBackup server.
Message stringThe error message.
Detail stringA human-readable message providing more details about the error.
CreatedTime timestampTime the error occurred. Measured in seconds since the Unix epoch.
{
"Id": 6,
"BackupId": 6,
"OwnerId": "",
"OwnerType": "",
"OwnerName": "",
"App": "common",
"HttpCode": 0,
"Message": "ListGSuiteDomainsByAdminEmail(...) failed:": \"Not a valid email or user ID.\"\n}",
"Detail": "loadAllDomains() failed",
"CreatedTime": 1665643332
}
Retrieve backup event errors
Retrieve details of a backup event error. Supply the unique {{BackupId}} that was returned from your previous request, and CubeBackup will return the error details for a failed event or finishedWithErrors event.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
The following parameters are optional and should be added as URL queries in this API call.
Limit optionalThe number of objects to be displayed on a single page in the response. Set to
20 by default.PageNum optionalThe current page number to display out of the total result list. Set to
1 by default.GET /api/v1/domains/{{domainName}}/backup/tasks/{{BackupId}}/errors
curl -L ".../api/v1/domains/myDomain.com/backup/tasks/6/errors?Limit=20&PageNum=2" \ --header "Authorization:255c6...88111"
Returns a dictionary with a
List property that contains an array of backup error objects, using pages containing up to Limit number of objects, beginning at page PageNum. The total number of backup errors is returned in the ItemCount property.Otherwise, returns an error with a detailed
Message attribute in the response body.
{
"ItemCount": 3,
"PageNum": 1,
"Limit": 20,
"List": [
{
"Id": 6,
"App": "common",
"HttpCode": 0,
"Message": "ListGSuiteDomainsByAdminEmail([email protected]) failed:Get ... "Not a valid email or user ID.\"\n}",
"Detail": "loadAllDomains() failed",
...
},
...
]
}
Retrieve backup errors in CSV format
Retrieve error details for the backup event in CSV format. Supply the unique {{BackupId}} that was returned from your previous request, and CubeBackup will return the error details for a failed event or finishedWithErrors event.
Please replace the {{domainName}} in the URL with a valid domain name that was previously added to your CubeBackup instance.
No parameters.
RESPONSE
Returns a CSV file containing an array of
backup error objects.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/domains/{{domainName}}/backup/tasks/{{BackupId}}/errors.csv
curl -L ".../api/v1/domains/myDomain.com/backup/tasks/6/errors.csv" \ --header "Authorization:255c6...88111"
System
The System settings object represents the global settings for all domains in your CubeBackup instance. It allows you to retrieve the current system settings, as well as update the backup interval, throttle settings, and backup email report settings.
The audit log object captures detailed information about specific events within the system. It is designed to help administrators monitor and trace actions for auditing and troubleshooting purposes.
Related guide: How to automate backup management and license assignment programmatically using CubeBackup APIs .GET /api/v1/system/settings PATCH /api/v1/system/settings GET /api/v1/system/auditlogs GET /api/v1/system/auditlogs.csv
The System settings object
- Throttling settings
NetworkBandwidthLimitWorkHoursEnabled booleanWhether or not to enable throttling during work hours.
NetworkBandwidthLimitWorkHoursRate integerThrottle CubeBackup to this speed in Mbps during work hours.
NetworkBandwidthLimitNonWorkHoursEnabled booleanWhether or not to enable throttling during non-work hours.
NetworkBandwidthLimitNonWorkHoursRate integerThrottle CubeBackup to this speed in Mbps during non-work hours.
NetworkBandwidthLimitWorkHoursBegin integerStart time for work hours in 24-hour format.
NetworkBandwidthLimitWorkHoursEnd integerEnd time for work hours in 24-hour format.
NetworkBandwidthLimitDay array of integer valuesDays of the week when work hour throttling will be applied.(Sunday = 0, Monday = 1)
- Email reports settings
SummaryEmailNotificationFrequency enumFrequency of CubeBackup email reports.
Possible enum values:
0: Disable email reports1: Daily email reports2: Weekly email reports3: Monthly email reports
SummaryEmailReceiver stringA list of email addresses to receive CubeBackup email reports. Separate multiple email addresses with commas.
SmtpEnabled booleanWhether or not to enable the custom SMTP settings.
SmtpHost stringCustom SMTP host address.
SmtpPort integerCustom SMTP host port number.
SmtpFrom stringEmail address listed as sender for the custom SMTP service.
SmtpUsername stringUsername for the custom SMTP service.
SmtpPassword stringPassword for the custom SMTP service.
SmtpSkipVerifyTLS booleanWhether or not to skip TLS verification for the SMTP server. Set to
false by default.- Backup interval settings
BackupInterval integerInterval between scheduled backups in minutes. Set to
60 by default.{
"NetworkBandwidthLimitWorkHoursEnabled": true,
"NetworkBandwidthLimitWorkHoursRate": 50,
"NetworkBandwidthLimitNonWorkHoursEnabled": false,
"NetworkBandwidthLimitNonWorkHoursRate": 300,
"NetworkBandwidthLimitWorkHoursBegin": 9,
"NetworkBandwidthLimitWorkHoursEnd": 17,
"NetworkBandwidthLimitDays": [1,2,3,4,5],
"SummaryEmailNotificationFrequency": 2,
"SummaryEmailReceiver": "[email protected]",
"SmtpEnabled": true,
"SmtpHost": "smtp-relay.gmail.com",
"SmtpPort": 587,
"SmtpFrom": "[email protected]",
"SmtpUsername": "[email protected]",
"SmtpPassword": "",
"SmtpSkipVerifyTLS": false,
"BackupInterval": 60
}
Retrieve the current system settings
Retrieve the CubeBackup system settings.
PARAMETERSNo parameters.
RESPONSE
Returns
the System settings object.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/system/settings
curl -L ".../api/v1/system/settings" \ --header "Authorization:255c6...88111"
Update the system settings
Update the CubeBackup system settings.
Please be sure to add the Content-Type: application/json header to this HTTP request.
PARAMETERS
The System settings object optionalOptional fields in the System settings object.
RESPONSE
Returns
the System settings object if the system settings have been successfully updated.Otherwise, returns an error with a detailed
Message attribute in the response body.
curl -L \ --request PATCH ".../api/v1/system/settings" \ --header "Authorization:255c6...88111" \ --header "Content-Type: application/json"\ --data '{ "SummaryEmailNotificationFrequency": 2, "SummaryEmailReceiver": "[email protected]", "BackupInterval": 120 }'
The audit log object
Id numberID of the audit log entry`.
CreatedTime timestampTimestamp indicating when the event was created. Measured in seconds since the Unix epoch.
Desc stringA description string for the event.
Domain stringDomain name where the event occurred. The field is empty for global events.
Op stringEmail address of the operator responsible for the event.
NewValue stringThe new value after a modification, if applicable.
OldValue stringThe previous value before the modification, if applicable.
Event enumType of event that occurred in the audit log.
Possible enum values:
1: Login.2: Change password.3: Manual backup.4: Stop backup.5: Restore.6: Abort restore.7: Export.8: Abort export.9: Download.10: Edit domain settings.11: Edit system settings.12: Create account.13: Edit account.14: Delete account.15: Upgrade.16: Migrate data.17: Abort migration.18: Edit user settings.19: Edit organization settings.20: Edit shared drive settings.21: Edit storage configuration.22: Add domain.
{
"Id" = 1688,
"CreatedTime" = 1713171593,
"Desc" = "Login from 192.***.***.182.",
"Domain" = "",
"Op" = "c:[email protected]"
"NewValue" = "",
"OldValue" = "",
"Event" = 1,
}
Retrieve the audit logs
Retrieve a list of audit logs for the CubeBackup instance.
PARAMETERSThe following parameters are optional and should be added as URL queries in this API call.
DomainName optional stringDomain name where the event occurred.
Operator optional stringEmail address of the operator responsible for the event.
EventType optional numberType of event that occurred.
StartDate optional timestampTime of the earliest event to be retrieved. Measured in seconds since the Unix epoch.
EndDate optional timestampTime of the latest event to be retrieved. Measured in seconds since the Unix epoch.
Limit optionalThe number of objects to be displayed on a single page in the response. Set to
20 by default.PageNum optionalThe current page number to display out of the total result list. Set to
1 by default.SortBy optionalReturn the audit logs sorted by the specific attribute. Set to
CreatedTime by default.Possible enum values:
CreatedTime: Sort the events by created time.
SortOrder optionalDefine whether the list should be sorted in ascending or descending order. Set to
desc by default. Possible enum values:
asc: Return the audit logs in ascending order.desc: Return the audit logs in descending order.
GET /api/v1/system/auditlogs
curl -L ".../api/v1/auditlogs/tasks?StartDate=0&EndDate=17..." \ --header "Authorization:255c6...88111"
Returns a dictionary with a
List property that contains a sorted array of audit log objects, using pages containing up to Limit number of objects, beginning at page PageNum. The total number of matching audit logs is returned in the ItemCount property.Otherwise, returns an error with a detailed
Message attribute in the response body.
{
"ItemCount": 43,
"PageNum": 1,
"Limit": 20,
"List": [
{
"Id": 43,
"CreatedTime": 1665735604,
"Desc": "Login from 192.***.***.182.",
"Domain": ""
...
},
...
]
}
Retrieve audit logs in CSV format
Retrieve a list of audit logs in CSV format.
PARAMETERSThe following parameters are optional and should be added as URL queries in this API call.
DomainName optional stringDomain name where the event occurred.
Operator optional stringEmail address of the operator responsible for the event.
EventType optional numberType of event that occurred.
StartDate optional timestampTime of the earliest event to be retrieved. Measured in seconds since the Unix epoch.
EndDate optional timestampTime of the latest event to be retrieved. Measured in seconds since the Unix epoch.
SortBy optionalReturn the audit logs sorted by the specific attribute. Set to
CreatedTime by default.Possible enum values:
CreatedTime: Sort the events by created time.
SortOrder optionalDefine whether the list should be sorted in ascending or descending order. Set to
desc by default. Possible enum values:
asc: Return the audit logs in ascending order.desc: Return the audit logs in descending order.
RESPONSE
Returns a CSV file containing a filtered array of
audit log objects.Otherwise, returns an error with a detailed
Message attribute in the response body.
GET /api/v1/system/auditlogs.csv
curl -L ".../api/v1/system/auditlogs.csv?StartDate=0&EndDate=16...93" --header "Authorization:255c6...88111"
Admins
CubeBackup administrators can be created with different roles and granular access levels to manage the backups and other settings of CubeBackup. You can create, manage and delete CubeBackup administrators programmatically using the API.
Related guide: How to complete the initial configuration and add new domains to back up using CubeBackup APIs .
GET /api/v1/system/admins
POST /api/v1/system/admins
PATCH /api/v1/system/admins/{{adminId}}
DELETE /api/v1/system/admins/{{adminId}}
The CubeBackup admin object
Id integerID of the CubeBackup admin
Name stringName of the CubeBackup admin
Email stringEmail address of the CubeBackup admin
Role enumA CubeBackup admin is granted granular level permissions according to the the assigned CubeBackup Role .
Possible enum values:
cubeSuperAdmin: System admincubeDomainAdmin: Domain admincubeDomainOperator: Domain operator
Comment stringAn arbitrary description string for the CubeBackup administrator.
Domains stringA list of domains that the admin can access. Multiple domains should be separated by commas.
Status enumThe current status of the CubeBackup admin.
Possible enum values:
0: Normal1: Disabled
{
"Id": 10,
"Name": "Cube Admin",
"Email": "[email protected]",
"Role": "cubeDomainAdmin",
"Comment": "My CubeBackup domain admin",
"Domains": "domain.com, subdomain.com",
"Status": 0
}
List all CubeBackup admins
Retrieve a list of CubeBackup administrators.
PARAMETERSThe following parameters are optional and should be added as URL queries in this API call.
Limit optionalThe number of admin objects to be displayed on a single page in the response. Set to
20 by default.PageNum optionalThe current page number to display out of the total result list. Set to
1 by default.GET /api/v1/system/admins
curl -L ".../api/v1/system/admins?Limit=20&PageNum=1" \ --header "Authorization:255c6...88111"
Returns a dictionary with a
List property that contains an array of CubeBackup admin objects, using pages containing up to Limit number of objects, beginning at page PageNum. The total number of CubeBackup admins is returned in the ItemCount property.Otherwise, returns an error with a detailed
Message attribute in the response body.
{
"ItemCount": 6,
"PageNum": 1,
"Limit": 10,
"List": [
{
"Id": 6,
"Name": "My domain operator",
"Email": "[email protected]",
"Role": "cubeDomainOperator",
"Comment": "test operator",
"Domains": "testdomain.com",
"Status": 0
},
...
]
}
Create a CubeBackup administrator
Create an administrator for the CubeBackup web console.
Please be sure to add the Content-Type: application/json header to this HTTP request.
Name requiredName of the new CubeBackup admin.
Email requiredEmail address of the new CubeBackup admin.
Password requiredPassword for the new CubeBackup admin.
Role requiredA CubeBackup admin is granted granular level permissions according to the assigned CubeBackup Role .
Possible enum values:
cubeSuperAdmin: CubeBackup System admin.cubeDomainAdmin: CubeBackup Domain admin.cubeDomainOperator: CubeBackup Domain operator.
Comment optionalAn arbitrary description string for the CubeBackup administrator.
Domains optionalA list of domains that the admin can access. Multiple domains are separated by commas. This field is required for Domain admin and Domain operator.
RESPONSE
Returns
the CubeBackup admin object if the admin has been successfully created.Otherwise, returns an error with a detailed
Message attribute in the response body.
POST /api/v1/system/admins
curl -L \ --request POST ".../api/v1/system/admins" \ --header "Authorization:255c6...88111" \ --data Name="Sample Admin" \ --data Email="[email protected]" \ --data Password="myPassword" \ --data Role="cubeDomainAdmin" \ --data Comment="admin comment" \ --data Domains="mydomain.com, mydomain2.com"
Update an administrator
Update the settings for CubeBackup administrator. Supply the unique {{adminId}} that was returned from your previous request, and set the updated values of the parameters passed.
Name optionalUpdated name of the CubeBackup admin.
Email optionalUpdated email address of the CubeBackup admin.
Password optionalUpdated password for the CubeBackup admin.
Status optionalThe possible status value is either
0 or 1. Possible enum values:
0: Normal.1: Disabled.
Role optionalA CubeBackup admin is granted granular level permissions according to the assigned CubeBackup Role .
Possible enum values:
cubeSuperAdmin: CubeBackup System admin.cubeDomainAdmin: CubeBackup Domain admin.cubeDomainOperator: CubeBackup Domain operator.
Comment optionalAn arbitrary description string for the CubeBackup administrator.
Domains optionalA list of domains that the admin can access. Multiple domains are separated by commas.
RESPONSE
Returns
"OK" if the CubeBackup admin has been successfully updated.Otherwise, returns an error with a detailed
Message attribute in the response body.
PATCH /api/v1/system/admins/{{adminId}}
curl -L \ --request PATCH ".../api/v1/system/admins" \ --header "Authorization:255c6...88111" \ --data Password="myPassword" \ --data Status=1 \ --data Domains="mydomain.com, newDomain.com"
Delete an administrator
You can delete a CubeBackup admin using the API. Supply the unique {{adminId}} that was returned from your previous request, and CubeBackup will delete the admin and revoke the permissions of corresponding API clients.
Please note that the deletion is PERMANENT and the administrator cannot be re-enabled. To temporarily disable a CubeBackup admin, please use the Update an administrator API.PARAMETERS
No parameters.
RESPONSE
Returns
"OK" if the CubeBackup admin has been successfully deleted.Otherwise, returns an error with a detailed
Message attribute in the response body.
DELETE /api/v1/system/admins/{{adminId}}
curl -L \ --request DELETE ".../api/v1/system/admins/5" \ --header "Authorization:255c6...88111"
Keep track of API requests
All POST/PATCH requests after the initial setup are continually recorded in CubeBackup's immutable audit log, along with the API client name, the time the action occurred, and a detailed description of the affected object. You can view the audit log by logging in to the CubeBackup for Google Workspace web console as a system admin, and navigating to the SETTINGS > Audit Log page. You may search by the specific API client name or operation type, and even export the results as a CSV file.
USE CASES
The CubeBackup for Google Workspace APIs can be used by administrators to initiate, manage and monitor their backups programmatically. The following articles may provide insight on how to integrate CubeBackup with other systems and combine multiple requests to handle individual use cases: