Embed stream with hosting showing as well

If you want to use an API to check if a channel is hosting another channel, you could use this unsupported, undocumented API endpoint:

https://tmi.twitch.tv/hosts?include_logins=1&host=`:host_id`

Where :host_id is the ID, not the login, of a channel. The target key is the inverse of host and will list channels that is hosting the target ID.

You could also use IRC to automatically trigger the change over to the host. The Javascript library tmi.js can be used here. Hosting event, unhost.

Here is an example for checking if the host “Alca” (ID 7676884) is hosting any other channels in the API:

https://tmi.twitch.tv/hosts?include_logins=1&host=7676884

{
	"hosts": [
		{
			"host_id": 7676884,
			"target_id": 43652530,
			"host_login": "alca",
			"target_login": "angryface13",
			"host_display_name": "Alca",
			"target_display_name": "angryface13"
		}
	]
}

“Alca” is hosting “angryface13” in this example. You could then use the interactive embed to change the channel to the target channel.

If the host is not actively hosting anyone, you will likely get one of these three:

{
	"hosts": [
		{
			"host_id": 7676884,
			"host_login": "alca",
			"host_display_name": "Alca"
		}
	]
}

https://tmi.twitch.tv/hosts?include_logins=1&host=70

{
	"hosts": [
		{
			"host_id": 70
		}
	]
}

https://tmi.twitch.tv/hosts?include_logins=1&host=123456789123456789

{
	"hosts": []
}

Other properties you’ll see for checking against a target ID:

"host_followed": true
"host_partnered": true
"host_recent_chat_activity_count": true