# Set database storage backup schedule

Source: https://next.coolify.io/docs/api/endpoints/databases/set-database-storage-backup-schedule

## PUT /databases/{uuid}/storages/{storage_uuid}/backups

Set database storage backup schedule

Create or replace the backup schedule for a database persistent volume or directory storage. A schedule with stop_during_backup needs a token with the deploy permission.

**Authentication:** Bearer token (`bearerAuth`)

### Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| uuid | path | yes | string | UUID of the database. |
| storage_uuid | path | yes | string | UUID of the persistent volume or directory storage. |

### Request body

`application/json`, required.

Schema `VolumeBackupScheduleRequest`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| frequency | string | yes |  |
| enabled | boolean | no |  |
| save_s3 | boolean | no |  |
| disable_local_backup | boolean | no |  |
| stop_during_backup | boolean | no | Stop the resource containers during the backup. Needs a token with the deploy permission. |
| s3_storage_uuid | string or null | no | Primary S3 storage UUID. Sent without s3_storage_uuids, it selects this storage as the only destination. |
| s3_storage_uuids | array of string | no | UUIDs of every S3 storage the backup is uploaded to. When s3_storage_uuid is also sent, it must be in this list and becomes the primary destination; otherwise the first entry is the primary destination. save_s3 requires at least one destination. |
| retention_amount_locally | integer | no |  |
| retention_days_locally | integer | no |  |
| retention_max_storage_locally | number (float) | no |  |
| retention_amount_s3 | integer | no |  |
| retention_days_s3 | integer | no |  |
| retention_max_storage_s3 | number (float) | no |  |
| timeout | integer | no |  |
| missing_backup_notification_days | integer | no | Alert after this many days without an execution; 0 disables alerts |

### Responses

#### 200

Backup schedule replaced.

`application/json`: VolumeBackupScheduleResponse

Schema `VolumeBackupScheduleResponse`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| uuid | string | yes |  |
| message | string | yes |  |
| storage_uuid | string | yes |  |
| storage_type | string enum "persistent", "directory" | yes |  |
| frequency | string | yes |  |
| enabled | boolean | yes |  |
| save_s3 | boolean | yes |  |
| disable_local_backup | boolean | yes |  |
| stop_during_backup | boolean | yes |  |
| s3_storage_uuid | string or null | no | Primary S3 destination. |
| s3_storage_uuids | array of string | no | Every S3 destination, primary first. |
| retention_amount_locally | integer | yes |  |
| retention_days_locally | integer | yes |  |
| retention_max_storage_locally | number (float) | yes |  |
| retention_amount_s3 | integer | yes |  |
| retention_days_s3 | integer | yes |  |
| retention_max_storage_s3 | number (float) | yes |  |
| timeout | integer | yes |  |
| missing_backup_notification_days | integer | yes |  |

#### 201

Backup schedule created.

`application/json`: VolumeBackupScheduleResponse

Schema `VolumeBackupScheduleResponse` (see above).

#### 400

Invalid token.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |

#### 401

Unauthenticated.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |

#### 403

Forbidden, or the token needs the deploy permission for stop_during_backup.

#### 404

Resource not found.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |

#### 422

Validation error.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |
| errors | object | no |  |
