# 导入账户余额接口

### 接口概述

该接口用于批量导入账户的余额记录，支持一次性导入多个账户、多个币种、多个时间点的余额记录。新增按照**资产代码**传递资产信息的能力。（原有 V3 版本接口，必须使用 Elven 系统的资产 id 来传递资产信息）

* **请求方式**：`POST`
* **请求 URL**：`https://openapi.elven.com/open/v4/account/treasuryBalance`

### 请求头参数

<table><thead><tr><th width="202">参数名</th><th width="90">类型</th><th width="64">必填</th><th>说明</th></tr></thead><tbody><tr><td>elven-api-key</td><td>String</td><td>是</td><td>分配给您的API密钥</td></tr><tr><td>elven-api-sign</td><td>String</td><td>是</td><td>请求签名，用于验证请求合法性</td></tr><tr><td>elven-api-timestamp</td><td>String</td><td>是</td><td>请求时间戳，毫秒级</td></tr></tbody></table>

[查看详细说明](https://docs.elven.com/v3/openapi/jie-kou-shou-quan#elven-api-sign)

### 请求参数

#### Body 参数（JSON 数组）

请求体是一个 JSON 数组，每个元素为一个余额记录对象。

**余额记录对象**

<table><thead><tr><th width="187">参数名</th><th width="95">类型</th><th width="73">必填</th><th>说明</th></tr></thead><tbody><tr><td>entityAccountId</td><td>String</td><td>是</td><td>账户的主键 ID</td></tr><tr><td>sourceId</td><td>String</td><td>否</td><td>存储到哪个余额 source 下<br>不填写时，会自动在对应账户下创建新的余额 source</td></tr><tr><td>assetID</td><td>String</td><td>否</td><td>币种ID，需区分大小写，可从<a href="/pages/VMit0TXQj6EglCd9Ac96">资产查询接口</a>当前 entity 所支持的币种<br><code>assetID</code>和<code>symbol</code> 至少填写一个<br>都填写时，只会识别<code>assetID</code></td></tr><tr><td>symbol</td><td>String</td><td>否</td><td>币种代码，需区分大小写，可从<a href="/pages/VMit0TXQj6EglCd9Ac96">资产查询接口</a>当前 entity 所支持的币种<br><code>assetID</code>和<code>symbol</code> 至少填写一个<br>都填写时，只会识别<code>assetID</code></td></tr><tr><td>datetime</td><td>String</td><td>是</td><td>余额时间，格式为 <code>YYYY-MM-DD HH:mm:ss</code><br>将按照 Entity 设置的时区进行处理</td></tr><tr><td>balance</td><td>Number</td><td>是</td><td>余额数值</td></tr></tbody></table>

#### 请求示例

```json
[
    {
        "entityAccountId": "w597WQZ5SzfKegoGB8qF1XRA2D39dr0U",
        "sourceId": "IH1ty3XJlOuHWDEAsQrTn0xkJ4hS319L",
        "assetID": "BTC",
        "symbol": "",
        "datetime": "2020-01-01 11:11:11",
        "balance": 10
    },
    {
        "entityAccountId": "19jQnm3AQaUGMI6Kn2YvqtN9kje8yXic",
        "sourceId": "IH1ty3XJlOuHWDEAsQrTn0xkJ4h1219L",
        "assetID": "",
        "symbol": "SOL",
        "datetime": "2020-01-01 11:11:11",
        "balance": 10
    }
]
```

### 响应参数

<table><thead><tr><th width="148">参数名</th><th width="137">类型</th><th>说明</th></tr></thead><tbody><tr><td>success</td><td>Boolean</td><td>导入任务是否成功</td></tr></tbody></table>

#### 响应示例

```json
{
    "status": "success",
    "data": true,
    "requestId": "3f785786-a5a4-4907-8674-e6784bcc92ea"
}
```

### 在线调试

您可以通过 Apifox 服务进行接口的在线调试：<https://zswsuv3jhf.apifox.cn/api-253901222>

### 注意事项

* **请求体限制**：每次提交的余额记录条数限制为 **1000** 条。
* **时间格式**：datetime 参数的格式必须严格按照 YYYY-MM-DD HH:mm:ss，否则可能导致解析错误。&#x20;
* **时区说明**：数据导入时，时区将和 Entity 设置的时区保持一致。如原始数据的时区和 Entity 时区不一致，需在导入前处理。


---

# 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.elven.com/v3/chinese/openapi/v4/dao-ru-zhang-hu-yuejie-kou.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.
