Documentation Index Fetch the complete documentation index at: https://whitebit-mintlify-fix-broken-links-1777248521.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Create a Flex lending investment, monitor earnings, and withdraw funds — all via API.
Prerequisites
A WhiteBIT account with completed KYC (register )
An API key with Trade permission (create key )
Funds in Main balance (the lending API operates on Main balance, not Trade balance)
HMAC-SHA512 signing configured (authentication guide )
curl and jq installed (for command-line examples)
The quickstart uses Flex plan endpoints, which are available to all authenticated users.
Fixed plan endpoints require B2B partner permissions — see the overview for details.
Fetch available Flex plans
Retrieve the list of available Flex plans to find a plan ID for investment. curl -X POST https://whitebit.com/api/v4/main-account/smart-flex/plans \
-H "Content-Type: application/json" \
-H "X-TXC-APIKEY: YOUR_API_KEY" \
-H "X-TXC-PAYLOAD: YOUR_PAYLOAD" \
-H "X-TXC-SIGNATURE: YOUR_SIGNATURE" \
-d '{"request": "/api/v4/main-account/smart-flex/plans", "nonce": "1709340000000"}'
import requests, json, hmac, hashlib, base64, time
API_KEY = "YOUR_API_KEY"
API_SECRET = "YOUR_SECRET"
BASE_URL = "https://whitebit.com"
def make_request (endpoint, body):
nonce = str ( int (time.time() * 1000 ))
body[ "request" ] = endpoint
body[ "nonce" ] = nonce
data_json = json.dumps(body)
payload = base64.b64encode(data_json.encode())
signature = hmac.new(
API_SECRET .encode(), payload, hashlib.sha512
).hexdigest()
headers = {
"Content-Type" : "application/json" ,
"X-TXC-APIKEY" : API_KEY ,
"X-TXC-PAYLOAD" : payload.decode(),
"X-TXC-SIGNATURE" : signature,
}
return requests.post( f " {BASE_URL}{ endpoint } " , headers = headers, data = data_json)
# Fetch available Flex plans
response = make_request( "/api/v4/main-account/smart-flex/plans" , {})
plans = response.json()
print (json.dumps(plans, indent = 2 ))
For Go and PHP examples, see SDKs . Expected response: [
{
"id" : "8f2e9d3c-1a4b-4c2d-9e5f-6a7b8c9d0e1f" ,
"ticker" : "USDT" ,
"minInvestment" : "10.0" ,
"maxInvestment" : "100000.0" ,
"maxRate" : "0.15"
},
"..."
]
Save the id value from a plan to use in the next step.
Create a Flex investment
Invest into the selected Flex plan using the plan ID from Step 1. curl -X POST https://whitebit.com/api/v4/main-account/smart-flex/investments/invest \
-H "Content-Type: application/json" \
-H "X-TXC-APIKEY: YOUR_API_KEY" \
-H "X-TXC-PAYLOAD: YOUR_PAYLOAD" \
-H "X-TXC-SIGNATURE: YOUR_SIGNATURE" \
-d '{
"plan": "8f2e9d3c-1a4b-4c2d-9e5f-6a7b8c9d0e1f",
"amount": "100.00",
"withReinvest": true,
"request": "/api/v4/main-account/smart-flex/investments/invest",
"nonce": "1709340000001"
}'
# Create a Flex investment (use plan ID from Step 1)
response = make_request( "/api/v4/main-account/smart-flex/investments/invest" , {
"plan" : "8f2e9d3c-1a4b-4c2d-9e5f-6a7b8c9d0e1f" ,
"amount" : "100.00" ,
"withReinvest" : True ,
})
print (response.json())
Required fields: plan (UUID from Step 1), amount (string). Optional: withReinvest (boolean, enables auto-reinvestment).Expected response: {
"data" : {
"transaction_id" : "tx_9f3e0d4c-2b5c-4d3e-8f6g-7a8b9c0d1e2f"
}
}
Check investment status
Verify the investment was created and check the current investment status. curl -X POST https://whitebit.com/api/v4/main-account/smart-flex/investments \
-H "Content-Type: application/json" \
-H "X-TXC-APIKEY: YOUR_API_KEY" \
-H "X-TXC-PAYLOAD: YOUR_PAYLOAD" \
-H "X-TXC-SIGNATURE: YOUR_SIGNATURE" \
-d '{"request": "/api/v4/main-account/smart-flex/investments", "nonce": "1709340000002"}'
# Check active investments
response = make_request( "/api/v4/main-account/smart-flex/investments" , {})
investments = response.json()
print (json.dumps(investments, indent = 2 ))
Expected response: {
"data" : [
{
"id" : "inv_7e2d9c3b-1a4b-4c2d-9e5f-6a7b8c9d0e1f" ,
"planId" : "8f2e9d3c-1a4b-4c2d-9e5f-6a7b8c9d0e1f" ,
"currency" : "USDT" ,
"invested" : "100.00" ,
"withAutoReinvest" : true ,
"status" : 1 ,
"..."
}
],
"..."
}
Withdraw from investment
Withdraw funds from the Flex investment back to Main balance. curl -X POST https://whitebit.com/api/v4/main-account/smart-flex/investments/withdraw \
-H "Content-Type: application/json" \
-H "X-TXC-APIKEY: YOUR_API_KEY" \
-H "X-TXC-PAYLOAD: YOUR_PAYLOAD" \
-H "X-TXC-SIGNATURE: YOUR_SIGNATURE" \
-d '{
"plan": "8f2e9d3c-1a4b-4c2d-9e5f-6a7b8c9d0e1f",
"amount": "50.00",
"request": "/api/v4/main-account/smart-flex/investments/withdraw",
"nonce": "1709340000003"
}'
# Withdraw from Flex investment (partial withdrawal)
response = make_request( "/api/v4/main-account/smart-flex/investments/withdraw" , {
"plan" : "8f2e9d3c-1a4b-4c2d-9e5f-6a7b8c9d0e1f" ,
"amount" : "50.00" ,
})
print (response.json())
Required fields: plan (UUID), amount (string). Partial withdrawals are supported. To withdraw everything, use the full invested amount.Expected response: {
"data" : {
"transaction_id" : "tx_9f3e0d4c-2b5c-4d3e-8f6g-7a8b9c0d1e2f"
}
}
After completing Step 4, the withdrawn amount returns to the Main balance . Verify by checking the Main balance endpoint .
What’s Next
Crypto Lending Overview Plan types, capabilities, and integration patterns.
API Reference Full endpoint documentation for all 13 lending endpoints.
For Go and PHP examples, see SDKs .