OAuth 2.0 APIs for Binance APIs

API 1. Get user info#

scope must contain user:email

GET https://accounts.binance.com/oauth-api/user-info

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES

Response:

{
"code": "000000",
"message": null,
"data": {
"userId": "e10e20b7f20947e7bd206b15ce3dae90",
"email": "xx@xx.com"
},
"success": true
}

API 2. Get user status info#

scope must contain user:status

GET https://accounts.binance.com/oauth-api/v1/user-status

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES

Response:

{
"code": "000000",
"message": null,
"data": {
"disabled": false,
"certificateType": 1,
"certificateStatus": 1
},
"success": true
}
certificateTypeDescription
1Person
2Company
certificateStatusDescription
0kyc not done or in approving
1kyc pass
2kyc reject

API 3. Get user charge address#

scope must contain use:address

GET https://accounts.binance.com/oauth-api/v1/get-charge-address

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES
coinStringYESe.g. BTC , BNB
networkStringYESYou can get coin support network from https://www.binance.com/gateway-api/v1/public/capital/getNetworkCoinAll

Response:

{
"code": "000000",
"message": null,
"data": {
"coin": "BTC",
"address": "112tfsHDk6Yk8PbNnTVkv7yPox4aWYYDtW",
"tag": "",
"url": "https://btc.com/112tfsHDk6Yk8PbNnTVkv7yPox4aWYYDtW",
"time": 1566366289000
},
"success": true
}

API 4. Get user asset balance#

scope must contain asset:balance

GET https://accounts.binance.com/oauth-api/v1/balance

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES

Response:

{
"code": "000000",
"message": null,
"data": [
{
"asset": "ADA",
"free": "0.00000000",
"locked": "0.00000000",
"freeze": "0.00000000",
"withdrawing": "0.00000000",
"btcValuation": "0.00000000",
"fiatValuation": "0.0"
},
{
"asset": "BUSD",
"free": "10000.00000000",
"locked": "0.00000000",
"freeze": "0.00000000",
"withdrawing": "0.00000000",
"btcValuation": "0.00000000",
"fiatValuation": "0.000000000"
},
{
"asset": "USDT",
"free": "999819.04708000",
"locked": "560.99992000",
"freeze": "17825.08000000",
"withdrawing": "0.00000000",
"btcValuation": "14340.91011123",
"fiatValuation": "1018204.61789743650000000"
}
],
"success": true
}

Step 5. Get support convert coin list#

scope must contain asset:ocbs

GET https://accounts.binance.com/oauth-api/v1/ocbs/support-coins

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES

Response:

{
"code": "000000",
"message": null,
"data": [
{
"assetCode": "BNB",
"assetName": "BNB",
"logoUrl": "https://static.devfdg.net/static/images/home/coin-logo/BNB.png",
"size": "8",
"order": 3,
"subSelector": [
{
"assetCode": "TRX",
"assetName": "TRX",
"logoUrl": "",
"size": "8",
"order": 20,
"perTimeMinLimit": 100.0,
"perTimeMaxLimit": 10000.0,
"dailyMaxLimit": 100000.0,
"hadDailyLimit": 0,
"needMarket": true,
"feeType": 1,
"feeRate": 0.08,
"fixFee": 13.0,
"forexRate": 1.0,
"expireTime": 60
}
],
"freeAsset": 101100047.0
},
{
"assetCode": "PAX",
"assetName": "PAX",
"logoUrl": "https://static.devfdg.net/static/images/home/coin-logo/BTC.png",
"size": "8",
"order": 10,
"subSelector": [
{
"assetCode": "BUSD",
"assetName": "BUSD",
"logoUrl": "https://static.devfdg.net/static/images/home/coin-logo/BTC.png",
"size": "8",
"order": 10,
"perTimeMinLimit": 10.0,
"perTimeMaxLimit": 1000.0,
"dailyMaxLimit": 10000.0,
"hadDailyLimit": 0,
"needMarket": false,
"feeType": 1,
"feeRate": 0.02,
"fixFee": 5.0,
"forexRate": 0.77777777,
"expireTime": 60
}
],
"freeAsset": 0
}
],
"success": true
}

Step 6. Coin convert quote#

scope must contain asset:ocbs

POST https://accounts.binance.com/oauth-api/v1/ocbs/quote

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES
fromAssetStringYES
toAssetStringYES
baseAssetStringYESindicate amount is about fromAsset or toAsset
amountStringYES

Example: If you want convert 10 amount BNB to BTC fromAsset=BNB, toAsset=BTC,baseAsset=BNB,amount=10 If you want convert BNB to 10 amount BTC fromAsset=BNB, toAsset=BTC,baseAsset=BTC,amount=10

Response:

{
"code": "000000",
"message": null,
"data": {
"quoteId": "b5481fb7f8314bb2baf55aa6d4fcf068",
"quotePrice": 1094.01086957,
"tradeFee": 8,
"railFee": 0,
"totalFee": 8,
"totalAmount": 100649,
"showPrice": 1094.01086957
},
"success": true
}

Step 7. Coin convert confirm#

scope must contain asset:ocbs

POST https://accounts.binance.com/oauth-api/v1/ocbs/confirm

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES
quoteIdStringYES

Response:

{
"code": "000000",
"message": null,
"data": {
"quoteId": "b5481fb7f8314bb2baf55aa6d4fcf068",
"status": "FAIL",
"orderId": "ab0ab6cfd62240d79e10347fc5000bc4",
"fromAsset": "BNB",
"toAsset": "TRX",
"sourceAmount": 100,
"obtainAmount": 100649,
"tradeFee": 8,
"price": 1094.01086957,
"feeType": 1,
"feeRate": 0.08,
"fixFee": 13.0
},
"success": true
}

Step 8. Query coin convert history#

scope must contain asset:ocbs

GET https://accounts.binance.com/oauth-api/v1/ocbs/convert-history

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES
orderIdStringNO
statusStringNO
quoteIdStringNO
startDateDateNO
endDateDateNO
fromAssetStringNO
toAssetStringNO
completedStartTimeDateNO
completedEndTimeDateNO
pageIntegerYESMin value is 1
rowsIntegerYESMax value is 2000

Response:

{
"code": "000000",
"message": null,
"data": [
{
"orderId": "ab0ab6cfd62240d79e10347fc5000bc4",
"fromAsset": "BNB",
"toAsset": "TRX",
"sourceAmount": 100.0,
"obtainAmount": 100649.0,
"tradeFee": 8.0,
"price": 1094.01086957,
"time": 1581502638000,
"status": "FAIL"
},
{
"orderId": "1d53339c4458403ca15a001a4bdc1738",
"fromAsset": "USDT",
"toAsset": "BUSD",
"sourceAmount": 100.0,
"obtainAmount": 88.95,
"tradeFee": 11.0,
"price": 0.9994382,
"time": 1581398015000,
"status": "WAIT_MARKET"
}
],
"total": 2,
"success": true
}

Step 9. Revoke access_token#

scope must contain user:email

POST https://accounts.binance.com/oauth-api/v1/revoke-token

Parameters:

NameTypeMandatoryDescription
access_tokenStringYES

Response:

{
"code": "000000",
"message": null,
"data": true, // true means clear access_token success
"success": true
}