How to leave a (not owned) project using API?

Is it possible to leave some project (not owned by myself) using the REST / OPEN API
(same action as “leave project” link on project page). The final aim is to script this action.

Thanks for any help.
B.