> ## 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.

# Reset database password or certificate

> Rotate a database's password or TLS certificate with POST /v2/databases/{database_id}/credentials/reset. A new password is shown only once.

<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:credentials` [scope](/en/api-reference/authentication#scopes).

Rotates either the access password or the TLS certificate of a database, without recreating it or changing its connection URL structure. Use this if a credential leaked or as part of a routine rotation policy.

The database must be running to reset either credential. Resetting `password` returns the new password once in the response body, it is not shown again, so store it immediately. Resetting `certificate` returns a plain success, fetch the new certificate afterward via [Get Certificate](/en/api-reference/endpoint/databases/credentials/get_certificate). After either reset, existing client connections using the old credential will need to reconnect. Rate limited to 1 reset every 3 seconds per user.

## Parameters

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

<ParamField body="reset" type="string" placeholder="password/certificate" required>
  The credential you want to reset, password or certificate.
</ParamField>

## Response

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

### If it's a password reset

<ResponseField name="response" type="object">
  The contents of the response.

  <Expandable title="Toggle object">
    <ResponseField name="password" type="string">
      The new generated password.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json theme={"system"}
  {
    "status":"success",
    "response":{
      "password":"f3T1hdskMkchMwK6Hxqinoyb"
    }
  }
  ```
</ResponseExample>

## Common errors

| Code | HTTP | Meaning |
| - | - | - |
| `INVALID_RESET_TYPE` | 400 | `reset` was not `"password"` or `"certificate"`. |
| `DATABASE_NOT_RUNNING` | 400 | The database is stopped; start it before resetting credentials. |
| `DATABASE_NOT_FOUND` | 404 | The database does not exist or is not owned by the caller. |
| `RESET_FAILED` | 500 | The credential rotation was rejected by the cluster. |

## Related

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


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