Yep, absolutely right. This is just running on my laptop so there's no other user, but a server-based solution should absolutely hit the API using something like Faraday[1] or requests[2].
I think there's an even easier fix here; you can solve it by getting curl to read the form parameters from a file (I'm not 100% sure, the manpage seems to suggest that -F can take a file source, but it might just be referring to how to upload an entire file?)
Of course, the script could be running on a machine with only one user, so there might be no problem for this specific case. But it's just good practice to avoid creating potential security holes.