Contents

Raids

NEW A Raid is a Twitch feature that lets a broadcaster send their viewers over to watch another broadcaster’s stream. Raiding is a great way to make connections and network with other broadcasters by sharing audiences and growing your communities.

To raid another broadcaster

To raid another broadcaster, your chatbot or Extension POSTs a request to the Start a raid endpoint. Set the request’s from_broadcaster_id query parameter to the broadcaster that’s sending the raiding party and set the to_broadcaster_id query parameter to the broadcaster that’s being raided.

curl -X POST 'https://api.twitch.tv/helix/raids?from_broadcaster_id=12345678&to_broadcaster_id=87654321' \
-H 'Authorization: Bearer kpvy3cjboyptmdkiacwr0c19hotn5s' \
-H 'Client-Id: hof5gwx0su6owfnys0nyan9c87zr6t'

The request doesn’t actually start the raid but instead pops up a window at the top of the raiding broadcaster’s chat room that shows the number of viewers in the raid. The raid occurs when the broadcaster clicks Raid Now or after the 90 seconds countdown expires.

Here’s what the response looks like to the previous request:

{
  "data": [
    {
      "created_at": "2022-02-18T07:20:50.52Z",
      "is_mature": false
    }
  ]
}

You can use the is_mature field in the response to let viewers know that the targeted channel contains mature content. The Twitch UX also lets viewers know that the targeted channel restricts chat to subscribers only or followers only. If you want to provide the same information in your experience, use the Get Chat Settings endpoint and check the subscriber_mode and follower_mode fields.

Get notified when a raid begins

The Start a raid response just lets you know that the request was queued. To determine whether the raid actually took place, you must subscribe to the Channel Raid event. For details about subscribing to an event, see EventSub.

To know whether the raid event is for your raid, compare the from and to broadcaster IDs in your request to the from and to IDs in the event.

Canceling the raid

To cancel a raid, send a DELETE request to the Cancel a raid endpoint. You can cancel a raid at any point up until the broadcaster clicks Raid Now in the Twitch UX or the 90 seconds countdown expires.

The following example shows a request that cancels a raid. Set the broadcaster_id query parameter to the ID of the broadcaster that initiated the raid.

curl -X DELETE 'https://api.twitch.tv/helix/raids?broadcaster_id=12345678' \
-H 'Authorization: Bearer kpvy3cjboyptmdkiacwr0c19hotn5s' \
-H 'Client-Id: hof5gwx0su6owfnys0nyan9c87zr6t'

If the raid hasn’t started and the raid was successfully canceled, the HTTP response code is 204 No Content; otherwise, if the raid has already started, the response code is 404 Not Found.

Note that calling this endpoint effectively clicks the Cancel button in the Twitch UX, dismissing the Raid pop up window.