钱包 API

账户维度查询#

查询账户维度下所有或某条链的交易历史,按时间顺序倒序排序。

请求路径#

GET https://www.okx.com/api/v5/wallet/post-transaction/transactions

请求参数#

ParameterTypeRequiredDescription
accountIdStringYes账户唯一标识符
chainIndexStringNo链唯一标识, e.g. ETH=3
tokenAddressStringNo代币合约地址。用户筛选指定代币的交易记录
beginStringNo开始时间,查询晚于该时间的交易历史。 Unix 时间戳,用毫秒表示
endStringNo结束时间,查询早于该时间的交易历史。 若 begin 和 end 都不传,查询当前时间以前的交易历史。 Unix 时间戳,用毫秒表示
cursorStringNo游标
limitStringNo返回条数,默认返回最近的 20 条,最多 20 条

响应参数#

ParameterTypeDescription
transactionListArray交易列表
>chainIndexString链ID
>txHashString交易hash
>iTypeStringEVM 交易的层级类型
0:外层主链币转移
1:合约内层主链币转移
2:token转移
>methodIdString方法
>nonceString发起者地址发起的第几笔交易
>txTimeString交易时间;Unix 时间戳的毫秒数格式,如 1597026383085
>fromArray交易输入
>>addressString发送/输入地址,多签交易时,逗号分隔
>>amountString输入数量
>toArray交易输出
>>addressString接收。输出地址,多签交易时,逗号分隔
>>amountString输出数量
>tokenAddressString代币的合约地址
>amountString交易数量
>symbolString交易数量对应的币种
>txFeeString手续费
>txStatusString交易状态、success 成功、fail 失败、pending 等待确认
>hitBlacklistBooleanfalse:未命中黑名单 true:命中黑名单
>tagString黑地址标签类型,包括貔貅盘、网络钓鱼以及合约漏洞等类型
cursorString游标

请求示例#

shell
curl --location --request GET 'https://www.okx.com/api/v5/wallet/post-transaction/transactions?accountId=31f55853-d430-42c5-b4c6-710d39848cd1' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z' \

响应示例#

200
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "cursor": "1724212391",
            "transactionList": [
                {
                    "chainIndex": "0",
                    "txHash": "5fd7e21515b088e2c47641779d53de4ff3b982c7d71a5e85f06f32d8cd4c5bcc",
                    "methodId": "",
                    "nonce": "",
                    "txTime": "1724250342000",
                    "from": [
                        {
                            "address": "bc1pm7fxkgcrqghf2rtxdw4hupvdpqkped7azyrh2mukedrw2p0cj3hsxt8ph3"
                            "amount": "0.000432"
                        }
                    ],
                    "to": [
                        {
                            "address": "bc1pm7fxkgcrqghf2rtxdw4hupvdpqkped7azyrh2mukedrw2p0cj3hsxt8ph3"
                            "amount": "0.00010"
                        },
                        {
                            "address": "bc1pm7fxkgcrqghf2rtxdw4hupvdpqkped7azyrh2mukedrw2p0cj3hsxt8ph3"
                            "amount": "0.00032738"
                        }
                    ],
                    "tokenAddress": "",
                    "amount": "",
                    "symbol": "BTC",
                    "txFee": "0.00000462",
                    "txStatus": "success",
                    "hitBlacklist": false,
                    "tag": "",
                    "iType": ""
                },
                {
                    "chainIndex": "1",
                    "txHash": "0x307ced97491fdeea9acb141cb3d07939ef3291f28c06c0cacd1cc1f8c435bbe1",
                    "methodId": "",
                    "nonce": "945",
                    "txTime": "1724056787000",
                    "from": [
                        {
                            "address": "0x50c476a139aab23fdaf9bca12614cdd54a4244e4"
                            "amount": ""
                        }
                    ],
                    "to": [
                        {
                            "address": "0x2491889438e5130a4cf629fbc93ae31aad742d8b"
                            "amount": ""
                        }
                    ],
                    "tokenAddress": "",
                    "amount": "0.00001",
                    "symbol": "ETH",
                    "txFee": "1.89E-23",
                    "txStatus": "success",
                    "hitBlacklist": false,
                    "tag": "",
                    "iType": "0"
                }
            ]
        }
    ]
}