Skip to content
twitch.apiv2.0

Reference / API groups

twitch.charity

Charity: the active campaign and its donations.

Every method of twitch.charity, with its parameters, what it returns and the token it needs.

twitch.charity.campaign(params?, options?): Promise<CharityCampaign | null>

Gets the charity campaign a broadcaster is running, or null when there is none. A campaign can no longer be read once it has ended.

Token: user, scope channel:read:charity.

NameTypeDescription
broadcaster_idstringBroadcaster running the campaign. Defaults to the user making the call.

options: Request options for this call: as, token, signal, timeout, retries.

Promise<CharityCampaign \| null>

Fields of CharityCampaign
NameTypeDescription
idstringID of the campaign.
broadcaster_idstringID of the broadcaster running the campaign.
broadcaster_loginstringLogin name of the broadcaster.
broadcaster_namestringDisplay name of the broadcaster.
charity_namestringName of the charity.
charity_descriptionstringWhat the charity does.
charity_logostringURL of the logo of the charity, a 100 by 100 pixels PNG.
charity_websitestringURL of the website of the charity.
current_amountCharityAmountMoney raised so far.
target_amountCharityAmount | nullMoney the broadcaster aims to raise, or null when no goal is set.
const campaign = await twitch.charity.campaign();
if (campaign) console.log(campaign.charity_name, campaign.current_amount.value);

Twitch reference

twitch.charity.donations(params?, options?): Paginator<CharityDonation>

Lists the donations made to the campaign a broadcaster is running. The list is empty when no campaign is active.

Token: user, scope channel:read:charity.

NameTypeDescription
broadcaster_idstringBroadcaster running the campaign. Defaults to the user making the call.
firstnumberItems per page, 1 to 100. Twitch defaults to 20.
afterstringCursor of the next page.

options: Request options for this call: as, token, signal, timeout, retries.

Paginator<CharityDonation>

Fields of CharityDonation
NameTypeDescription
idstringID of the donation, unique across campaigns.
campaign_idstringID of the campaign the money went to.
user_idstringID of the donor.
user_loginstringLogin name of the donor.
user_namestringDisplay name of the donor.
amountCharityAmountMoney given.
for await (const donation of twitch.charity.donations()) {
console.log(donation.user_name, donation.amount.value / 10 ** donation.amount.decimal_places);
}

Twitch reference