API to create / publish / end streams

Thanks @BarryCarlyon. Do you know how I can get the stream_key programmatically? I’m trying to build an app that users can log in with their Twitch credentials and start broadcasting without manual setup. Essentially I would like to setup an OAuth flow (see image below), get the stream_key and ingest url, also connect to chats. API docs don’t seem to have these details.

image