How to change file permission like read only using api

Is there any way we can update the file permission like read only by hitting the curl in our terminal ?
I tried many , even from the doc but non worked… We want to make file readable and unreadable by hitting api using curl.

Thanks in Advanced