# Resend failed webhook events

> Source: https://truto.one/docs/api-reference/admin/webhook-events/resend/

`POST /webhook-event/resend`

Resource: **Webhook Events**

## Request body

- **`environment_id`** _(string)_
  The environment whose events to resend. Required when you call with a dashboard session; an API token uses its own environment.
- **`ids`** _(array<string>)_
  The events to resend, in this order. Ones that are not failed are skipped.
- **`webhook_id`** _(string)_
  Resend the failed events for this webhook.
- **`integrated_account_id`** _(string)_
  Resend the failed events about this integrated account.
- **`event`** _(string)_
  Resend the failed events of this type.
- **`created_at`** _(object)_
  Resend the failed events created in this window.
  - **`gt`** _(string)_
    Created after this time (ISO 8601, compared to the second).
  - **`lt`** _(string)_
    Created before this time (ISO 8601, compared to the second).
- **`next_cursor`** _(string)_
  The `next_cursor` of the previous call with the same `ids` or filters.

## Response body

- **`resent`** _(integer)_
  How many failed events this call sent back to `pending`.
- **`has_more`** _(boolean)_
  Whether more of the events you selected are still to be resent.
- **`next_cursor`** _(string)_
  Pass this with the same `ids` or filters to carry on; `null` when `has_more` is `false`.

## Code examples

### curl

```bash
curl -X POST 'https://api.truto.one/webhook-event/resend' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "environment_id": "your_environment_id",
  "ids": [],
  "webhook_id": "your_webhook_id",
  "integrated_account_id": "your_integrated_account_id",
  "event": "integrated_account:created",
  "created_at": {},
  "next_cursor": "your_next_cursor"
}'
```

### JavaScript

```javascript
const body = {
  "environment_id": "your_environment_id",
  "ids": [],
  "webhook_id": "your_webhook_id",
  "integrated_account_id": "your_integrated_account_id",
  "event": "integrated_account:created",
  "created_at": {},
  "next_cursor": "your_next_cursor"
};

const response = await fetch('https://api.truto.one/webhook-event/resend', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/webhook-event/resend"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "environment_id": "your_environment_id",
    "ids": [],
    "webhook_id": "your_webhook_id",
    "integrated_account_id": "your_integrated_account_id",
    "event": "integrated_account:created",
    "created_at": {},
    "next_cursor": "your_next_cursor"
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())
```
