# Update Account

**Endpoint**

<kbd>`PATCH`</kbd>`/v2/account/{id}`

**Link**

{% embed url="<https://stagep.tst-apidmndelss.com/openapi/v2.html#/operations/Accounts_UpdateAccount>" %}

### **Request**

#### **Path Parameters**

<table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th><th width="108">Required</th><th>Example</th></tr></thead><tbody><tr><td><strong><code>id</code></strong></td><td><code>string</code></td><td><strong>Account ID</strong> to update.</td><td>Yes</td><td><code>"UhcPVBEpjmtR"</code></td></tr></tbody></table>

#### **Headers**

| Key             | Value              | Required |
| --------------- | ------------------ | -------- |
| `Authorization` | `Bearer <JWT>`     | Yes      |
| `Content-Type`  | `application/json` | Yes      |
| `Accept`        | `application/json` | Yes      |

#### **Request Body (JSON)**

All fields are optional - only include the fields you want to update.

| Field             | Type      | Description & Values                                                                                                                                                                                                        | Example              |
| ----------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| **`name`**        | `string`  | New account name.                                                                                                                                                                                                           | `"New Account Name"` |
| **`currencyIso`** | `string`  | New currency code (ISO 4217, e.g., `USD`).                                                                                                                                                                                  | `"EUR"`              |
| **`isDefault`**   | `boolean` | Set as default account (`true`/`false`).                                                                                                                                                                                    | `true`               |
| **`status`**      | `string`  | <p>New account status:<br>- <code>NEW</code><br>- <code>PRE\_MODERATION</code><br>- <code>MODERATION</code><br>- <code>ACCEPTED</code><br>- <code>REJECTED</code><br>- <code>BANNED</code><br>- <code>PROCESSING</code></p> | `"ACCEPTED"`         |

**Example Request Body:**

json

```
{
  "name": "Updated Business Account",
  "isDefault": true,
  "status": "ACCEPTED"
}
```

***

### **Response (200 OK)**

Returns the updated `Account entity v2` object in JSON format (same structure as Get Account by ID).

#### **Key Response Fields**

* **`name`**: Updated account name
* **`currencyIso`**: Updated currency (if changed)
* **`isDefault`**: New default status
* **`status`**: Updated account status
* **`updatedAt`**: New timestamp reflecting update time

**Example Response:**

json

```
{
  "item": {
    "id": "UhcPVBEpjmtR",
    "name": "Updated Business Account",
    "isDefault": true,
    "status": "ACCEPTED",
    "currencyIso": "USD",
    "updatedAt": "2024-05-21T09:15:00Z",
    // Other fields unchanged...
  }
}
```

### Error Cases

1. **Invalid Status Transition**:

   json

   ```
   { "error": "Cannot change status from REJECTED to ACCEPTED" }
   ```
2. **Currency Change Restrictions**:

   json

   ```
   { "error": "Currency cannot be modified after account creation" }
   ```
3. **Account Not Found**:

   json

   ```
   { "error": "Account ID not found" }
   ```

***

### **Notes**

* **Partial Updates**: Only included fields are modified; omitted fields remain unchanged.
* **Immutable Fields**: Some fields (e.g., `customerId`) cannot be updated.
* **Status Flow**: Ensure valid status transitions (e.g., `NEW` → `ACCEPTED` is valid, but `BANNED` → `ACCEPTED` may be blocked).

### Examples

**Real request**&#x20;

```postman_json
Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjE2NCwiZXhwIjoxNzYzNTQ3ODk4LCJrZXkiOiI1Y2ZiOGZjN2RmYjk4ZjVkYmIyZTgwNTVkZWFhN2U2Zjk4MzEyYmE3Iiwib3RwX3ZlcmlmaWVkIjpmYWxzZX0.p4m7Y6i9wSCYm6iVUsqMWD1-idNinUgqDiMn-4E9Uts
accountId*: UrpI6jMzHnsP

{
  "customerId": "D7k3xbc-ERrj-lde9k1t3XuaE",
  "name": "USDT ERC20 1",
  "currencyCode": "USDT_ERC20",
  "isDefault": true,
  "status": "NEW"
}

```

**Real response**&#x20;

200 OK

```postman_json
{
  "item": {
    "accountId": "UrpI6jMzHnsP",
    "customer": {
      "id": "",
      "name": "",
      "email": "",
      "phone": "",
      "status": "NEW",
      "customerType": "CORPORATE"
    },
    "isDefault": true,
    "name": "USDT ERC20 1",
    "status": "NEW",
    "balance": {
      "balance": {
        "money": {
          "currencyCode": "USDT_ERC20",
          "units": "0",
          "nanos": 0
        },
        "default": {
          "currencyCode": "USD",
          "units": "0",
          "nanos": 0
        }
      },
      "hold": {
        "money": {
          "currencyCode": "USDT_ERC20",
          "units": "0",
          "nanos": 0
        },
        "default": {
          "currencyCode": "USD",
          "units": "0",
          "nanos": 0
        }
      }
    },
    "currencyCode": "USDT_ERC20",
    "requisites": [],
    "createdAt": "0001-01-01T00:00:00Z",
    "updatedAt": "0001-01-01T00:00:00Z"
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.delos.financial/accounts/update-account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
