> For the complete documentation index, see [llms.txt](https://docs.compliance.phalcon.blocksec.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/customer/add-transactions-to-a-customer.md).

# 将交易添加到客户

## 将多笔交易批量绑定到客户

> 将已导入交易批量绑定到客户。如果指定的客户 ID 不存在，将自动创建。

```json
{"openapi":"3.0.0","info":{"title":"Compliance API","version":"2.0.0"},"tags":[{"name":"客户","description":"客户画像与关联管理 API。"}],"servers":[{"url":"https://api.blocksec.com/phalcon/compliance/v2","description":"生产环境服务器"}],"security":[{"API-Key":[]}],"components":{"securitySchemes":{"API-Key":{"type":"apiKey","in":"header","name":"API-Key"}},"schemas":{"CustomerAddTransaction":{"type":"object","required":["txHash","chainId"],"properties":{"txHash":{"type":"string","description":"待添加的 txHash。"},"chainId":{"type":"integer","description":"链 ID。关于所有支持的链及对应 chain ID，请查看：[https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/introduction/supported-chains](https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/introduction/supported-chains)。"},"toAddress":{"type":"string","description":"转账地址。"},"transferIndex":{"type":"integer","description":"交易索引。"}}},"CustomerAddTransactionResult":{"type":"object","properties":{"txHash":{"type":"string","description":"待添加的 txHash。"},"chainId":{"type":"integer","description":"链 ID。关于所有支持的链及对应 chain ID，请查看：[https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/introduction/supported-chains](https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/introduction/supported-chains)。"},"toAddress":{"type":"string","description":"转账地址。"},"transferIndex":{"type":"integer","description":"交易索引。"},"status":{"type":"integer"}}}}},"paths":{"/customers/{customer_id}/transactions":{"post":{"tags":["客户"],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string"},"description":"你自己系统中的客户 ID。如果该客户 ID 不存在，将自动创建。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"transactions":{"type":"array","description":"待添加交易列表。","items":{"$ref":"#/components/schemas/CustomerAddTransaction"}}}}}}},"responses":{"200":{"description":"成功响应","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"该请求的状态码。关于所有可能出现的 code 和 message，请查看：[https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/introduction/error-messages](https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/introduction/error-messages)。"},"msg":{"type":"string","description":"该请求的 message。关于所有可能出现的 code 和 message，请查看：[https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/introduction/error-messages](https://docs.compliance.phalcon.blocksec.com/zh/api-documentation/introduction/error-messages)。"},"data":{"type":"object","properties":{"customerId":{"type":"string","description":"客户 ID。"},"transactionCount":{"type":"integer","description":"该客户新增交易数量。"},"addedTransactions":{"type":"array","description":"添加成功的交易列表。","items":{"$ref":"#/components/schemas/CustomerAddTransaction"}},"failed":{"type":"array","description":"添加失败的交易列表。","items":{"$ref":"#/components/schemas/CustomerAddTransactionResult"}}}}}}}}}},"description":"将已导入交易批量绑定到客户。如果指定的客户 ID 不存在，将自动创建。","summary":"将多笔交易批量绑定到客户"}}}}
```
