Skip to main content

Update Automatic Backup Config

This API updates the automatic backup configuration, including its scope, destination, schedule, and retention settings.

Endpoint Details

URL/v1/backup/config
MethodPUT
AuthorizationBearer Token

Request Headers

HeaderTypeDescription
Content-TypeStringMust be application/json

Request Body

Use the following format to make a request:

JSON Request
{
"scopes": [
1,
2,
3,
4
],
"destination_type": 1,
"local_path": "/tmp/backups/",
"s3_config": {
"bucket_name": "",
"region": "",
"access_key_id": "",
"secret_access_key": "",
"path_prefix": ""
},
"schedule": {
"schedule_type": 2,
"time": "10:00",
"weekly_days": [
1,
2,
3
],
"monthly_dates": [],
"include_last_day_of_month": false
},
"retention_days": 30
}

Body Parameters

ParameterTypeDescription
scopesArrayList of scope codes to include in the automatic backup
destination_typeIntegerType of destination where the backup file is stored
local_pathStringLocal path where the backup file is stored, used for local disk destinations
s3_configObjectS3 destination configuration, used for S3 destinations
s3_config.bucket_nameStringName of the S3 bucket where the backup file is stored
s3_config.regionStringRegion of the S3 bucket
s3_config.access_key_idStringAccess key ID used to authenticate to S3
s3_config.secret_access_keyStringSecret access key used to authenticate to S3
s3_config.path_prefixStringPath prefix applied to the backup file within the bucket
scheduleObjectSchedule configuration for the automatic backup
schedule.schedule_typeIntegerType of schedule used for the automatic backup
schedule.timeStringTime of day the backup runs (HH:MM)
schedule.weekly_daysArrayDays of the week the backup runs, used when schedule_type is weekly
schedule.monthly_datesArrayDates of the month the backup runs, used when schedule_type is monthly
schedule.include_last_day_of_monthBooleanIndicates whether the backup also runs on the last day of the month, used for monthly schedules
retention_daysIntegerNumber of days backups are retained before removal

Response

Here is an example response when the data is successfully updated:

Response
{
"data": {
"id": "49b51474-8bfb-4762-937c-144ccadb72d6",
"scopes": [
1,
2,
3,
4
],
"destination_type": 1,
"destination_path": "/tmp/backups/",
"schedule": {
"schedule_type": 2,
"time": "10:00",
"weekly_days": [
1,
2,
3
]
},
"retention_days": 30,
"is_enabled": true,
"created_at": 1779332170,
"updated_at": 1784780812,
"last_run_at": 1784779200,
"next_run_at": 1784862000,
"created_by": "0a937c60-0ed4-4d06-870a-2e284b54287d",
"created_by_name": "Admin Aplikasi",
"encryption_key": "Q5AjARpdOecvFP6CH4HCAlks+OeB7oQr1mpRLDN6YUs=",
"s3_config": {}
}
}

Field Descriptions

FieldTypeDescription
idUUIDUnique identifier of the backup configuration
scopesArrayList of scope codes included in the backup
destination_typeIntegerType of backup destination
destination_pathStringPath where the backup files are stored
scheduleObjectSchedule configuration for the automatic backup
schedule.schedule_typeIntegerType of schedule used for the automatic backup
schedule.timeStringTime of day the backup runs (HH:MM)
schedule.weekly_daysArrayDays of the week the backup runs, used when schedule_type is weekly
schedule.monthly_datesArrayDates of the month the backup runs, used when schedule_type is monthly
retention_daysIntegerNumber of days backups are retained before removal
is_enabledBooleanIndicates whether the automatic backup is enabled
created_atIntegerCreation timestamp in Unix format
updated_atIntegerLast update timestamp in Unix format
last_run_atIntegerTimestamp of the last backup run in Unix format
next_run_atIntegerTimestamp of the next scheduled backup run in Unix format
created_byUUIDIdentifier of the user who created the configuration
created_by_nameStringDisplay name of the user who created the configuration
encryption_keyStringEncryption key used to encrypt the backup files
s3_configObjectS3 destination configuration, used when the destination is S3

info
  • A valid Bearer Token is required to access this endpoint.
  • The scopes array uses the following codes:
    • 1 = System Configuration
    • 2 = Keys
    • 3 = Audit Log
    • 4 = System Log
  • The destination_type determines where the backup file is stored:
    • 1 = Local disk — stores the backup file directly on the server's local storage. Provide the local_path value.
    • 3 = S3 — stores the backup in an Amazon S3-compatible object storage. Provide the s3_config object.
  • The schedule_type determines how often the automatic backup runs:
    • 1 = Daily
    • 2 = Weekly — the weekly_days array specifies which days of the week the backup runs
    • 3 = Monthly — the monthly_dates array specifies which dates of the month the backup runs
  • The weekly_days array uses the following codes:
    • 0 = Sunday
    • 1 = Monday
    • 2 = Tuesday
    • 3 = Wednesday
    • 4 = Thursday
    • 5 = Friday
    • 6 = Saturday
  • When schedule.include_last_day_of_month is set to true, the backup also runs on the last day of the month for monthly schedules.
  • Unix timestamp fields can be converted to a human-readable date and time format as needed.