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

# Get Webhook Logs

> Get all webhook logs for a call.

Returns webhook logs if the call belongs to an assistant in your organization.

Retrieve all webhook delivery logs for a specific call. This endpoint provides detailed information about webhook requests sent during the call, including request payloads, response status codes, timing, and any errors.

<Info>
  **Debugging Webhooks**: Use this endpoint to troubleshoot webhook delivery issues, verify that events are being sent correctly, and understand the timing of webhook deliveries during a call.
</Info>

## Path Parameters

| Parameter | Type    | Required | Description                             |
| --------- | ------- | -------- | --------------------------------------- |
| `call_id` | integer | Yes      | The internal call ID (not the call SID) |

## Query Parameters

| Parameter      | Type   | Required | Description                                                               |
| -------------- | ------ | -------- | ------------------------------------------------------------------------- |
| `webhook_type` | string | No       | Filter by webhook type (e.g., `call_started`, `call_ended`, `transcript`) |

## Request

```bash theme={null}
curl "https://api.burki.dev/api/v1/calls/101/webhook-logs" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Filter by Webhook Type

```bash theme={null}
curl "https://api.burki.dev/api/v1/calls/101/webhook-logs?webhook_type=call_ended" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Response

Returns an array of webhook log objects ordered by attempt time.

```json theme={null}
[
  {
    "id": 1,
    "call_id": 101,
    "assistant_id": 123,
    "webhook_url": "https://yourapi.com/webhooks/burki",
    "webhook_type": "call_started",
    "request_payload": {
      "event": "call_started",
      "call_sid": "CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "customer_phone_number": "+15559876543",
      "assistant_id": 123,
      "timestamp": "2024-01-15T10:00:00Z"
    },
    "response_status_code": 200,
    "response_body": "{\"received\": true}",
    "response_time_ms": 145,
    "attempted_at": "2024-01-15T10:00:00Z",
    "success": true,
    "error_message": null,
    "retry_count": 0,
    "webhook_metadata": null
  },
  {
    "id": 2,
    "call_id": 101,
    "assistant_id": 123,
    "webhook_url": "https://yourapi.com/webhooks/burki",
    "webhook_type": "call_ended",
    "request_payload": {
      "event": "call_ended",
      "call_sid": "CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "duration": 180,
      "status": "completed",
      "transcript_summary": "Customer inquired about order status...",
      "timestamp": "2024-01-15T10:03:00Z"
    },
    "response_status_code": 200,
    "response_body": "{\"received\": true}",
    "response_time_ms": 89,
    "attempted_at": "2024-01-15T10:03:01Z",
    "success": true,
    "error_message": null,
    "retry_count": 0,
    "webhook_metadata": null
  }
]
```

## Response Fields

| Field                  | Type    | Description                                          |
| ---------------------- | ------- | ---------------------------------------------------- |
| `id`                   | integer | Unique webhook log ID                                |
| `call_id`              | integer | ID of the parent call                                |
| `assistant_id`         | integer | ID of the assistant that triggered the webhook       |
| `webhook_url`          | string  | The URL where the webhook was sent                   |
| `webhook_type`         | string  | Type of webhook event                                |
| `request_payload`      | object  | The JSON payload sent to the webhook URL             |
| `response_status_code` | integer | HTTP status code returned by your server             |
| `response_body`        | string  | Response body from your server (truncated if large)  |
| `response_time_ms`     | integer | Time taken for your server to respond (milliseconds) |
| `attempted_at`         | string  | When the webhook was attempted (ISO 8601)            |
| `success`              | boolean | Whether the delivery was successful                  |
| `error_message`        | string  | Error message if delivery failed                     |
| `retry_count`          | integer | Number of retry attempts made                        |
| `webhook_metadata`     | object  | Additional metadata about the webhook                |

## Webhook Types

| Type                 | Description                           |
| -------------------- | ------------------------------------- |
| `call_started`       | Sent when a call begins               |
| `call_ended`         | Sent when a call completes            |
| `transcript`         | Sent for real-time transcript updates |
| `tool_call`          | Sent when a tool/function is invoked  |
| `transfer_initiated` | Sent when a call transfer begins      |
| `sms_received`       | Sent when an SMS is received          |

## Error Responses

### 404 Not Found

```json theme={null}
{
  "detail": "Call with ID 101 not found in your organization"
}
```

