---
title: "Update auto-apply for deploy request"
method: PUT
path: "/organizations/{organization}/databases/{database}/deploy-requests/{number}/auto-apply"
tags: ["Deploy requests"]
---

# Update auto-apply for deploy request

`PUT /organizations/{organization}/databases/{database}/deploy-requests/{number}/auto-apply`

Enables or disabled the auto-apply setting for a deploy request
### 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**
 `read_deploy_request`, `create_deploy_request`

**OAuth Scopes**

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

## Path parameters

- `organization` string, required
- `database` string, required
- `number` integer, required

## Request body

- object
  - `enable` boolean — Whether or not to enable auto-apply for the deploy request

## Response `200`

Returns the deploy request whose auto-apply setting was updated

- object
  - `id` string, required — The ID of the deploy request
  - `number` integer, required — The number of the deploy request
  - `actor` object, required
    - `id` string, required — The ID of the actor
    - `display_name` string, required — The name of the actor
    - `avatar_url` string, required — The URL of the actor's avatar
  - `closed_by` object, nullable
    - `id` string, required — The ID of the actor
    - `display_name` string, required — The name of the actor
    - `avatar_url` string, required — The URL of the actor's avatar
  - `branch` string, required — The name of the branch the deploy request was created from
  - `branch_id` string, required — The ID of the branch the deploy request was created from
  - `branch_deleted` boolean, required — Whether or not the deploy request branch was deleted
  - `branch_deleted_by` object, nullable
    - `id` string, required — The ID of the actor
    - `display_name` string, required — The name of the actor
    - `avatar_url` string, required — The URL of the actor's avatar
  - `branch_deleted_at` string, nullable, required — When the deploy request branch was deleted
  - `into_branch` string, required — The name of the branch the deploy request will be merged into
  - `into_branch_sharded` boolean, required — Whether or not the branch the deploy request will be merged into is sharded
  - `into_branch_shard_count` integer, required — The number of shards the branch the deploy request will be merged into has
  - `into_branch_keyspace_count` integer, required — The number of keyspaces the branch the deploy request will be merged into has
  - `approved` boolean, required — Whether or not the deploy request is approved
  - `state` 'open' | 'closed', required — Whether the deploy request is open or closed
  - `deployment_state` 'pending' | 'ready' | 'no_changes' | 'queued' | 'submitting' | 'in_progress' | 'pending_cutover' | 'in_progress_vschema' | 'in_progress_cancel' | 'in_progress_cutover' | 'complete' | 'complete_cancel' | 'complete_error' | 'complete_pending_revert' | 'in_progress_revert' | 'in_progress_revert_vschema' | 'complete_revert' | 'complete_revert_error' | 'cancelled' | 'error', required — The deployment state of the deploy request
  - `deployment` object, required
    - `id` string, required — The ID of the deployment
    - `auto_cutover` boolean, required — Whether or not to automatically cutover once deployment is finished
    - `auto_delete_branch` boolean, required — Whether or not to automatically delete the head branch once deployment is finished
    - `created_at` string, required — When the deployment was created
    - `cutover_at` string, nullable, required — When the cutover for the deployment was initiated
    - `cutover_expiring` boolean, required — Whether or not the deployment cutover will expire soon
    - `deploy_check_errors` string, nullable — Deploy check errors for the deployment.
    - `finished_at` string, nullable, required — When the deployment was finished
    - `force_cutover_requested_at` string, nullable, required — When force cutover was triggered for the deployment
    - `queued_at` string, nullable, required — When the deployment was queued
    - `ready_to_cutover_at` string, nullable, required — When the deployment was ready for cutover
    - `started_at` string, nullable, required — When the deployment was started
    - `state` 'pending' | 'ready' | 'no_changes' | 'queued' | 'submitting' | 'in_progress' | 'pending_cutover' | 'in_progress_vschema' | 'in_progress_cancel' | 'in_progress_cutover' | 'complete' | 'complete_cancel' | 'complete_error' | 'complete_pending_revert' | 'in_progress_revert' | 'in_progress_revert_vschema' | 'complete_revert' | 'complete_revert_error' | 'cancelled' | 'error', required — The state the deployment is in
    - `submitted_at` string, nullable, required — When the deployment was submitted
    - `updated_at` string, required — When the deployment was last updated
    - `into_branch` string, required — The name of the base branch the deployment will be merged into
    - `deploy_request_number` integer, required — The number of the deploy request associated with this deployment
    - `deployable` boolean, required — Whether the deployment is deployable
    - `preceding_deployments` object[], required — The deployments ahead of this one in the queue
    - `deploy_operations` object[], required
      - `id` string, required — The ID for the deploy operation
      - `state` 'pending' | 'queued' | 'in_progress' | 'complete' | 'cancelled' | 'error', required — The state of the deploy operation
      - `keyspace_name` string, required — The keyspace modified by the deploy operation
      - `table_name` string, required — The name of the table modifed by the deploy operation
      - `operation_name` string, required — The operation name of the deploy operation
      - `eta_seconds` number, nullable, required — The estimated seconds until completion for the deploy operation
      - `progress_percentage` number, nullable, required — The percent completion for the deploy operation
      - `deploy_error_docs_url` string, nullable, required — A link to documentation explaining the deploy error, if present
      - `ddl_statement` string, required — The DDL statement for the deploy operation
      - `syntax_highlighted_ddl` string, required — A syntax-highlighted DDL statement for the deploy operation
      - `created_at` string, required — When the deploy operation was created
      - `updated_at` string, required — When the deploy operation was last updated
      - `throttled_at` string, nullable, required — When the deploy operation was last throttled
      - `can_drop_data` boolean, required — Whether or not the deploy operation is capable of dropping data
      - `table_locked` boolean, required — Whether or not the table modified by the deploy operation is currently locked
      - `table_recently_used` boolean, required — Whether or not the table modified by the deploy operation was recently used
      - `table_recently_used_at` string, nullable, required — When the table modified by the deploy operation was last used
      - `removed_foreign_key_names` string[], nullable, required — Names of foreign keys removed by this operation
      - `deploy_errors` string, nullable, required — Deploy errors for the deploy operation
    - `deploy_operation_summaries` object[], required
      - `id` string, required — The ID for the deploy operation summary
      - `created_at` string, required — When the deploy operation summary was created
      - `deploy_errors` string, required — Deploy errors for the deploy operation summary
      - `ddl_statement` string, required — The DDL statement for the deploy operation summary
      - `eta_seconds` integer, required — The estimated seconds until completion for the deploy operation summary
      - `keyspace_name` string, required — The keyspace modified by the deploy operation summary
      - `operation_name` string, required — The operation name of the deploy operation summary
      - `progress_percentage` number, required — The percent completion for the deploy operation summary
      - `state` 'pending' | 'in_progress' | 'complete' | 'cancelled' | 'error', required — The state of the deploy operation summary
      - `syntax_highlighted_ddl` string, required — A syntax-highlighted DDL statement for the deploy operation summary
      - `table_name` string, required — The name of the table modifed by the deploy operation summary
      - `table_recently_used_at` string, nullable, required — When the table modified by the deploy operation summary was last used
      - `throttled_at` string, nullable, required — When the deploy operation summary was last throttled
      - `removed_foreign_key_names` string[], required — Names of foreign keys removed by this operation summary
      - `shard_count` integer, required — The number of shards in the keyspace modified by the deploy operation summary
      - `shard_names` string[], required — Names of shards in the keyspace modified by the deploy operation summary
      - `can_drop_data` boolean, required — Whether or not the deploy operation summary is capable of dropping data
      - `table_recently_used` boolean, required — Whether or not the table modified by the deploy operation summary was recently used
      - `sharded` boolean, required — Whether or not the keyspace modified by the deploy operation summary is sharded
      - `operations` object[], required
        - `id` string, required — The ID for the deploy operation
        - `shard` string, required — The shard the deploy operation is being performed on
        - `state` 'pending' | 'queued' | 'in_progress' | 'complete' | 'cancelled' | 'error', required — The state of the deploy operation
        - `progress_percentage` number, required — The percent completion for the deploy operation
        - `eta_seconds` integer, required — The estimated seconds until completion for the deploy operation
    - `lint_errors` object[], required — Schema lint errors preventing the deployment from completing
    - `sequential_diff_dependencies` object[], required — The schema dependencies that must be satisfied
    - `lookup_vindex_operations` object[], required — Lookup Vitess index operations
    - `throttler_configurations` object, nullable — Deployment throttling configurations.
    - `deployment_revert_request` object, nullable, required — The request to revert the schema operations in this deployment
    - `actor` object, nullable
      - `id` string, required — The ID of the actor
      - `display_name` string, required — The name of the actor
      - `avatar_url` string, required — The URL of the actor's avatar
    - `cutover_actor` object, nullable
      - `id` string, required — The ID of the actor
      - `display_name` string, required — The name of the actor
      - `avatar_url` string, required — The URL of the actor's avatar
    - `cancelled_actor` object, nullable
      - `id` string, required — The ID of the actor
      - `display_name` string, required — The name of the actor
      - `avatar_url` string, required — The URL of the actor's avatar
    - `schema_last_updated_at` string, nullable, required — When the schema was last updated for the deployment
    - `table_locked` boolean, required — Whether or not the deployment has a table locked
    - `locked_table_name` string, nullable — The name of the table that is locked by the deployment.
    - `instant_ddl` boolean, required — Whether or not the deployment is an instant DDL deployment
    - `instant_ddl_eligible` boolean, required — Whether or not the deployment is eligible for instant DDL
    - `queue_paused` boolean, required — Whether the deploy queue for the target branch is currently paused
    - `queue_pause_reason` string, nullable, required — A human-readable reason the deploy queue is paused, if known
  - `num_comments` integer, required — The number of comments on the deploy request
  - `html_url` string, required — The PlanetScale app address for the deploy request
  - `notes` string, required — Notes on the deploy request
  - `html_body` string, required — The HTML body of the deploy request
  - `created_at` string, required — When the deploy request was created
  - `updated_at` string, required — When the deploy request was last updated
  - `closed_at` string, nullable, required — When the deploy request was closed
  - `deployed_at` string, nullable, required — When the deploy request was deployed

## Other responses

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

---

[API](https://skmtc.net/planetscale/apis/planetscale-api.md) · [All operations](https://skmtc.net/planetscale/apis/planetscale-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/planetscale/planetscale-api/versions/fa19f3305241/schema)
