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

# Starter standby

> Add a standby to a Starter PostgreSQL database. Redis and Valkey Starter databases can add an asynchronous standby.

> [!NOTE]
>
> **Not yet released.** This guide describes implemented changes awaiting rollout. Availability requires the corresponding backend and dashboard release.

## Goal

Keep a Starter database available through a server failure.

## Prerequisites

* A running Starter database on StackShift’s servers
* Standby switched on for your account

## Workflow

**Step 1**

Turn it on with `stackshift database standby DATABASE --data '{"mode":"sync","on_standby_loss":"degrade"}'` (`PUT /api/v1/databases/{id}/standby`).

**Step 2**

On a database’s first add-on, choose how to pay with `billing`: `monthly` (default), `yearly` or `hourly`.

**Step 3**

If the answer is `409 price_confirmation_required`, resend with `confirm_charge_minor` set to the quoted charge. If it is `402 payment_required`, open `checkout_url` and pay. Nothing is built until the payment clears.

**Step 4**

Wait for the standby to be set up. The database stays online, with one pause of a few seconds when it switches over.

**Step 5**

Turn it off with `"mode":"off"`. The standby server is removed.

## PostgreSQL

* `mode` is `sync`, `async` or `off`. `on_standby_loss` is `degrade` (default: writes continue until a new standby is ready) or `block` (writes wait).
* Works like the Dedicated standby. See Standby and high availability for what each choice means.
* Costs as much as the database itself, so your total is about double. See [https://stackshift.cloud/pricing](https://stackshift.cloud/pricing).
* Needs a second server with room for the database. Otherwise you get an error that the server can’t host a standby yet, or that we’re adding capacity.
* While it is on, connection pooling, read replicas and scaling aren’t available.
* If a payment for it fails, the standby is turned off, but your database keeps running.

## Redis and Valkey

* Only `{"mode": "async"}` and `{"mode": "off"}`, for example `stackshift database standby DATABASE --data '{"mode":"async"}'`. `sync` isn’t offered.
* `GET /api/v1/databases/{id}/standby` shows the standby’s state and which server is serving.
* See the Redis and Valkey guides for failover timing and what can be lost.

## Availability

This is rolling out for Starter PostgreSQL databases. If your database page doesn’t offer it, it isn’t switched on for your account yet, and the API answers `403`.

## Expected result

> [!TIP]
>
> The database has a standby on another server. The `202` answer carries the `standby` state and its members.

## Common failures

> [!WARNING]
>
> * `409` “Choose off, sync or async for the standby.” or “Choose whether writes continue or stop when the standby is lost.”: fix the request.
> * `409` “Turn off connection pooling…” or “Remove this database’s read replicas…”: do that first.
> * `409` while a standby change or another change is running: wait for it to finish.
> * `403`: standby isn’t switched on for your account yet.

## Related guides

> **[Standby and high availability](https://docs.stackshift.cloud/databases/standby-and-high-availability.md)**
>
> Add a standby on another server. If the primary fails, the standby takes over and your connection address stays the same.

> **[Starter point-in-time restore](https://docs.stackshift.cloud/databases/starter-point-in-time-restore.md)**
>
> Turn on point-in-time restore for a Starter PostgreSQL database and restore it to an exact second into a new database.

> **[Starter or Dedicated](https://docs.stackshift.cloud/databases/starter-and-dedicated.md)**
>
> Starter databases share a server with other databases. A Dedicated database is its own virtual machine with a standby, read replicas and restore to any second.

> **[Dedicated billing](https://docs.stackshift.cloud/databases/dedicated-billing.md)**
>
> Pay for a Dedicated database monthly, yearly or by the hour, from your wallet or card.


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