# Get Customer Operation Tree

This provides a complete picture of complex transaction chains, such as multi-step transfers, exchanges with commissions, or operations that spawn additional sub-operations.

**Endpoint**

`GET/v2/billing/operation/{id}/tree`

**Link**

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

### **Request**

#### **Path Parameters**

| Parameter | Type     | Description                            | Required | Example      |
| --------- | -------- | -------------------------------------- | -------- | ------------ |
| **`id`**  | `string` | **Operation ID** to retrieve tree for. | Yes      | `"op_12345"` |

#### **Headers**

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

***

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

Returns a hierarchical structure containing the main operation and all its child operations.

#### **Response Fields**

**1. General Object (Parent Operation)**

Contains the main operation details with the same structure as individual operations, plus additional provider information.

| Field                      | Type      | Description                                 | Example                  |
| -------------------------- | --------- | ------------------------------------------- | ------------------------ |
| **`opid`**                 | `string`  | **Unique operation ID**.                    | `"op_12345"`             |
| **`isVisible`**            | `boolean` | **Visibility status**.                      | `true`                   |
| **`status`**               | `string`  | **Current status**.                         | `"SUCCESS"`              |
| **`type`**                 | `string`  | **Operation type**.                         | `"EXCHANGE"`             |
| **`paymentType`**          | `string`  | **Payment method**.                         | `"EMPTY"`                |
| **`createdAt`**            | `string`  | Creation timestamp.                         | `"2024-05-20T10:30:00Z"` |
| **`updatedAt`**            | `string`  | Last update timestamp.                      | `"2024-05-20T14:45:00Z"` |
| **`source`**               | `object`  | **Source details** with provider info.      | -                        |
| **`destination`**          | `object`  | **Destination details** with provider info. | -                        |
| **`sourceAmount`**         | `object`  | **Source amount**.                          | -                        |
| **`destinationAmount`**    | `object`  | **Destination amount**.                     | -                        |
| **`commissionAmount`**     | `object`  | **Commission amount**.                      | -                        |
| **`currentBalanceAmount`** | `object`  | **Current balance**.                        | -                        |
| **`comment`**              | `string`  | **Operation comment**.                      | `"Currency exchange"`    |
| **`reference`**            | `string`  | **Reference number**.                       | `"REF202405201234"`      |
| **`isParent`**             | `boolean` | **Parent operation flag**.                  | `true`                   |
| **`customer`**             | `object`  | **Customer details**.                       | -                        |
| **`documents`**            | `array`   | **Associated documents**.                   | -                        |

**2. Source/Destination Provider Objects**

Enhanced source/destination objects with provider information:

| Field                    | Type     | Description                                  | Example        |
| ------------------------ | -------- | -------------------------------------------- | -------------- |
| **`account`**            | `string` | **Account ID**.                              | `"acc_12345"`  |
| **`beneficiar`**         | `string` | **Beneficiary ID**.                          | `"benef_abc"`  |
| **`accountProvider`**    | `string` | **Account provider**: `UNSET`, `LAYER2`.     | `"LAYER2"`     |
| **`beneficiarProvider`** | `string` | **Beneficiary provider**: `UNSET`, `LAYER2`. | `"LAYER2"`     |
| **`cuid`**               | `string` | **Customer ID**.                             | `"cust_12345"` |

**3. Childs Array**

Array of child operations with the same structure as the parent operation. Child operations are typically:

* Commission operations
* Fee operations
* Related sub-transactions
* Split payments

**4. Money Object**

Same structure as individual operations for all amount fields.

**Example Response (Exchange Operation with Commission Child):**

