> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baanx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retry Event Delivery

> Manually trigger a retry of event delivery to webhooks

# Retry Event Delivery

POST [https://api.baanx.com/v1/webhooks/events/\{eventId}/retry](https://api.baanx.com/v1/webhooks/events/\{eventId}/retry)
Manually triggers a retry of event delivery to one or all configured webhook endpoints.

## Overview

Use this endpoint to resend a failed event or to re-deliver an event to a specific webhook. By default, the event is retried to all currently configured and active webhooks. To target a single webhook, include its ID in the request body.

<Note>
  Retrying queues the event for immediate re-delivery. Monitor results using [Get Event Delivery Logs](/api-reference/webhooks/event-logs).
</Note>

## Authentication

This endpoint requires authentication via Bearer token:

```bash theme={null} theme={null}
Authorization: Bearer YOUR_ACCESS_TOKEN
```

## Request

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication
</ParamField>

<ParamField header="Content-Type" type="string">
  Must be `application/json` if providing a request body
</ParamField>

### Path Parameters

<ParamField path="eventId" type="string (UUID)" required>
  Unique identifier of the event to retry
</ParamField>

### Body

The request body is optional. Omit it entirely to retry delivery to all configured webhooks.

<ParamField body="webhookId" type="string (UUID)">
  Optional. If provided, retries delivery only to this specific webhook. If omitted, retries to all active configured webhooks.
</ParamField>

### Request Examples

<CodeGroup>
  ```bash cURL - Retry All theme={null} theme={null}
  curl -X POST https://api.baanx.com/v1/webhooks/events/550e8400-e29b-41d4-a716-446655440000/retry \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```

  ```bash cURL - Retry Specific Webhook theme={null} theme={null}
  curl -X POST https://api.baanx.com/v1/webhooks/events/550e8400-e29b-41d4-a716-446655440000/retry \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "webhookId": "770e8400-e29b-41d4-a716-446655440002"
    }'
  ```

  ```javascript JavaScript theme={null} theme={null}
  const eventId = '550e8400-e29b-41d4-a716-446655440000';

  // Retry to all webhooks
  const response = await fetch(
    `https://api.baanx.com/v1/webhooks/events/${eventId}/retry`,
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
      }
    }
  );

  // Or retry to a specific webhook
  const responseSpecific = await fetch(
    `https://api.baanx.com/v1/webhooks/events/${eventId}/retry`,
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        webhookId: '770e8400-e29b-41d4-a716-446655440002'
      })
    }
  );

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

  ```python Python theme={null} theme={null}
  import requests

  event_id = "550e8400-e29b-41d4-a716-446655440000"
  url = f"https://api.baanx.com/v1/webhooks/events/{event_id}/retry"
  headers = {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN",
      "Content-Type": "application/json"
  }

  # Retry to all webhooks (empty body)
  response = requests.post(url, headers=headers, json={})

  # Or retry to a specific webhook
  response = requests.post(url, headers=headers, json={
      "webhookId": "770e8400-e29b-41d4-a716-446655440002"
  })

  print(response.json())
  ```

  ```typescript TypeScript theme={null} theme={null}
  interface RetryEventRequest {
    webhookId?: string;
  }

  const retryEvent = async (eventId: string, options: RetryEventRequest = {}) => {
    const response = await fetch(
      `https://api.baanx.com/v1/webhooks/events/${eventId}/retry`,
      {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(options)
      }
    );

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    return await response.json();
  };
  ```
</CodeGroup>

## Response

### 200 Success

<ResponseField name="success" type="boolean">
  Indicates the retry was successfully queued
</ResponseField>

<ResponseField name="data.eventId" type="string (UUID)">
  ID of the event being retried
</ResponseField>

<ResponseField name="data.webhookCount" type="integer">
  Number of webhooks the event will be delivered to
</ResponseField>

<ResponseField name="data.message" type="string">
  Human-readable confirmation message
</ResponseField>

<ResponseExample>
  ```json 200 - Retry Queued theme={null} theme={null}
  {
    "success": true,
    "data": {
      "eventId": "550e8400-e29b-41d4-a716-446655440000",
      "webhookCount": 2,
      "message": "Event queued for retry to 2 webhook(s)"
    }
  }
  ```
</ResponseExample>

## Error Responses

<ResponseExample>
  ```json 400 - Validation Error theme={null} theme={null}
  {
    "message": "webhookId must be a valid UUID"
  }
  ```

  ```json 401 - Unauthorized theme={null} theme={null}
  {
    "message": "Not authenticated"
  }
  ```

  ```json 403 - Forbidden theme={null} theme={null}
  {
    "message": "Not authorized"
  }
  ```

  ```json 404 - Not Found theme={null} theme={null}
  {
    "message": "Event not found"
  }
  ```

  ```json 503 - Service Unavailable theme={null} theme={null}
  {
    "message": "Notification service is not configured for this environment"
  }
  ```
</ResponseExample>

## Related Endpoints

* `GET /v1/webhooks/events/{eventId}/status` - Check event status before retrying
* `GET /v1/webhooks/events/{eventId}/logs` - View delivery logs after retrying
* `GET /v1/webhooks/events` - List all events and their statuses
