# Update counterparty

This endpoint supports partial updates - only include the fields you want to modify.

**Endpoint**

`PATCH/v2/counterparty/{counterpartyId}`

**Link**

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

### **Request**

#### **Path Parameters**

| Parameter            | Type     | Description                    | Required | Example      |
| -------------------- | -------- | ------------------------------ | -------- | ------------ |
| **`counterpartyId`** | `string` | **Counterparty ID** to update. | Yes      | `"cp_12345"` |

#### **Headers**

| Key                 | Value              | Required |
| ------------------- | ------------------ | -------- |
| **`Authorization`** | `123`              | Yes      |
| **`Content-Type`**  | `application/json` | Yes      |
| **`Accept`**        | `application/json` | Yes      |

#### **Request Body**

All fields are optional - only include fields that need to be updated.

json

```
{
  "description": "Updated description for primary electronics supplier",
  "profile": {
    "name": "Tech Supplies Corp Updated",
    "email": "updated-contact@techsupplies.com",
    "phoneNumber": "+19876543211",
    "taxNumber": "TAX-US-12345-UPDATED",
    "dateOfBirth": "1985-05-15T00:00:00Z",
    "address": {
      "addressLine1": "456 Updated Street",
      "addressLine2": "Suite 600",
      "city": "New York",
      "stateIso": "NY",
      "countryIso": "US",
      "postalCode": "10002"
    },
    "website": "https://updated.techsupplies.com",
    "additionalInfo": {
      "type": "CORPORATION",
      "businessLine": "PLB_HIGH_TECH_SOFTWARE_TELECOMS",
      "relationship": "PRC_SUPPLIER"
    },
    "lastname": "Smith"
  },
  "accounts": [
    {
      "accountId": "acc_12345",
      "currencyCode": "USD",
      "bank": {
        "name": "Updated Bank Name",
        "number": "987654321",
        "address": {
          "addressLine1": "789 Bank Avenue",
          "city": "New York",
          "stateIso": "NY",
          "countryIso": "US",
          "postalCode": "10003"
        },
        "routingNumber": "021000022"
      },
      "fiat": {
        "number": "987654321",
        "routingNumber": "021000022",
        "additionalInformation": {
          "type": "TYPE_FIAT_US",
          "supportedRails": ["ACH", "FEDWIRE", "SWIFT"],
          "accountType": "CHECKING"
        }
      }
    }
  ]
}
```

***

### **Request Fields**

**1. Main Counterparty Fields**

| Field             | Type     | Required | Description                       | Example                          |
| ----------------- | -------- | -------- | --------------------------------- | -------------------------------- |
| **`description`** | `string` | No       | Updated counterparty description. | `"Updated supplier description"` |

**2. Profile Object**

| Field             | Type     | Required | Description                          | Example                  |
| ----------------- | -------- | -------- | ------------------------------------ | ------------------------ |
| **`name`**        | `string` | No       | Updated legal name.                  | `"Updated Corp Name"`    |
| **`email`**       | `string` | No       | Updated contact email.               | `"updated@example.com"`  |
| **`phoneNumber`** | `string` | No       | Updated contact phone.               | `"+19876543211"`         |
| **`taxNumber`**   | `string` | No       | Updated tax ID number.               | `"TAX-UPDATED-123"`      |
| **`dateOfBirth`** | `string` | No       | Updated date of birth/incorporation. | `"1985-05-15T00:00:00Z"` |
| **`website`**     | `string` | No       | Updated company website.             | `"https://updated.com"`  |
| **`lastname`**    | `string` | No       | Updated last name (individuals).     | `"Updated Lastname"`     |

**3. Address Object**

| Field              | Type     | Required | Description              | Example                |
| ------------------ | -------- | -------- | ------------------------ | ---------------------- |
| **`addressLine1`** | `string` | No       | Updated primary address. | `"456 Updated Street"` |
| **`addressLine2`** | `string` | No       | Updated suite/floor.     | `"Suite 600"`          |
| **`addressLine3`** | `string` | No       | Updated additional info. | `"Building C"`         |
| **`city`**         | `string` | No       | Updated city.            | `"New York"`           |
| **`stateIso`**     | `string` | No       | Updated state code.      | `"NY"`                 |
| **`countryIso`**   | `string` | No       | Updated country code.    | `"US"`                 |
| **`postalCode`**   | `string` | No       | Updated postal code.     | `"10002"`              |
| **`unitNumber`**   | `string` | No       | Updated unit number.     | `"6B"`                 |

**4. AdditionalInfo Object**