```json
{
  "general": {
    "opid": "op_12345",
    "isVisible": true,
    "status": "SUCCESS",
    "type": "EXCHANGE",
    "paymentType": "EMPTY",
    "createdAt": "2024-05-20T10:30:00Z",
    "updatedAt": "2024-05-20T14:45:00Z",
    "source": {
      "account": "acc_usd123",
      "beneficiar": "",
      "accountProvider": "LAYER2",
      "beneficiarProvider": "UNSET",
      "cuid": "cust_12345"
    },
    "destination": {
      "account": "acc_eur456",
      "beneficiar": "",
      "accountProvider": "LAYER2",
      "beneficiarProvider": "UNSET",
      "cuid": "cust_12345"
    },
    "sourceAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "1000",
        "nanos": 0
      }
    },
    "destinationAmount": {
      "sum": {
        "currencyCode": "EUR",
        "units": "920",
        "nanos": 500000000
      }
    },
    "commissionAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "10",
        "nanos": 0
      }
    },
    "currentBalanceAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "15000",
        "nanos": 0
      }
    },
    "comment": "USD to EUR exchange",
    "reference": "EXCH20240520001",
    "isParent": true,
    "customer": {
      "cuid": "cust_12345",
      "name": "Acme Inc."
    },
    "documents": []
  },
  "childs": [
    {
      "opid": "op_12346",
      "isVisible": true,
      "status": "SUCCESS",
      "type": "COMMISSION",
      "paymentType": "EMPTY",
      "createdAt": "2024-05-20T10:30:00Z",
      "updatedAt": "2024-05-20T14:45:00Z",
      "source": {
        "account": "acc_usd123",
        "beneficiar": "",
        "accountProvider": "LAYER2",
        "beneficiarProvider": "UNSET",
        "cuid": "cust_12345"
      },
      "destination": {
        "account": "acc_commission",
        "beneficiar": "",
        "accountProvider": "LAYER2",
        "beneficiarProvider": "UNSET",
        "cuid": "system"
      },
      "sourceAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "10",
          "nanos": 0
        }
      },
      "destinationAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "10",
          "nanos": 0
        }
      },
      "commissionAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "0",
          "nanos": 0
        }
      },
      "currentBalanceAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "14990",
          "nanos": 0
        }
      },
      "comment": "Exchange commission",
      "reference": "COMM20240520001",
      "isParent": false,
      "customer": {
        "cuid": "cust_12345",
        "name": "Acme Inc."
      },
      "documents": []
    }
  ]
}
```

**Example Response (Complex Transfer with Multiple Children):**

```json
{
  "general": {
    "opid": "op_78901",
    "isVisible": true,
    "status": "WORKING",
    "type": "TRANSFER",
    "paymentType": "SWIFT",
    "createdAt": "2024-05-21T09:15:00Z",
    "updatedAt": "2024-05-21T09:15:00Z",
    "source": {
      "account": "acc_12345",
      "beneficiar": "",
      "accountProvider": "LAYER2",
      "beneficiarProvider": "UNSET",
      "cuid": "cust_12345"
    },
    "destination": {
      "account": "",
      "beneficiar": "benef_abc123",
      "accountProvider": "UNSET",
      "beneficiarProvider": "LAYER2",
      "cuid": "cust_12345"
    },
    "sourceAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "5000",
        "nanos": 0
      }
    },
    "destinationAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "5000",
        "nanos": 0
      }
    },
    "commissionAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "25",
        "nanos": 0
      }
    },
    "currentBalanceAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "45000",
        "nanos": 0
      }
    },
    "comment": "International supplier payment",
    "reference": "SWIFT20240521001",
    "isParent": true,
    "customer": {
      "cuid": "cust_12345",
      "name": "Acme Inc."
    },
    "documents": [
      {
        "guid": "doc_abc123",
        "fileName": "invoice.pdf",
        "size": 1024000,
        "mime": "application/pdf",
        "docType": "OPERATION_DOCUMENT",
        "createAt": "2024-05-21T09:10:00Z"
      }
    ]
  },
  "childs": [
    {
      "opid": "op_78902",
      "isVisible": true,
      "status": "SUCCESS",
      "type": "COMMISSION",
      "paymentType": "EMPTY",
      "createdAt": "2024-05-21T09:15:00Z",
      "updatedAt": "2024-05-21T09:15:00Z",
      "source": {
        "account": "acc_12345",
        "beneficiar": "",
        "accountProvider": "LAYER2",
        "beneficiarProvider": "UNSET",
        "cuid": "cust_12345"
      },
      "destination": {
        "account": "acc_fees",
        "beneficiar": "",
        "accountProvider": "LAYER2",
        "beneficiarProvider": "UNSET",
        "cuid": "system"
      },
      "sourceAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "25",
          "nanos": 0
        }
      },
      "destinationAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "25",
          "nanos": 0
        }
      },
      "commissionAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "0",
          "nanos": 0
        }
      },
      "comment": "SWIFT transfer fee",
      "isParent": false,
      "customer": {
        "cuid": "cust_12345",
        "name": "Acme Inc."
      },
      "documents": []
    }
  ]
}
```

