andyzinsser andyzinsser - 3 months ago 13
Python Question

Coinbase send_money API always returns "amount is below the current minimum" error

I'm trying to send some btc using an authenticated access_token to another coinbase address. Everything seems to be working, except Coinbase always responds with 'amount below minimum.' Can anyone catch what I'm doing wrong here?

url = "https://coinbase.com/api/v1/transactions/send_money?access_token=XXX"
params = {
"transaction": {
"to": "1G8f9pRvgprVMUymuQugZrhYSqBNXuwzNt",
"amount": "0.011",
"notes": "Testing transaction"
}
}

r = requests.post(url, data=json.dumps(params)


Coinbase returns:

{
"success":false,
"errors":["You must enter a positive amount","This transaction amount is below the current minimum amount to be accepted by the bitcoin network. (0.00005430 BTC)"],
"transaction":{"id":"XXX",
"created_at":null,
"hsh":null,
"notes":null,
"amount":{"amount":"0.00000000","currency":"BTC"},
"request":false,
"status":"pending",
"recipient_address":""
}
}

Answer

Ugh. Forgot to set the headers :(

This works:

url = "https://coinbase.com/api/v1/transactions/send_money?access_token=XXX"
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
params = {
             "transaction": { 
                 "to": "1G8f9pRvgprVMUymuQugZrhYSqBNXuwzNt", 
                 "amount": "0.011", 
                 "notes": "Testing transaction" 
             }
         }

r = requests.post(url, data=json.dumps(postData), headers=headers)