### GET /organizations/{organization}/databases/{database}/workflows Source: https://planetscale.com/docs/openapi.yaml ```markdown ### Parameters - **organization** (string, path, required): The name of the organization the workflow belongs to - **database** (string, path, required): The name of the database the workflow belongs to - **between** (string, query, optional): Filter workflows to those active during a time range (e.g. 2025-01-01T00:00:00Z..2025-01-01T23:59:59) - **page** (integer, query, optional): If provided, specifies the page offset of returned results - **per_page** (integer, query, optional): If provided, specifies the number of returned results ### Responses #### 200 - Returns workflows - **type** (string) (required): The response type. Always "list" for paginated responses. - **current_page** (integer) (required): The current page number - **next_page** (integer) (required): The next page number, or null when this is the last page - **next_page_url** (string) (required): The next page of results, or null when this is the last page - **prev_page** (integer) (required): The previous page number, or null when this is the first page - **prev_page_url** (string) (required): The previous page of results, or null when this is the first page - **data** (array (object)) (required) Array items: - **id** (string) (required): The ID of the workflow - **name** (string) (required): The name of the workflow - **number** (integer) (required): The sequence number of the workflow - **state** (string (pending|copying|running|stopped|verifying_data|verified_data|switching_replicas|switched_replicas|switching_primaries|switched_primaries|reversing_traffic|reversing_traffic_for_cancel|cutting_over|cutover|reversed_cutover|completed|cancelling|cancelled|error)) (required): The state of the workflow ("pending"|"copying"|"running"|"stopped"|"verifying_data"|"verified_data"|"switching_replicas"|"switched_replicas"|"switching_primaries"|"switched_primaries"|"reversing_traffic"|"reversing_traffic_for_cancel"|"cutting_over"|"cutover"|"reversed_cutover"|"completed"|"cancelling"|"cancelled"|"error") - **created_at** (string) (required): When the workflow was created - **updated_at** (string) (required): When the workflow was last updated - **started_at** (string) (required): When the workflow was started - **completed_at** (string) (required): When the workflow was completed - **cancelled_at** (string) (required): When the workflow was cancelled - **reversed_at** (string) (required): When the workflow was reversed - **retried_at** (string) (required): When the workflow was retried - **data_copy_completed_at** (string) (required): When the data copy was completed - **cutover_at** (string) (required): When the cutover was completed - **replicas_switched** (boolean) (required): Whether or not the replicas have been switched - **primaries_switched** (boolean) (required): Whether or not the primaries have been switched - **switch_replicas_at** (string) (required): When the replicas were switched - **switch_primaries_at** (string) (required): When the primaries were switched - **verify_data_at** (string) (required): When the data was verified - **workflow_type** (string (move_tables)) (required): The type of the workflow ("move_tables") - **workflow_subtype** (string) (required): The subtype of the workflow - **defer_secondary_keys** (boolean) (required): Whether or not secondary keys are deferred - **on_ddl** (string (IGNORE|STOP|EXEC|EXEC_IGNORE)) (required): The behavior when DDL changes during the workflow ("IGNORE"|"STOP"|"EXEC"|"EXEC_IGNORE") - **workflow_errors** (string) (required): The errors that occurred during the workflow - **may_retry** (boolean) (required): Whether or not the workflow may be retried - **may_restart** (boolean) (required): Whether or not the workflow may be restarted - **verified_data_stale** (boolean) (required): Whether or not the verified data is stale - **sequence_tables_applied** (boolean) (required): Whether or not sequence tables have been created - **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 - **verify_data_by** (object) (required) - **reversed_by** (object) (required) - **switch_replicas_by** (object) (required) - **switch_primaries_by** (object) (required) - **cancelled_by** (object) (required) - **completed_by** (object) (required) - **retried_by** (object) (required) - **cutover_by** (object) (required) - **reversed_cutover_by** (object) (required) - **branch** (object) (required) - **id** (string) (required): The ID for the resource - **name** (string) (required): The name for the resource - **created_at** (string) (required): When the resource was created - **updated_at** (string) (required): When the resource was last updated - **deleted_at** (string) (required): When the resource was deleted, if deleted - **source_keyspace** (object) (required) - **target_keyspace** (object) (required) - **global_keyspace** (object) (required) #### 401 - Unauthorized Unauthorized #### 403 - Forbidden Forbidden #### 404 - Not Found Not Found #### 500 - Internal Server Error Internal Server Error ### Example Usage ```bash curl -X GET "https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/workflows?between=string&page=1&per_page=25" ``` ``` -------------------------------- ### GET /organizations/{organization}/databases/{database}/deploy-queue Source: https://planetscale.com/docs/openapi.yaml The deploy queue returns the current list of deploy requests in the order they will be deployed. ```markdown ### Parameters - **organization** (string, path, required): The name of the deploy request's organization - **database** (string, path, required): The name of the deploy request's database - **page** (integer, query, optional): If provided, specifies the page offset of returned results - **per_page** (integer, query, optional): If provided, specifies the number of returned results ### Responses #### 200 - Returns the deploy queue for a database - **type** (string) (required): The response type. Always "list" for paginated responses. - **current_page** (integer) (required): The current page number - **next_page** (integer) (required): The next page number, or null when this is the last page - **next_page_url** (string) (required): The next page of results, or null when this is the last page - **prev_page** (integer) (required): The previous page number, or null when this is the first page - **prev_page_url** (string) (required): The previous page of results, or null when this is the first page - **data** (array (object)) (required) Array items: - **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) (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): Deploy check errors for the deployment. - **finished_at** (string) (required): When the deployment was finished - **force_cutover_requested_at** (string) (required): When force cutover was triggered for the deployment - **queued_at** (string) (required): When the deployment was queued - **ready_to_cutover_at** (string) (required): When the deployment was ready for cutover - **started_at** (string) (required): When the deployment was started - **state** (string (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 ("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") - **submitted_at** (string) (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** (array (object)) (required): The deployments ahead of this one in the queue - **deploy_operations** (array (object)) (required) Array items: - **id** (string) (required): The ID for the deploy operation - **state** (string (pending|queued|in_progress|complete|cancelled|error)) (required): The state of the deploy operation ("pending"|"queued"|"in_progress"|"complete"|"cancelled"|"error") - **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) (required): The estimated seconds until completion for the deploy operation - **progress_percentage** (number) (required): The percent completion for the deploy operation - **deploy_error_docs_url** (string) (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) (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) (required): When the table modified by the deploy operation was last used - **removed_foreign_key_names** (array (string)) (required): Names of foreign keys removed by this operation - **deploy_errors** (string) (required): Deploy errors for the deploy operation - **deploy_operation_summaries** (array (object)) (required) Array items: - **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** (string (pending|in_progress|complete|cancelled|error)) (required): The state of the deploy operation summary ("pending"|"in_progress"|"complete"|"cancelled"|"error") - **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) (required): When the table modified by the deploy operation summary was last used - **throttled_at** (string) (required): When the deploy operation summary was last throttled - **removed_foreign_key_names** (array (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** (array (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** (array (object)) (required) Array items: - **id** (string) (required): The ID for the deploy operation - **shard** (string) (required): The shard the deploy operation is being performed on - **state** (string (pending|queued|in_progress|complete|cancelled|error)) (required): The state of the deploy operation ("pending"|"queued"|"in_progress"|"complete"|"cancelled"|"error") - **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** (array (object)) (required): Schema lint errors preventing the deployment from completing - **sequential_diff_dependencies** (array (object)) (required): The schema dependencies that must be satisfied - **lookup_vindex_operations** (array (object)) (required): Lookup Vitess index operations - **throttler_configurations** (object): Deployment throttling configurations. - **deployment_revert_request** (object) (required): The request to revert the schema operations in this deployment - **actor** (object) - **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) - **cancelled_actor** (object) - **schema_last_updated_at** (string) (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): 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) (required): A human-readable reason the deploy queue is paused, if known #### 401 - Unauthorized Unauthorized #### 403 - Forbidden Forbidden #### 404 - Not Found Not Found #### 500 - Internal Server Error Internal Server Error ### Example Usage ```bash curl -X GET "https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/deploy-queue?page=1&per_page=25" ``` ``` -------------------------------- ### GET /organizations/{organization}/service-tokens/{id} Source: https://planetscale.com/docs/openapi.yaml Get information about a service token. ### Authorization A service token must have at least one of the following access in order to use this API endpoint: **Service Token Accesses** `read_service_tokens` ```markdown ### Parameters - **organization** (string, path, required): The name of the organization - **id** (string, path, required): The ID of the service token ### Responses #### 200 - Returns the service token - **id** (string) (required): The ID of the service token - **name** (string) (required): The name of the service token - **display_name** (string) (required): The display name of the service token - **token** (string): The plaintext token. Available only after create. - **plain_text_refresh_token** (string): The plaintext refresh token. Available only after create. - **avatar_url** (string) (required): The image source for the avatar of the service token - **created_at** (string) (required): When the service token was created - **updated_at** (string) (required): When the service token was last updated - **expires_at** (string) (required): When the service token will expire - **last_used_at** (string) (required): When the service token was last used - **actor_id** (string) (required): The ID of the actor on whose behalf the service token was created - **actor_display_name** (string) (required): The name of the actor on whose behalf the service token was created - **actor_type** (string) (required): The type of the actor on whose behalf the service token was created - **service_token_accesses** (array (object)) Array items: - **id** (string) (required): The ID of the service token access - **access** (string) (required): The name of the service token access - **description** (string) (required): The description of the service token access - **resource_name** (string) (required): The name of the resource the service token access gives access to - **resource_id** (string) (required): The ID of the resource the service token access gives access to - **resource_type** (string) (required): The type of the resource the service token access gives access to - **resource** (object) (required) - **id** (string) (required): The ID for the resource - **name** (string) (required): The name for the resource - **created_at** (string) (required): When the resource was created - **updated_at** (string) (required): When the resource was last updated - **deleted_at** (string) (required): When the resource was deleted, if deleted - **oauth_accesses_by_resource** (object) - **database** (object) (required) - **databases** (array (object)) (required) Array items: - **name** (string) (required): the name of the database the token has access to - **id** (string) (required): the id of the database the token has access to - **organization** (string) (required): the name of the database's organization - **url** (string) (required): the planetscale app url for the database - **accesses** (array (object)) (required) Array items: - **name** (string) (required): The name of the access scope - **description** (string) (required): The scope description - **organization** (object) (required) - **organizations** (array (object)) (required) Array items: - **name** (string) (required): the name of the organization - **id** (string) (required): the id of the organization - **url** (string) (required): the planetscale app url for the organization - **accesses** (array (object)) (required) Array items: - **branch** (object) (required) - **branches** (array (object)) (required) Array items: - **name** (string) (required): the name of the branch - **id** (string) (required): the id of the branch - **database** (string) (required): the name of the database the branch belongs to - **organization** (string) (required): the name of the organization the branch belongs to - **url** (string) (required): the planetscale app url for the branch - **accesses** (array (object)) (required) Array items: - **user** (object) (required) - **users** (array (object)) (required) Array items: - **name** (string) (required): the name of the user - **id** (string) (required): the id of the user - **accesses** (array (object)) (required) Array items: #### 401 - Unauthorized Unauthorized #### 403 - Forbidden Forbidden #### 404 - Not Found Not Found #### 500 - Internal Server Error Internal Server Error ### Example Usage ```bash curl -X GET "https://api.planetscale.com/v1/organizations/{organization}/service-tokens/{id}" ``` ``` -------------------------------- ### POST /organizations/{organization}/databases/{database}/branches/{branch}/promote Source: https://planetscale.com/docs/openapi.yaml Promotes a branch from development to production ### 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** `connect_production_branch`, `promote_branches` **OAuth Scopes** | Resource | Scopes | | :------- | :---------- | | Organization | `promote_branches` | | Database | `promote_branches` | ```markdown ### Parameters - **organization** (string, path, required): The name of the organization the branch belongs to - **database** (string, path, required): The name of the database the branch belongs to - **branch** (string, path, required): The name of the branch ### Responses #### 200 - Returns a production branch - **id** (string) (required): The ID of the branch - **name** (string) (required): The name of the branch - **created_at** (string) (required): When the branch was created - **updated_at** (string) (required): When the branch was last updated - **deleted_at** (string) (required): When the branch was deleted - **restore_checklist_completed_at** (string) (required): When a user last marked a backup restore checklist as completed - **schema_last_updated_at** (string) (required): When the schema for the branch was last updated - **kind** (string (mysql|postgresql)) (required): The kind of branch ("mysql"|"postgresql") - **mysql_address** (string) (required): The MySQL address for the branch - **mysql_edge_address** (string) (required): The address of the MySQL provider for the branch - **state** (string (pending|sleep_in_progress|sleeping|awakening|ready)) (required): The current state of the branch ("pending"|"sleep_in_progress"|"sleeping"|"awakening"|"ready") - **direct_vtgate** (boolean) (required): True if the branch allows passwords to connect directly to a vtgate, bypassing load balancers - **vtgate_size** (string) (required): The size of the vtgate cluster for the branch - **vtgate_count** (integer) (required): The number of vtgate instances in the branch - **cluster_name** (string) (required): The SKU representing the branch's cluster size - **cluster_iops** (integer) (required): IOPS for the cluster - **ready** (boolean) (required): Whether or not the branch is ready to serve queries - **schema_ready** (boolean) (required): Whether or not the schema is ready for queries - **metal** (boolean) (required): Whether or not this is a metal database - **production** (boolean) (required): Whether or not the branch is a production branch - **safe_migrations** (boolean) (required): Whether or not the branch has safe migrations enabled - **sharded** (boolean) (required): Whether or not the branch is sharded - **shard_count** (integer) (required): The number of shards in the branch - **keyspace_count** (integer) (required): The number of keyspaces in the branch - **stale_schema** (boolean) (required): Whether or not the branch has a stale schema - **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 - **restored_from_branch** (object) (required) - **private_edge_connectivity** (boolean) (required): True if private connections are enabled - **has_replicas** (boolean) (required): True if the branch has replica servers - **has_read_only_replicas** (boolean) (required): True if the branch has read-only replica servers - **html_url** (string) (required): Planetscale app URL for the branch - **url** (string) (required): Planetscale API URL for the branch - **region** (object) (required) - **id** (string) (required): The ID of the region - **provider** (string) (required): Provider for the region (ex. AWS) - **enabled** (boolean) (required): Whether or not the region is currently active - **public_ip_addresses** (array (string)) (required): Public IP addresses for the region - **display_name** (string) (required): Name of the region - **location** (string) (required): Location of the region - **slug** (string) (required): The slug of the region - **current_default** (boolean) (required): True if the region is the default for new branch creation - **mysql_supported** (boolean) (required): Whether the region supports MySQL/Vitess databases - **postgresql_supported** (boolean) (required): Whether the region supports PostgreSQL databases - **parent_branch** (string) (required): The name of the parent branch from which the branch was created - **vtgate_options** (object) (required): VTGate configuration options #### 401 - Unauthorized Unauthorized #### 403 - Forbidden Forbidden #### 404 - Not Found Not Found #### 500 - Internal Server Error Internal Server Error ### Example Usage ```bash curl -X POST "https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch}/promote" ``` ``` -------------------------------- ### GET /regions Source: https://planetscale.com/docs/openapi.yaml Endpoint is available without authentication. ```markdown ### Parameters - **page** (integer, query, optional): If provided, specifies the page offset of returned results - **per_page** (integer, query, optional): If provided, specifies the number of returned results ### Responses #### 200 - Returns the available public PlanetScale regions - **type** (string) (required): The response type. Always "list" for paginated responses. - **current_page** (integer) (required): The current page number - **next_page** (integer) (required): The next page number, or null when this is the last page - **next_page_url** (string) (required): The next page of results, or null when this is the last page - **prev_page** (integer) (required): The previous page number, or null when this is the first page - **prev_page_url** (string) (required): The previous page of results, or null when this is the first page - **data** (array (object)) (required) Array items: - **id** (string) (required): The ID of the region - **provider** (string) (required): The cloud provider for the region - **enabled** (boolean) (required): Whether new clusters can be created in this region - **public_ip_addresses** (array (string)) (required): List of public IP addresses for the region - **display_name** (string) (required): The name of the region - **location** (string) (required): The location of the region - **slug** (string) (required): The slug identifier for the region #### 401 - Unauthorized Unauthorized #### 403 - Forbidden Forbidden #### 404 - Not Found Not Found #### 500 - Internal Server Error Internal Server Error ### Example Usage ```bash curl -X GET "https://api.planetscale.com/v1/regions?page=1&per_page=25" ``` ``` -------------------------------- ### POST /organizations/{organization}/databases/{database}/branches/{branch}/backups Source: https://planetscale.com/docs/openapi.yaml ### 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` | | Branch | `write_backups` | ```markdown ### Parameters - **organization** (string, path, required): The name of the organization the branch belongs to - **database** (string, path, required): The name of the database the branch belongs to - **branch** (string, path, required): The name of the branch ### Request Body **Content-Type:** application/json - **name** (string): Name for the backup - **retention_unit** (string (hour|day|week|month|year)): Unit for the retention period of the backup ("hour"|"day"|"week"|"month"|"year") - **retention_value** (integer): Value between `1` and `1000` for the retention period of the backup (i.e retention_value `6` and retention_unit `hour` means 6 hours) - **emergency** (boolean): Whether the backup is an immediate backup that may affect database performance. Emergency backups are only supported for PostgreSQL databases. ### Responses #### 201 - Returns the created database branch backup - **id** (string) (required): The ID of the backup - **name** (string) (required): The name of the backup - **state** (string (pending|running|success|failed|canceled|ignored)) (required): The current state of the backup ("pending"|"running"|"success"|"failed"|"canceled"|"ignored") - **size** (integer) (required): The size of the backup in bytes - **estimated_storage_cost** (number) (required): The estimated storage cost of the backup - **created_at** (string) (required): When the backup was created - **updated_at** (string) (required): When the backup was last updated - **started_at** (string) (required): When the backup started - **expires_at** (string) (required): When the backup expires - **completed_at** (string) (required): When the backup completed - **deleted_at** (string) (required): When the backup was deleted - **pvc_size** (integer) (required): Size of the PVC used for the backup - **uncompressed_size** (integer) (required): The uncompressed (logical) size of the backup in bytes - **protected** (boolean) (required): Whether or not the backup is protected from deletion - **required** (boolean) (required): Whether or not the backup policy is required - **restored_branches** (array (object)) (required) Array items: - **id** (string) (required): The ID for the resource - **name** (string) (required): The name for the resource - **created_at** (string) (required): When the resource was created - **updated_at** (string) (required): When the resource was last updated - **deleted_at** (string) (required): When the resource was deleted, if deleted - **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 - **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** (string (production|development)) (required): Whether the policy is for production or development branches ("production"|"development") - **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) (required): Day of the week that the backup is scheduled. 0 is Sunday, 6 is Saturday - **schedule_week** (integer) (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) (required): When the backup was last run - **next_run_at** (string) (required): When the backup will next run - **required** (boolean) (required): Whether the policy is a required system backup - **schema_snapshot** (object) - **id** (string) (required): The ID of the schema snapshot - **name** (string) (required): The name of the schema snapshot - **created_at** (string) (required): When the schema snapshot was created - **updated_at** (string) (required): When the schema snapshot was last updated - **linted_at** (string) (required): When the schema snapshot was last linted - **url** (string) (required): The URL to the schema snapshot in the PlanetScale app - **database_branch** (object) #### 401 - Unauthorized Unauthorized #### 403 - Forbidden Forbidden #### 404 - Not Found Not Found #### 500 - Internal Server Error Internal Server Error ### Example Usage ```bash curl -X POST "https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch}/backups" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "retention_unit": "hour", "retention_value": "0", "emergency": "true" }' ``` ``` -------------------------------- ### GET /organizations/{organization}/databases/{database}/workflows/{number} Source: https://planetscale.com/docs/openapi.yaml ```markdown ### Parameters - **organization** (string, path, required): The name of the organization the workflow belongs to - **database** (string, path, required): The name of the database the workflow belongs to - **number** (integer, path, required): The sequence number of the workflow ### Responses #### 200 - Returns a workflow - **id** (string) (required): The ID of the workflow - **name** (string) (required): The name of the workflow - **number** (integer) (required): The sequence number of the workflow - **state** (string (pending|copying|running|stopped|verifying_data|verified_data|switching_replicas|switched_replicas|switching_primaries|switched_primaries|reversing_traffic|reversing_traffic_for_cancel|cutting_over|cutover|reversed_cutover|completed|cancelling|cancelled|error)) (required): The state of the workflow ("pending"|"copying"|"running"|"stopped"|"verifying_data"|"verified_data"|"switching_replicas"|"switched_replicas"|"switching_primaries"|"switched_primaries"|"reversing_traffic"|"reversing_traffic_for_cancel"|"cutting_over"|"cutover"|"reversed_cutover"|"completed"|"cancelling"|"cancelled"|"error") - **created_at** (string) (required): When the workflow was created - **updated_at** (string) (required): When the workflow was last updated - **started_at** (string) (required): When the workflow was started - **completed_at** (string) (required): When the workflow was completed - **cancelled_at** (string) (required): When the workflow was cancelled - **reversed_at** (string) (required): When the workflow was reversed - **retried_at** (string) (required): When the workflow was retried - **data_copy_completed_at** (string) (required): When the data copy was completed - **cutover_at** (string) (required): When the cutover was completed - **replicas_switched** (boolean) (required): Whether or not the replicas have been switched - **primaries_switched** (boolean) (required): Whether or not the primaries have been switched - **switch_replicas_at** (string) (required): When the replicas were switched - **switch_primaries_at** (string) (required): When the primaries were switched - **verify_data_at** (string) (required): When the data was verified - **workflow_type** (string (move_tables)) (required): The type of the workflow ("move_tables") - **workflow_subtype** (string) (required): The subtype of the workflow - **defer_secondary_keys** (boolean) (required): Whether or not secondary keys are deferred - **on_ddl** (string (IGNORE|STOP|EXEC|EXEC_IGNORE)) (required): The behavior when DDL changes during the workflow ("IGNORE"|"STOP"|"EXEC"|"EXEC_IGNORE") - **workflow_errors** (string) (required): The errors that occurred during the workflow - **may_retry** (boolean) (required): Whether or not the workflow may be retried - **may_restart** (boolean) (required): Whether or not the workflow may be restarted - **verified_data_stale** (boolean) (required): Whether or not the verified data is stale - **sequence_tables_applied** (boolean) (required): Whether or not sequence tables have been created - **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 - **verify_data_by** (object) (required) - **reversed_by** (object) (required) - **switch_replicas_by** (object) (required) - **switch_primaries_by** (object) (required) - **cancelled_by** (object) (required) - **completed_by** (object) (required) - **retried_by** (object) (required) - **cutover_by** (object) (required) - **reversed_cutover_by** (object) (required) - **branch** (object) (required) - **id** (string) (required): The ID for the resource - **name** (string) (required): The name for the resource - **created_at** (string) (required): When the resource was created - **updated_at** (string) (required): When the resource was last updated - **deleted_at** (string) (required): When the resource was deleted, if deleted - **source_keyspace** (object) (required) - **target_keyspace** (object) (required) - **global_keyspace** (object) (required) #### 401 - Unauthorized Unauthorized #### 403 - Forbidden Forbidden #### 404 - Not Found Not Found #### 500 - Internal Server Error Internal Server Error ### Example Usage ```bash curl -X GET "https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/workflows/{number}" ``` ``` -------------------------------- ### GET /user Source: https://planetscale.com/docs/openapi.yaml Get the user associated with this service token ### Authorization A OAuth token must have at least one of the following scopes in order to use this API endpoint: **OAuth Scopes** | Resource | Scopes | | :------- | :---------- | | User | `read_user` | ```markdown ### Responses #### 200 - Returns the user associated with this service token - **id** (string) (required): The ID of the user - **display_name** (string) (required): The display name of the user - **name** (string) (required): The name of the user - **email** (string) (required): The email of the user - **avatar_url** (string) (required): The URL source of the user's avatar - **created_at** (string) (required): When the user was created - **updated_at** (string) (required): When the user was last updated - **two_factor_auth_configured** (boolean) (required): Whether or not the user has configured two factor authentication - **default_organization** (object) - **id** (string) (required): The ID for the resource - **name** (string) (required): The name for the resource - **created_at** (string) (required): When the resource was created - **updated_at** (string) (required): When the resource was last updated - **deleted_at** (string) (required): When the resource was deleted, if deleted - **sso** (boolean): Whether or not the user is managed by SSO. - **managed** (boolean): Whether or not the user is managed by an authentication provider. - **directory_managed** (boolean): Whether or not the user is managed by a SSO directory. - **email_verified** (boolean): Whether or not the user is verified by email. #### 401 - Unauthorized Unauthorized #### 403 - Forbidden Forbidden #### 404 - Not Found Not Found #### 500 - Internal Server Error Internal Server Error ### Example Usage ```bash curl -X GET "https://api.planetscale.com/v1/user" ``` ```