I believe there is a non-obvious contstraint on the "bets" parameter here, in that all the bets must have the same query and match_type value.  This should at least be documented, and ideally checked in the implementation.