| Field              | Type     | Description                    | Allowed Values                       | Example                             |
| ------------------ | -------- | ------------------------------ | ------------------------------------ | ----------------------------------- |
| **`type`**         | `string` | Updated legal structure.       | `INDIVIDUAL`, `CORPORATION`          | `"CORPORATION"`                     |
| **`businessLine`** | `string` | Updated industry type.         | `PLB_AUTOMOTIVE`, `PLB_RETAIL`, etc. | `"PLB_HIGH_TECH_SOFTWARE_TELECOMS"` |
| **`relationship`** | `string` | Updated business relationship. | `PRC_SUPPLIER`, `PRC_CUSTOMER`, etc. | `"PRC_SUPPLIER"`                    |

**5. Accounts Array**

Update existing accounts or add new ones. **Required fields for account updates:** `accountId`, `currencyCode`

| Field              | Type     | Required | Description                    | Example       |
| ------------------ | -------- | -------- | ------------------------------ | ------------- |
| **`accountId`**    | `string` | **Yes**  | Existing account ID to update. | `"acc_12345"` |
| **`currencyCode`** | `string` | **Yes**  | Currency code (ISO 4217).      | `"USD"`       |

**Bank Account Updates**

| Field                    | Type     | Required | Description             | Example          |
| ------------------------ | -------- | -------- | ----------------------- | ---------------- |
| **`bank.name`**          | `string` | No       | Updated bank name.      | `"Updated Bank"` |
| **`bank.number`**        | `string` | No       | Updated account number. | `"987654321"`    |
| **`bank.routingNumber`** | `string` | No       | Updated routing number. | `"021000022"`    |

**Crypto Account Updates**

| Field                                         | Type     | Required | Description                    | Example                 |
| --------------------------------------------- | -------- | -------- | ------------------------------ | ----------------------- |
| **`crypto.address`**                          | `string` | No       | Updated crypto wallet address. | `"0xupdatedAddress..."` |
| **`crypto.additionalInformation.walletType`** | `string` | No       | Updated wallet type.           | `"CPW_INSTITUTION"`     |

**Fiat Account Updates**

| Field                                        | Type     | Required | Description             | Example        |
| -------------------------------------------- | -------- | -------- | ----------------------- | -------------- |
| **`fiat.number`**                            | `string` | No       | Updated account number. | `"987654321"`  |
| **`fiat.swift`**                             | `string` | No       | Updated SWIFT code.     | `"UPDATEDBIC"` |
| **`fiat.routingNumber`**                     | `string` | No       | Updated routing number. | `"021000022"`  |
| **`fiat.additionalInformation.accountType`** | `string` | No       | Updated account type.   | `"SAVING"`     |

***

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

Returns the updated counterparty object with all current information.

**Example Response:**

json

```
{
  "item": {
    "counterpartyId": "cp_12345",
    "customerId": "cust_12345",
    "description": "Updated description for primary electronics supplier",
    "profile": {
      "name": "Tech Supplies Corp Updated",
      "email": "updated-contact@techsupplies.com",
      "phoneNumber": "+19876543211",
      "taxNumber": "TAX-US-12345-UPDATED",
      "dateOfBirth": "1985-05-15T00:00:00Z",
      "address": {
        "addressLine1": "456 Updated Street",
        "addressLine2": "Suite 600",
        "city": "New York",
        "stateIso": "NY",
        "countryIso": "US",
        "postalCode": "10002"
      },
      "website": "https://updated.techsupplies.com",
      "additionalInfo": {
        "type": "CORPORATION",
        "businessLine": "PLB_HIGH_TECH_SOFTWARE_TELECOMS",
        "relationship": "PRC_SUPPLIER"
      },
      "lastname": "Smith"
    },
    "accounts": [
      {
        "accountId": "acc_12345",
        "currencyCode": "USD",
        "status": "ACCEPT",
        "bank": {
          "name": "Updated Bank Name",
          "number": "987654321",
          "address": {
            "addressLine1": "789 Bank Avenue",
            "city": "New York",
            "stateIso": "NY",
            "countryIso": "US",
            "postalCode": "10003"
          },
          "routingNumber": "021000022"
        },
        "fiat": {
          "number": "987654321",
          "routingNumber": "021000022",
          "additionalInformation": {
            "type": "TYPE_FIAT_US",
            "supportedRails": ["ACH", "FEDWIRE", "SWIFT"],
            "accountType": "CHECKING"
          }
        }
      }
    ],
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-05-21T14:20:00Z",
    "customerName": "John Doe"
  }
}
```

***

### **Response Fields**

