Custom Function authentication and POST method

Thank you for your answer. Now everything is clearer to me!
One last question (I tried looking in the documentation but found nothing about it): what does the value “device_id” refer to? What is its functionality? Or rather, what is it usually used for?