***

### **Examples**

#### **Request**

```bash
curl -X GET 'https://stagep.tst-apidmndelss.com/v2/billing/operation/op_12345/tree' \
  -H 'Authorization: Bearer eyJhbGci...wNLGA' \
  -H 'Accept: application/json'
```

***

### **Error Responses**

1. **Operation Not Found**:

   ```json
   { "error": "Operation not found: op_99999" }
   ```
2. **Unauthorized**:

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

***

### **Notes**

* **Hierarchical View**: Provides complete transaction chain visibility
* **Provider Information**: Includes account/beneficiary provider details for multi-provider environments
* **Child Operations**: Automatically generated operations (commissions, fees) appear as children
* **Status Aggregation**: Child operations may have different statuses than parent
* **Audit Trail**: Complete picture of all related financial movements

**Common Parent-Child Relationships**:

* **Exchange** → **Commission** (fee for currency conversion)
* **Transfer** → **Commission** (transfer fee)
* **Withdrawal** → **Commission** (withdrawal fee)
* **Complex transfers** with multiple legs

**Provider Types**:

* `UNSET`: Standard internal accounts
* `LAYER2`: External layer 2 providers or partner systems

Request sample

```postman_json
Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjE2NCwiZXhwIjoxNzYxNjU0NjAxLCJrZXkiOiI1Y2ZiOGZjN2RmYjk4ZjVkYmIyZTgwNTVkZWFhN2U2Zjk4MzEyYmE3Iiwib3RwX3ZlcmlmaWVkIjpmYWxzZX0.VKC2LZ4pP-LGZWkK6wAKMkqU0JFmM9lOmI8EeowOkjM
id*: 8248956e-a002-4404-aafc-be8fd8dc16b6

```

Response sample

