# Update database settings

`PATCH https://api.instacloud.com/projects/{projectId}/database/settings`

**Token scope:** `account` · `org` · `project` — read-only tokens refused (not a GET).

Update postgres settings: connection pooling, scale-to-zero, idle timeout, storage, deletion protection, and private network access.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `branch` | query | `string` | no | branch name (default branch if omitted) |
| `group` | query | `string` | no | postgres service name (default: the sole postgres service) |
| `projectId` | path | `string` | yes |  |

## Request body (application/json)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connectionPooling` | `boolean` | no | enable provider-managed PgBouncer/connection pooling |
| `deletionProtection` | `boolean` | no |  |
| `scaleToZero` | `boolean` | no | enable or disable scale-to-zero |
| `cpu` | `string` | no | resource ceiling — vCPU as a provider quantity ('2', '4', '2500m'). PAID PLANS: the ceiling is the tier lever. Moves both directions (insta-db only) |
| `memory` | `string` | no | resource ceiling — memory as a provider quantity ('4Gi', '8Gi'). PAID PLANS. Moves both directions (insta-db only) |
| `idleTimeout` | `integer` | no | scale-to-zero idle timeout in seconds |
| `volumeSize` | `string` | no | the volume (block disk) size cap as whole Gi ('10Gi'). PAID PLANS: the ceiling is the tier lever. Grow-only — a provisioned disk cannot shrink (insta-db only) |
| `storageSize` | `string` | no | DEPRECATED alias of volumeSize — dropped next release |
| `privateAccess` | `boolean` | no | insta-db only — true: give the database a private network connection string and mint DATABASE_PRIVATE_URL (with the password) into its credentials beside DATABASE_URL, which is unchanged; compute services on the insta-compute provider bind it to connect without the public endpoint. false: retract DATABASE_PRIVATE_URL (refused while public access is closed); the response `warnings` name computes still bound to it. Gated — service.setAccess. 409 {code: private_lane_disabled} until the private lane is enabled on this deployment. Public access is NOT set here: use PUT /projects/{projectId}/services/{serviceId}/access. |

## Response 200

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | no |  |
| `name` | `string` | no |  |
| `state` | `string` | no |  |
| `routeKey` | `string` | no |  |
| `host` | `string` | no |  |
| `port` | `integer` | no |  |
| `connectionPooling` | `boolean` | no |  |
| `deletionProtection` | `boolean` | no |  |
| `scaleToZero` | `boolean` | no |  |
| `idleTimeoutSecs` | `integer` | no |  |
| `volumeSize` | `string` | no | the service's volume (block disk) size |
| `volumeGib` | `number` | no |  |
| `storageSize` | `string` | no | DEPRECATED alias of volumeSize — dropped next release |
| `storageGiB` | `number` | no | DEPRECATED alias of volumeGib — dropped next release |
| `enabledExtensions` | `string[]` | no |  |
| `cpuMilli` | `integer` | no | current cpu ceiling in millicores (2000 = 2 vCPU) |
| `memoryMib` | `integer` | no | current memory ceiling in MiB |
| `cap` | `object` | no | this plan's maximum for the ceilings — render sliders with their plan-limit markers. These are the caller's own tier caps and they move with the plan (and with env overrides per deployment), so read them from THIS field rather than assuming a tier's numbers; the parenthetical example that used to live here said 'pro 4 vCPU/4Gi/10Gi' and was stale on all three by the time anyone noticed. |
| `cap.cpuMilli` | `integer` | yes |  |
| `cap.memoryMib` | `integer` | yes |  |
| `cap.volumeGib` | `integer` | yes |  |
| `pending` | `boolean` | no | true when the provider accepted the change asynchronously and it has not been applied yet — the ceiling/volume fields are then the PRE-change values. Re-read (GET) to see the applied state. Absent when the change was applied synchronously. |
| `publicAccess` | `boolean` | no | postgres (insta-db) — false: the public endpoint refuses every connection (SQLSTATE 28000) and the database is not reachable from the internet; only the private network lane connects. Change it with PUT .../services/{serviceId}/access. Absent when the provider does not report it. |
| `privateAccess` | `boolean` | no | postgres (insta-db) — true: the database has a private network connection string (privateConnString, and DATABASE_PRIVATE_URL in the service credentials) for compute services on the insta-compute provider. Change it with PATCH .../database/settings {privateAccess}. Absent when the provider does not report it. |
| `privateConnString` | `string` | no | the connection string over the private network lane, WITHOUT the password (the full URL is DATABASE_PRIVATE_URL in the service credentials). Present only while privateAccess is on. |
| `privateLane` | `object` | no | GET .../database/instance only — this deployment's private-lane switches, so a UI can render the toggles without a probing write |
| `privateLane.enabled` | `boolean` | yes | the private network access toggle and closing public access are available on this deployment; false: both answer 409 {code: private_lane_disabled} |
| `privateLane.console` | `boolean` | yes | the platform console reaches databases over the private network lane; false: it uses the public endpoint, so it cannot browse a database whose public access is closed |
| `warnings` | `string[]` | no | what this change will break and how to fix it (e.g. compute services bound to DATABASE_PRIVATE_URL when private access is turned off). Advisory: the change was applied. |

## Response 202

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `string` | yes |  |
| `approvalId` | `string` | yes |  |
| `action` | `string` | yes |  |
| `actions` | `string[]` | yes |  |
| `message` | `string` | yes |  |
| `url` | `string` | yes |  |

## Response 400

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |

## Response 403

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |

## Response 404

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |

## Response 409

code private_lane_disabled: private network access is not yet available on this deployment. code private_lane_unavailable_in_region: the database's region has no private network lane yet — privateAccess was turned back off and nothing was minted. code credential_change_in_progress (privateAccess only): another credential change for this database (a private-access toggle or a password rotation) is in flight — nothing was changed; retry in a moment

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |
| `code` | `string` | no | stable machine-readable reason, e.g. private_lane_disabled, private_lane_unavailable_in_region, public_access_closed, credential_change_in_progress |

## Response 502

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |
