Skip to main content
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.
1

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"}'
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.
2

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"
  }'
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"
  }
}
3

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"}'
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,
      "..."
    }
  ],
  "..."
}
4

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"
  }'
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.