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

# Edit database

> Rename a database or change its memory with PATCH /v2/databases/{database_id}, without restarting it or changing its credentials and connection URL.

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

Updates a database's display name and/or its allocated memory without recreating the container or rotating its credentials, connection URL and port stay the same. At least one of `name` or `ram` must be present in the request body.

Changing `ram` is applied live against the database's cluster; it fails if the new value is invalid for the plan or engine. This does not restart the database. To check whether a memory change is reflected, see [Get Database Info](/en/api-reference/endpoint/databases/info) or [Get Database Status](/en/api-reference/endpoint/databases/status). Rate limited to 1 update every 5 seconds per user.

## Parameters

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

<ParamField body="name" type="string" placeholder="database name">
  The name of the database. 1–32 characters: letters, numbers, underscores (`_`), hyphens (`-`) and spaces, and must include at least one letter, number or underscore.
</ParamField>

<ParamField body="ram" type="int" placeholder="RAM(in MB)">
  The amount of RAM to allocate, in megabytes. Minimums: Redis 512 MB, MongoDB and PostgreSQL 1024 MB.
</ParamField>

## Response

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

<ResponseExample>
  ```json theme={"system"}
  {
    "status":"success"
  }
  ```
</ResponseExample>

## Common errors

| Code | HTTP | Meaning |
| - | - | - |
| `NO_UPDATE_DATA` | 400 | Neither `name` nor `ram` was provided in the request body. |
| `INVALID_NAME` | 400 | The new name fails the 1-32 character validation. |
| `INVALID_MEMORY` | 400 | The new `ram` value is not valid for this database's engine or plan. |
| `DATABASE_NOT_FOUND` | 404 | The database does not exist or is not owned by the caller. |
| `INTERNAL_SERVER_ERROR` | 500 | The memory update could not be applied. |

## Related

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


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