How to obtain the user_id so I can issue a logout API call

The site setting logout redirect should point to somewhere no under auth, like your main site homepage or even https://google.com.