## Use Cases

### Debug Failed Webhooks

```python theme={null}
import requests

def find_failed_webhooks(call_id):
    response = requests.get(
        f"https://api.burki.dev/api/v1/calls/{call_id}/webhook-logs",
        headers={"Authorization": "Bearer YOUR_API_KEY"}
    )
    
    logs = response.json()
    
    failed = [log for log in logs if not log["success"]]
    
    for log in failed:
        print(f"Failed webhook: {log['webhook_type']}")
        print(f"  URL: {log['webhook_url']}")
        print(f"  Error: {log['error_message']}")
        print(f"  Status Code: {log['response_status_code']}")
        print(f"  Retries: {log['retry_count']}")
        print()
    
    return failed
```

### Monitor Webhook Latency

```python theme={null}
def analyze_webhook_performance(call_id):
    response = requests.get(
        f"https://api.burki.dev/api/v1/calls/{call_id}/webhook-logs",
        headers={"Authorization": "Bearer YOUR_API_KEY"}
    )
    
    logs = response.json()
    
    successful_logs = [log for log in logs if log["success"]]
    
    if not successful_logs:
        return None
    
    response_times = [log["response_time_ms"] for log in successful_logs]
    
    return {
        "avg_response_time_ms": sum(response_times) / len(response_times),
        "max_response_time_ms": max(response_times),
        "min_response_time_ms": min(response_times),
        "total_webhooks": len(successful_logs)
    }
```

### Verify Webhook Delivery

```python theme={null}
def verify_webhook_delivery(call_id, expected_types):
    """Verify that all expected webhook types were delivered successfully."""
    response = requests.get(
        f"https://api.burki.dev/api/v1/calls/{call_id}/webhook-logs",
        headers={"Authorization": "Bearer YOUR_API_KEY"}
    )
    
    logs = response.json()
    
    delivered_types = set(
        log["webhook_type"] for log in logs if log["success"]
    )
    
    missing = set(expected_types) - delivered_types
    
    return {
        "all_delivered": len(missing) == 0,
        "delivered": list(delivered_types),
        "missing": list(missing)
    }

# Example usage
result = verify_webhook_delivery(101, ["call_started", "call_ended"])
print(f"All webhooks delivered: {result['all_delivered']}")
```

## Notes

* Webhooks are only sent if you have configured a `webhook_url` on your assistant
* Failed webhooks are automatically retried up to 3 times with exponential backoff
* Response bodies larger than 10KB are truncated in the logs
* Webhook logs are retained for 30 days


## OpenAPI

````yaml GET /api/v1/calls/{call_id}/webhook-logs
openapi: 3.1.0
info:
  title: Burki
  description: A system that uses AI to answer customer Calls.
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/calls/{call_id}/webhook-logs:
    get:
      tags:
        - calls
      summary: Get Call Webhook Logs
      description: >-
        Get all webhook logs for a call.


        Returns webhook logs if the call belongs to an assistant in your
        organization.
      operationId: get_call_webhook_logs_api_v1_calls__call_id__webhook_logs_get
      parameters:
        - name: call_id
          in: path
          required: true
          schema:
            type: integer
            title: Call Id
        - name: webhook_type
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by webhook type
            title: Webhook Type
          description: Filter by webhook type
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WebhookLogResponse'
                title: >-
                  Response Get Call Webhook Logs Api V1 Calls  Call Id  Webhook
                  Logs Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    WebhookLogResponse:
      properties:
        webhook_url:
          type: string
          title: Webhook Url
        webhook_type:
          type: string
          title: Webhook Type
        request_payload:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Request Payload
        response_status_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Response Status Code
        response_body:
          anyOf:
            - type: string
            - type: 'null'
          title: Response Body
        response_time_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Response Time Ms
        attempted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Attempted At
        success:
          type: boolean
          title: Success
          default: false
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
        retry_count:
          type: integer
          title: Retry Count
          default: 0
        webhook_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Webhook Metadata
        id:
          type: integer
          title: Id
        call_id:
          type: integer
          title: Call Id
        assistant_id:
          type: integer
          title: Assistant Id
      type: object
      required:
        - webhook_url
        - webhook_type
        - id
        - call_id
        - assistant_id
      title: WebhookLogResponse
      description: Schema for webhook log response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````