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

# Reset password

> Generate a new password for a single-login DBHost database through the API. The previous password stops working immediately.

Generates a new password for the database. The old password stops working immediately. PgBouncer is reloaded automatically.

The database must be active. Otherwise the request is refused before anything changes.

IP allowlist rules are allowed once DBHost can verify the new password from its own host; until then a reset on a database with rules is refused with `IP_ALLOWLIST_BLOCKS_RESET`. A few databases still need their owner login for that check, such as databases with the public explorer enabled and older single-login databases. With allowlist rules they answer `DATABASE_NOT_READY`: remove the rules, reset, then add them back.

## Headers

| Header | Required | Description |
| - | - | - |
| `Idempotency-Key` | No | Stable key for this reset. Resending the same key after an uncertain result returns the same outcome instead of starting another reset. The CLI always sends one and prints it. |

## Path parameters

| Parameter | Type | Description |
| - | - | - |
| `id` | uuid | Database ID |

## Response

```json 200 OK theme={null}
{
  "idempotencyKey": "your-stable-key",
  "operationId": null,
  "password": "new-generated-password"
}
```

`idempotencyKey` is echoed only when you sent one.

## Errors

| Status | Code | Description |
| - | - | - |
| 401 | `UNAUTHORIZED` | Missing or invalid API key |
| 404 | `DATABASE_NOT_FOUND` | Database doesn't exist, isn't owned by this user, or isn't in scope for this key |
| 409 | `DATABASE_STOPPED` | The database is stopped. Start it, then reset. Nothing was changed |
| 409 | `DATABASE_PAUSED_INACTIVE` | DBHost paused the database for inactivity. Start it, then reset. Nothing was changed |
| 409 | `DATABASE_NOT_ACTIVE` | The database is still being created, deleted or is in an error state. Nothing was changed |
| 409 | `IP_ALLOWLIST_BLOCKS_RESET` | IP allowlist rules prevent DBHost from verifying the new password. Remove the rules, reset, then add them back. Nothing was changed |
| 409 | `DATABASE_NOT_READY` | DBHost could not confirm pooled connections to the database. With IP allowlist rules, remove them, reset, then add them back; otherwise retry in a minute |
| 409 | `ROTATION_IN_PROGRESS` | Another reset is still running. DBHost first asks its VPS agent what became of it: a finished or failed reset is settled and your request proceeds, and a reset the agent is still working on answers with the seconds it needs in `Retry-After`. If the agent cannot say, the header says when a new reset may replace an unfinished one, or you can end it with `DELETE` below |
| 409 | `DATABASE_OPERATION_IN_PROGRESS` | A start, stop or restart of the database is still running. Nothing was changed; retry |
| 500 | `AGENT_ERROR` | The VPS agent failed to reset the password. Retry the reset |
| 503 | `CAPACITY_CHECK_UNAVAILABLE`, `REGISTRY_SYNC_UNAVAILABLE` or `CREDENTIAL_PROTECTION_UNAVAILABLE` | A check DBHost runs before the reset could not complete. Nothing was changed; retry in a minute |
| 503 | `PASSWORD_RESET_RECONCILIATION_REQUIRED` | The reset failed, and DBHost could not confirm that the previous password still works. Reset again to get a working password |
| 503 | `CREDENTIAL_ROTATION_INCOMPLETE` | The reset stopped after the new password may already have taken effect. Reset again: DBHost finishes the same reset and returns its password |
| 503 | `DATABASE_REOPEN_RECONCILIATION_REQUIRED` | The reset failed, and DBHost could not confirm that the database accepts connections again. The issue is reported to DBHost's operators. If the previous password stopped working, reset again once the database accepts connections |

## End an unfinished reset

```
DELETE /api/v1/databases/{id}/reset-password
```

Ends a reset that never finished so the next reset can start. DBHost reads the agent's record of the reset first.

```json 200 OK theme={null}
{ "status": "released" }
```

| `status` | Meaning |
| - | - |
| `none` | No unfinished reset was found |
| `completed` | The earlier reset had in fact finished. Reset again to get a new password |
| `released` | The unfinished reset was ended. Reset again |

If the agent is still working on the reset, the answer is a `409 ROTATION_IN_PROGRESS` with the time it needs in `Retry-After`. When the agent cannot answer, a reset is ended once it is at least 60 seconds old.

> [!WARNING]
>
> All active connections using the old password will fail. Update your application's connection string before or immediately after resetting.


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