API: Deposit into pot - PUT


I’m trying to do a PUT request to transfer money from my main account into a POT.

This is all I can get in response - regardless of what I try.

{“code”:“bad_request.bad_param.amount”,“message”:“must be greater than 0”}

Has anyone had any luck with this; wonder if I’m missing something. But as far as I can see I’m transferring all the correct variables in the request body etc.

This is the body (i’ve changed the source account id for security reasons).

‘[‘amount’=>‘11’,‘source_account_id’=>‘acc_0000xxxxxxxxxxxxxx’, ‘dedupe_id’=>‘112’];’


I wonder if it’s an issue with transfers below £1 with the API? Have you tried a value greater than 11p?

You are providing amount as a string, try removing the quotes. Amount is a 64bit integer.

1 Like

Yep - tried that. Still nothing!

Just tried to transfer 111 (i.e. 1.11) and that’s not working neither.

I’m transferring my authorization key as a header, and the params in the body. But I’ve tried to also pass the params in the header and that’s not working either.

I’ve also just posted some source-code on Slack.

{POTID} and {ACCOUNTID} removed below.


$url = 'https://api.monzo.com/pots/{POTID}/deposit';
$data = ['amount'=>11,'source_account_id'=>'{ACCOUNTID}', 'dedupe_id'=>'112'];
$data_json = json_encode($data);

echo $data_json;

$post_data = $data;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_PUT, 1);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	'Authorization: Bearer ' . $token));

curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

$output = curl_exec($ch);


I’ve just tried this and it works fine for me. What if you just send the raw data:



Same story…

Really doesn’t make sense at all…

Full _REQUEST dump: {"code":"bad_request.bad_param.amount","message":"must be greater than 0"}

Ah, you’re using cURL. You need to convert the POST data into a string and send that in CURLOPT_POSTFIELDS.

To your code add:

$data_string = http_build_query($data, '', '&');


curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

Edit: I’ve tested this and it works. See https://pastebin.com/F9afYrUH


Absolute hero. Knew it would be something simple.

Thanks so much :slight_smile:

Glad you got it sorted, happy coding! :slightly_smiling_face:

Consider using a sane HTTP client library which will do all this request body encoding automatically for you in the future. :wink:


Certainly this for anything serious/production.

1 Like