---
title: "Create a backup policy"
method: POST
path: "/organizations/{organization}/databases/{database}/backup-policies"
tags: ["BackupPolicies"]
---

# Create a backup policy

`POST /organizations/{organization}/databases/{database}/backup-policies`

### Authorization
A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**
 `write_backups`

**OAuth Scopes**

 | Resource | Scopes |
| :------- | :---------- |
| Organization | `write_backups` |
| Database | `write_backups` |

## Path parameters

- `organization` string, required
- `database` string, required

## Request body

- object
  - `name` string — The name of the backup policy
  - `target` 'production' | 'development' — Whether the policy is for production or development branches
  - `retention_value` integer — A number value for the retention period of the backup policy
  - `retention_unit` 'hour' | 'day' | 'week' | 'month' | 'year' — The unit for the retention period of the backup policy
  - `frequency_value` integer — A number value for the frequency of the backup policy
  - `frequency_unit` 'hour' | 'day' | 'week' | 'month' — The unit for the frequency of the backup policy
  - `schedule_time` string — The time of day that the backup is scheduled, in HH:MM format
  - `schedule_day` integer — Day of the week that the backup is scheduled. 0 is Sunday, 6 is Saturday
  - `schedule_week` integer — Week of the month that the backup is scheduled. 0 is the first week, 3 is the fourth week

## Response `201`

Returns the created backup policy

- object
  - `id` string, required — The ID of the backup policy
  - `display_name` string, required — The display name of the backup policy
  - `name` string, required — The name of the backup policy
  - `target` 'production' | 'development', required — Whether the policy is for production or development branches
  - `retention_value` integer, required — A number value for the retention period of the backup policy
  - `retention_unit` string, required — The unit for the retention period of the backup policy
  - `frequency_value` integer, required — A number value for the frequency of the backup policy
  - `frequency_unit` string, required — The unit for the frequency of the backup policy
  - `schedule_time` string, required — The time of day that the backup is scheduled, in HH:MM format
  - `schedule_day` integer, nullable, required — Day of the week that the backup is scheduled. 0 is Sunday, 6 is Saturday
  - `schedule_week` integer, nullable, required — Week of the month that the backup is scheduled. 0 is the first week, 3 is the fourth week
  - `created_at` string, required — When the backup policy was created
  - `updated_at` string, required — When the backup policy was last updated
  - `last_ran_at` string, nullable, required — When the backup was last run
  - `next_run_at` string, nullable, required — When the backup will next run
  - `required` boolean, required — Whether the policy is a required system backup

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `500` — Internal Server Error

## Changes

- **2026-06-01** `72506953f367` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/planetscale/apis/planetscale-api/changes/organizations/:organization/databases/:database/backup-policies/post.md)

---

[API](https://skmtc.dev/planetscale/apis/planetscale-api.md) · [All operations](https://skmtc.dev/planetscale/apis/planetscale-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/planetscale/planetscale-api/revisions/6d28c038c4fd/schema)
