# Reroll (/api/events/giveaways/reroll)



## Event Type [#event-type]

```ts
"giveaway.reroll"
```

## Description [#description]

This event is triggered when winners are rerolled, from the bot or from the dashboard. It carries only the winners this reroll drew. The winners the giveaway ended with went out with [`giveaway.end`](/api/events/giveaways/end).

## Payload Structure [#payload-structure]

<TypeTable
  type="{
  giveawayId: {
    description: 'Unique identifier for the giveaway',
    type: 'string',
  },
  prize: {
    description: 'The prize as it is written on the giveaway message',
    type: 'string',
  },
  channelId: {
    description: 'Discord channel the giveaway was posted in',
    type: 'string',
  },
  messageId: {
    description: 'Discord message ID of the giveaway message',
    type: 'string',
  },
  messageUrl: {
    description: 'Direct link to the giveaway message',
    type: 'string',
  },
  newWinners: {
    description: 'Discord user IDs of the winners drawn by this reroll',
    type: 'string[]',
  },
}"
/>

## Example Payload [#example-payload]

```json
{
  "type": "giveaway.reroll",
  "payload": {
    "giveawayId": "hT7pLm2Qa9",
    "prize": "Nitro Classic",
    "channelId": "1140972530400776294",
    "messageId": "1141002938471829504",
    "messageUrl": "https://discord.com/channels/1140972530400776290/1140972530400776294/1141002938471829504",
    "newWinners": ["1140972530400776299"]
  }
}
```

## Example Usage [#example-usage]

```ts
app.post('/webhook', (req, res) => {
  const { type, payload } = req.body;

  if (type === 'giveaway.reroll') {
    console.log(`Rerolled ${payload.prize}`);

    // Hand the prize to whoever replaced the old winner
    for (const userId of payload.newWinners) {
      await grantReward(userId, payload.prize);
    }
  }

  res.status(200).send('OK');
});
```

## Use Cases [#use-cases]

* Hand a prize to a replacement winner without watching Discord
* Keep an external winner list in sync after a reroll
* Audit how often winners are rerolled
