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

> Reset the certificate or a password of a database hosted on Square Cloud.

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

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 successful, `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={null}
  {
    "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.            |
