> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete database

> Permanently delete a database and release its DNS record with DELETE /v2/databases/{database_id}. There is no confirmation, so take a snapshot first.

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  The API key for your account. You can find this in your [account settings](https://squarecloud.app/en/account/security).
</ParamField>

Requires an API key with the `databases:write` [scope](/en/api-reference/authentication#scopes).

Permanently removes the database container and releases its public DNS record (`square-cloud-db-<id>.squareweb.app`). This is destructive and immediate: there is no confirmation step, and the connection URL stops resolving as soon as the DNS record is released.

If you need the data afterward, take a [Create Snapshot](/en/api-reference/endpoint/databases/snapshots/create) before deleting. The request is rejected while a snapshot restore is in progress on the database. Rate limited to 1 deletion every 3 seconds per user.

## Parameters

<ParamField path="database_id" type="string" placeholder="Database ID" required>
  The ID of the database.
</ParamField>

## Response

<ResponseField name="status" type="string">
  Indicates whether the call was successful: `success` if it was, `error` if not.
</ResponseField>

<ResponseExample>
  ```json theme={"system"}
  {
    "status":"success"
  }
  ```
</ResponseExample>

## Common errors

| Code | HTTP | Meaning |
| - | - | - |
| `RESTORE_IN_PROGRESS` | 403 | A snapshot restore is currently running for this database; wait for it to finish. |
| `DATABASE_NOT_FOUND` | 404 | The database does not exist or is not owned by the caller. |
| `DELETE_FAILED` | 404 | The cluster rejected the delete operation. |

## Related

* CLI: [`squarecloud db delete`](/en/cli-reference/databases#squarecloud-db-delete)
* SDKs: [`api.databases.delete()`](/en/sdks/js/databases) (JavaScript), [`client.databases.delete()`](/en/sdks/py/databases) (Python), [`c.Databases.Delete()`](/en/sdks/go/databases) (Go)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.