| Field                        | Type     | Description                                | Example                    |
| ---------------------------- | -------- | ------------------------------------------ | -------------------------- |
| **`item.counterpartyId`**    | `string` | Counterparty ID (unchanged).               | `"cp_12345"`               |
| **`item.customerId`**        | `string` | Customer ID (unchanged).                   | `"cust_12345"`             |
| **`item.customerName`**      | `string` | Customer name (auto-populated).            | `"John Doe"`               |
| **`item.updatedAt`**         | `string` | New update timestamp.                      | `"2024-05-21T14:20:00Z"`   |
| **`item.accounts[].status`** | `string` | Account status (may change after updates). | `"ACCEPT"`, `"MODERATION"` |

***

### **Examples**

#### **Request**

bash

```
curl -X PATCH 'https://stagep.tst-apidmndelss.com/v2/counterparty/cp_12345' \
  -H 'Authorization: 123' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
    "description": "Updated supplier with new contact information",
    "profile": {
      "phoneNumber": "+19876543211",
      "email": "new-contact@supplier.com"
    }
  }'
```

#### **Minimal Update Example**

**Request (update only phone number):**

json

```
{
  "profile": {
    "phoneNumber": "+449876543210"
  }
}
```

**Response:**

json

```
{
  "item": {
    "counterpartyId": "cp_67890",
    "customerId": "cust_22222",
    "description": "Freelance consultant",
    "profile": {
      "name": "Jane",
      "email": "jane@consulting.com",
      "phoneNumber": "+449876543210",
      "taxNumber": "UK123456789",
      "address": {
        "addressLine1": "45 Park Lane",
        "addressLine2": "Flat 3B",
        "city": "London",
        "countryIso": "GB",
        "postalCode": "W1K 7AA"
      },
      "additionalInfo": {
        "type": "INDIVIDUAL",
        "businessLine": "PLB_CONSULTING_PROFESSIONAL_SERVICES",
        "relationship": "PRC_BUSINESS_PARTNER"
      },
      "lastname": "Smith"
    },
    "accounts": [
      {
        "accountId": "acc_77777",
        "currencyCode": "GBP",
        "status": "ACCEPT",
        "fiat": {
          "number": "98765432",
          "sortCode": "40-30-20",
          "additionalInformation": {
            "type": "TYPE_FIAT_GB",
            "supportedRails": ["FPS", "SWIFT"],
            "accountType": "CHECKING"
          }
        }
      }
    ],
    "createdAt": "2024-03-10T14:20:00Z",
    "updatedAt": "2024-05-21T15:30:00Z",
    "customerName": "Sarah Wilson"
  }
}
```

#### **Account Update Example**

**Request (update bank account details):**

json

```
{
  "accounts": [
    {
      "accountId": "acc_88888",
      "currencyCode": "USD",
      "bank": {
        "name": "New Bank Name",
        "number": "555666777",
        "routingNumber": "021000033"
      },
      "fiat": {
        "number": "555666777",
        "routingNumber": "021000033",
        "additionalInformation": {
          "type": "TYPE_FIAT_US",
          "supportedRails": ["ACH", "FEDWIRE"],
          "accountType": "SAVING"
        }
      }
    }
  ]
}
```

#### **Add Crypto Account Example**

**Request (add new crypto account):**

json

```
{
  "accounts": [
    {
      "accountId": "acc_99999",
      "currencyCode": "BTC",
      "crypto": {
        "address": "0x742d35Cc6634C0532925a3b8D6B3985f8e091be1",
        "additionalInformation": {
          "walletType": "CPW_INSTITUTION",
          "type": "TYPE_CRYPTO",
          "supportedRails": ["CRYPTO"]
        }
      }
    }
  ]
}
```

***

### **Error Responses**

1. **Counterparty Not Found**:

   json

   ```
   { "error": "Counterparty not found: cp_99999" }
   ```
2. **Account Not Found**:

   json

   ```
   { "error": "Account not found: acc_99999" }
   ```
3. **Validation Error**:

   json

   ```
   { "error": "Invalid currency code: INVALID_CURRENCY" }
   ```
4. **Unauthorized**:

   json

   ```
   { "error": "Unauthorized" }
   ```

***

### **Notes**

* **Partial Updates**: Only include fields that need to be changed
* **Account Updates**: Use existing `accountId` to update accounts; new accounts without ID will be created
* **Status Impact**: Account updates may trigger re-verification (status change to `MODERATION`)
* **Audit Trail**: `updatedAt` timestamp reflects when changes were applied
* **Field Validation**: All updated fields undergo the same validation as creation

**Update Scenarios**:

* Contact information changes
* Address updates
* Business relationship modifications
* Account detail corrections
* Adding new payment methods/accounts


---

# 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/counterparties/update-counterparty.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.