```postman_json
{
  "general": {
    "operationId": "8248956e-a002-4404-aafc-be8fd8dc16b6",
    "isVisible": true,
    "status": "PENDING",
    "type": "EXCHANGE",
    "paymentType": "EMPTY",
    "createdAt": "2025-10-28T12:09:33Z",
    "updatedAt": "2025-10-28T12:11:33Z",
    "source": {
      "account": "UjmLCEcZCXzb",
      "beneficiar": "string",
      "accountProvider": "LAYER2",
      "beneficiarProvider": "UNSET",
      "cuid": "D7k3xbc-ERrj-lde9k1t3XuaE"
    },
    "destination": {
      "account": "UrpI6jMzHnsP",
      "beneficiar": "string",
      "accountProvider": "LAYER2",
      "beneficiarProvider": "UNSET",
      "cuid": "D7k3xbc-ERrj-lde9k1t3XuaE"
    },
    "sourceAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "98",
        "nanos": 0
      },
      "default": {
        "currencyCode": "USD",
        "units": "98",
        "nanos": 0
      }
    },
    "destinationAmount": {
      "sum": {
        "currencyCode": "USDT_ERC20",
        "units": "98",
        "nanos": 0
      },
      "default": {
        "currencyCode": "USD",
        "units": "98",
        "nanos": 0
      }
    },
    "commissionAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "2",
        "nanos": 0
      },
      "default": {
        "currencyCode": "USD",
        "units": "2",
        "nanos": 0
      }
    },
    "currentBalanceAmount": {
      "sum": {
        "currencyCode": "USD",
        "units": "835",
        "nanos": 800000002
      },
      "default": {
        "currencyCode": "USD",
        "units": "835",
        "nanos": 800000002
      }
    },
    "comment": "testapi",
    "reference": "string",
    "isParent": false,
    "customer": {
      "id": "D7k3xbc-ERrj-lde9k1t3XuaE",
      "name": ""
    },
    "documents": []
  },
  "childs": [
    {
      "operationId": "8ff0d897-b171-47ca-931c-badbc020ee29",
      "isVisible": false,
      "status": "PENDING",
      "type": "MOVE",
      "paymentType": "EMPTY",
      "createdAt": "2025-10-28T12:09:33Z",
      "updatedAt": "2025-10-28T12:11:33Z",
      "source": {
        "account": "UjmLCEcZCXzb",
        "beneficiar": "string",
        "accountProvider": "LAYER2",
        "beneficiarProvider": "UNSET",
        "cuid": "D7k3xbc-ERrj-lde9k1t3XuaE"
      },
      "destination": {
        "account": "UrpI6jMzHnsP",
        "beneficiar": "string",
        "accountProvider": "LAYER2",
        "beneficiarProvider": "UNSET",
        "cuid": "D7k3xbc-ERrj-lde9k1t3XuaE"
      },
      "sourceAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "98",
          "nanos": 0
        },
        "default": {
          "currencyCode": "USD",
          "units": "98",
          "nanos": 0
        }
      },
      "destinationAmount": {
        "sum": {
          "currencyCode": "USDT_ERC20",
          "units": "98",
          "nanos": 0
        },
        "default": {
          "currencyCode": "USD",
          "units": "98",
          "nanos": 0
        }
      },
      "commissionAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "0",
          "nanos": 0
        },
        "default": {
          "currencyCode": "USD",
          "units": "0",
          "nanos": 0
        }
      },
      "currentBalanceAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "835",
          "nanos": 800000002
        },
        "default": {
          "currencyCode": "USD",
          "units": "835",
          "nanos": 800000002
        }
      },
      "comment": "Move for operation: 8248956e-a002-4404-aafc-be8fd8dc16b6",
      "reference": "string",
      "isParent": false,
      "customer": {
        "id": "D7k3xbc-ERrj-lde9k1t3XuaE",
        "name": ""
      },
      "documents": []
    },
    {
      "operationId": "f8b01976-4e36-46e5-8d3a-f26db8c74b91",
      "isVisible": false,
      "status": "PENDING",
      "type": "COMMISSION",
      "paymentType": "EMPTY",
      "createdAt": "2025-10-28T12:09:33Z",
      "updatedAt": "2025-10-28T12:11:33Z",
      "source": {
        "account": "UjmLCEcZCXzb",
        "beneficiar": "",
        "accountProvider": "LAYER2",
        "beneficiarProvider": "UNSET",
        "cuid": "D7k3xbc-ERrj-lde9k1t3XuaE"
      },
      "destination": {
        "account": "UcJlzOBpEhCE",
        "beneficiar": "",
        "accountProvider": "LAYER2",
        "beneficiarProvider": "UNSET",
        "cuid": "Dnewcvn-euuI-vG0FZCRDjLXS"
      },
      "sourceAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "2",
          "nanos": 0
        },
        "default": {
          "currencyCode": "USD",
          "units": "2",
          "nanos": 0
        }
      },
      "destinationAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "2",
          "nanos": 0
        },
        "default": {
          "currencyCode": "USD",
          "units": "2",
          "nanos": 0
        }
      },
      "commissionAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "0",
          "nanos": 0
        },
        "default": {
          "currencyCode": "USD",
          "units": "0",
          "nanos": 0
        }
      },
      "currentBalanceAmount": {
        "sum": {
          "currencyCode": "USD",
          "units": "835",
          "nanos": 800000002
        },
        "default": {
          "currencyCode": "USD",
          "units": "835",
          "nanos": 800000002
        }
      },
      "comment": "Commission for operation: 8248956e-a002-4404-aafc-be8fd8dc16b6",
      "reference": "",
      "isParent": false,
      "customer": {
        "id": "D7k3xbc-ERrj-lde9k1t3XuaE",
        "name": ""
      },
      "documents": []
    }
  ]
}
```


---

# 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/operations/get-customer-operation-tree.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.
