# Backups ## List `gpu_droplets.backups.list(intdroplet_id, BackupListParams**kwargs) -> BackupListResponse` **get** `/v2/droplets/{droplet_id}/backups` To retrieve any backups associated with a Droplet, send a GET request to `/v2/droplets/$DROPLET_ID/backups`. You will get back a JSON object that has a `backups` key. This will be set to an array of backup objects, each of which contain the standard Droplet backup attributes. ### Parameters - **droplet\_id:** `int` - **page:** `int` Which 'page' of paginated results to return. - **per\_page:** `int` Number of items returned per page ### Returns - `class BackupListResponse` - **meta:** `MetaProperties` Information about the response itself. - **backups:** `Optional[List[Backup]]` - **id:** `int` The unique identifier for the snapshot or backup. - **created\_at:** `datetime` A time value given in ISO8601 combined date and time format that represents when the snapshot was created. - **min\_disk\_size:** `int` The minimum size in GB required for a volume or Droplet to use this snapshot. - **name:** `str` A human-readable name for the snapshot. - **regions:** `List[str]` An array of the regions that the snapshot is available in. The regions are represented by their identifying slug values. - **size\_gigabytes:** `float` The billable size of the snapshot in gigabytes. - **type:** `Literal["snapshot", "backup"]` Describes the kind of image. It may be one of `snapshot` or `backup`. This specifies whether an image is a user-generated Droplet snapshot or automatically created Droplet backup. - `"snapshot"` - `"backup"` - **links:** `Optional[PageLinks]` ### Example ```python from gradient import Gradient client = Gradient() backups = client.gpu_droplets.backups.list( droplet_id=3164444, ) print(backups.meta) ``` ## List Policies `gpu_droplets.backups.list_policies(BackupListPoliciesParams**kwargs) -> BackupListPoliciesResponse` **get** `/v2/droplets/backups/policies` To list information about the backup policies for all Droplets in the account, send a GET request to `/v2/droplets/backups/policies`. ### Parameters - **page:** `int` Which 'page' of paginated results to return. - **per\_page:** `int` Number of items returned per page ### Returns - `class BackupListPoliciesResponse` - **meta:** `MetaProperties` Information about the response itself. - **links:** `Optional[PageLinks]` - **policies:** `Optional[Dict[str, Policies]]` A map where the keys are the Droplet IDs and the values are objects containing the backup policy information for each Droplet. - **backup\_enabled:** `Optional[bool]` A boolean value indicating whether backups are enabled for the Droplet. - **backup\_policy:** `Optional[DropletBackupPolicy]` An object specifying the backup policy for the Droplet. - **droplet\_id:** `Optional[int]` The unique identifier for the Droplet. - **next\_backup\_window:** `Optional[DropletNextBackupWindow]` An object containing keys with the start and end times of the window during which the backup will occur. ### Example ```python from gradient import Gradient client = Gradient() response = client.gpu_droplets.backups.list_policies() print(response.meta) ``` ## List Supported Policies `gpu_droplets.backups.list_supported_policies() -> BackupListSupportedPoliciesResponse` **get** `/v2/droplets/backups/supported_policies` To retrieve a list of all supported Droplet backup policies, send a GET request to `/v2/droplets/backups/supported_policies`. ### Returns - `class BackupListSupportedPoliciesResponse` - **supported\_policies:** `Optional[List[SupportedPolicy]]` - **name:** `Optional[str]` The name of the Droplet backup plan. - **possible\_days:** `Optional[List[str]]` The day of the week the backup will occur. - **possible\_window\_starts:** `Optional[List[int]]` An array of integers representing the hours of the day that a backup can start. - **retention\_period\_days:** `Optional[int]` The number of days that a backup will be kept. - **window\_length\_hours:** `Optional[int]` The number of hours that a backup window is open. ### Example ```python from gradient import Gradient client = Gradient() response = client.gpu_droplets.backups.list_supported_policies() print(response.supported_policies) ``` ## Retrieve Policy `gpu_droplets.backups.retrieve_policy(intdroplet_id) -> BackupRetrievePolicyResponse` **get** `/v2/droplets/{droplet_id}/backups/policy` To show information about an individual Droplet's backup policy, send a GET request to `/v2/droplets/$DROPLET_ID/backups/policy`. ### Parameters - **droplet\_id:** `int` ### Returns - `class BackupRetrievePolicyResponse` - **policy:** `Optional[Policy]` - **backup\_enabled:** `Optional[bool]` A boolean value indicating whether backups are enabled for the Droplet. - **backup\_policy:** `Optional[DropletBackupPolicy]` An object specifying the backup policy for the Droplet. - **droplet\_id:** `Optional[int]` The unique identifier for the Droplet. - **next\_backup\_window:** `Optional[DropletNextBackupWindow]` An object containing keys with the start and end times of the window during which the backup will occur. ### Example ```python from gradient import Gradient client = Gradient() response = client.gpu_droplets.backups.retrieve_policy( 1, ) print(response.policy) ```