How do your guys request POST /sapi/v1/lending/auto-invest/plan/add (HMAC SHA256) ?

I followed the doc, but why always get signature error. I could request other endpoints normally. So there should not the problem of signature method.

And how should I set “details” parameter?

I have tried this, but not success.

https://api.binance.com/sapi/v1/lending/auto-invest/plan/add?UID=******&sourceType=MAIN_SITE&planType=SINGLE&subscriptionAmount=10&subscriptionCycle=MONTHLY&subscriptionStartDay=1&subscriptionStartTime=1&sourceAsset=USDT&details=[{'percentage'%3A+100%2C+'targetAsset'%3A+'BTC'}]&recvWindow=60000&timestamp=1687419105018&signature=

anyone know?

Also tested the details[0].targetAsset and details[0].percentage

Hi there,

What error are you getting exactly? According to the documentation for this endpoint here: Binance API Documentation the way I interpret the parameters is as follows:

params = {
    'UID': 'YOUR_USER_ID',
    'sourceType': 'MAIN_SITE',
    'planType': 'SINGLE',
    'subscriptionAmount': 100.0,
    'subscriptionCycle': 'WEEKLY',
    'subscriptionStartTime': 1,
    'sourceAsset': 'USDT',
    'flexibleAllowedToUse': true,
    'details[0].targetAsset': 'BTC',
    'details[0].percentage': '60',
    'details[1].targetAsset': 'ETH',
    'details[1].percentage': '40',
    'timestamp': int(time.time() * 1000)
}

Let us know if that doesn’t work as it’s untested.

yeah, I also tried this, it shows signature error, {“code”:-1022,“msg”:“Signature for this request is not valid.”}

But I could query other endpoints normally, like this one, /sapi/v1/lending/auto-invest/source-asset/list

I got the request like this,
https://api.binance.com/sapi/v1/lending/auto-invest/plan/add?UID=*****&sourceType=MAIN_SITE&planType=SINGLE&subscriptionAmount=100.0&subscriptionCycle=WEEKLY&subscriptionStartTime=1&sourceAsset=USDT&flexibleAllowedToUse=True&details%5B0%5D.targetAsset=BTC&details%5B0%5D.percentage=60&details%5B1%5D.targetAsset=ETH&details%5B1%5D.percentage=40&timestamp=1687484768479&signature=7aa173e93cd05cd5fd554a92c69f53c41c3ec7e0d16ed******

Any problem?

Same issue here

But according documentation ‘subscriptionAmount’ should have 4 decimal number, like “100.0000”

But nothing works here too