> ## 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.

# Get Webhook Delivery Logs

> Retrieve delivery logs for a specific webhook endpoint

# Get Webhook Delivery Logs

GET [https://api.baanx.com/v1/webhooks/\{id}/logs](https://api.baanx.com/v1/webhooks/\{id}/logs)
Retrieves delivery logs for a specific webhook endpoint.

## Overview

Returns recent delivery attempts for a webhook endpoint, including HTTP status codes, response bodies, error messages, and response times. Useful for monitoring delivery health and debugging failures.

<Note>
  **Log retention:** Delivery logs are kept for **7 days**. Both successful and failed delivery attempts are included.
</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>

### Path Parameters

<ParamField path="id" type="string (UUID)" required>
  Unique identifier of the webhook configuration
</ParamField>

### Query Parameters

<ParamField query="limit" type="integer" default={50}>
  Maximum number of log entries to return. Range: 1–100.
</ParamField>

### Request Example

<CodeGroup>
  ```bash cURL theme={null} theme={null}
  curl -X GET "https://api.baanx.com/v1/webhooks/550e8400-e29b-41d4-a716-446655440000/logs?limit=25" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```

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

  const response = await fetch(
    `https://api.baanx.com/v1/webhooks/${webhookId}/logs?limit=25`,
    {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
      }
    }
  );

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

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

  webhook_id = "550e8400-e29b-41d4-a716-446655440000"
  url = f"https://api.baanx.com/v1/webhooks/{webhook_id}/logs"
  headers = {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN"
  }
  params = {"limit": 25}

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

  ```typescript TypeScript theme={null} theme={null}
  const getWebhookLogs = async (webhookId: string, limit = 50) => {
    const url = new URL(`https://api.baanx.com/v1/webhooks/${webhookId}/logs`);
    url.searchParams.set('limit', String(limit));

    const response = await fetch(url.toString(), {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
      }
    });

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

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

## Response

### 200 Success

<ResponseField name="count" type="integer">
  Number of log entries returned
</ResponseField>

<ResponseField name="logs" type="array">
  Array of delivery log entries
</ResponseField>

<ResponseField name="logs[].id" type="string (UUID)">
  Unique identifier for this log entry
</ResponseField>

<ResponseField name="logs[].eventId" type="string (UUID)">
  ID of the event that triggered this delivery
</ResponseField>

<ResponseField name="logs[].webhookId" type="string (UUID)">
  ID of the webhook endpoint
</ResponseField>

<ResponseField name="logs[].attemptNumber" type="integer">
  Delivery attempt number (1–6)
</ResponseField>

<ResponseField name="logs[].requestUrl" type="string">
  The URL the webhook was delivered to
</ResponseField>

<ResponseField name="logs[].requestHeaders" type="object">
  HTTP headers sent with the delivery, including `X-Timestamp` and `X-Signature`
</ResponseField>

<ResponseField name="logs[].requestBody" type="object">
  The webhook payload that was sent
</ResponseField>

<ResponseField name="logs[].responseStatus" type="integer | null">
  HTTP status code returned by your endpoint (`null` if the request failed to connect)
</ResponseField>

<ResponseField name="logs[].responseBody" type="string | null">
  Response body returned by your endpoint
</ResponseField>

<ResponseField name="logs[].errorMessage" type="string | null">
  Error message if delivery failed (e.g., connection timeout)
</ResponseField>

<ResponseField name="logs[].deliveryStatus" type="string">
  Delivery status: `pending`, `processing`, `success`, or `failed`
</ResponseField>

<ResponseField name="logs[].durationMs" type="integer | null">
  Response time in milliseconds (`null` if no response received)
</ResponseField>

<ResponseField name="logs[].createdAt" type="string (ISO 8601)">
  Timestamp of this delivery attempt
</ResponseField>

<ResponseField name="logs[].nextRetryAt" type="string (ISO 8601) | null">
  Scheduled time for next retry attempt, if applicable
</ResponseField>

<ResponseExample>
  ```json 200 - Success theme={null} theme={null}
  {
    "count": 2,
    "logs": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "eventId": "660e8400-e29b-41d4-a716-446655440001",
        "webhookId": "770e8400-e29b-41d4-a716-446655440002",
        "attemptNumber": 1,
        "requestUrl": "https://api.partner.com/webhooks/kyc",
        "requestHeaders": {
          "Content-Type": "application/json",
          "X-Timestamp": "1704067200",
          "X-Signature": "abc123def456..."
        },
        "requestBody": {
          "eventType": "kyc.status.changed",
          "userId": "user-123",
          "status": "approved"
        },
        "responseStatus": 200,
        "responseBody": "{\"received\": true}",
        "errorMessage": null,
        "deliveryStatus": "success",
        "durationMs": 145,
        "createdAt": "2025-12-29T10:00:00.000Z",
        "nextRetryAt": null
      },
      {
        "id": "551e8400-e29b-41d4-a716-446655440001",
        "eventId": "661e8400-e29b-41d4-a716-446655440002",
        "webhookId": "770e8400-e29b-41d4-a716-446655440002",
        "attemptNumber": 1,
        "requestUrl": "https://api.partner.com/webhooks/kyc",
        "requestHeaders": {
          "Content-Type": "application/json",
          "X-Timestamp": "1704067500",
          "X-Signature": "xyz789..."
        },
        "requestBody": {
          "eventType": "card.activated",
          "userId": "user-456"
        },
        "responseStatus": 500,
        "responseBody": "Internal Server Error",
        "errorMessage": null,
        "deliveryStatus": "failed",
        "durationMs": 312,
        "createdAt": "2025-12-29T10:05:00.000Z",
        "nextRetryAt": "2025-12-29T10:05:01.000Z"
      }
    ]
  }
  ```
</ResponseExample>

## Error Responses

<ResponseExample>
  ```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": "Webhook config 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` - List all events
* `POST /v1/webhooks/events/{eventId}/retry` - Retry a failed event delivery
* `GET /v1/webhooks/events/{eventId}/logs` - View logs for a specific event
