# Webhook Deliveries

## List webhook delivery history

**get** `/v1/webhook_deliveries`

Lists webhook deliveries and their retained applied attempts, newest
delivery first. Without an exact `delivery_id`, `event_id`, or `trace_id`
lookup, the time window defaults to the latest 24 hours and cannot exceed
30 days. Exact identifiers may reach older retained evidence.

Successful delivery detail becomes eligible for sweeping after 30 days;
failed evidence may remain longer. The response therefore publishes an
inclusive successful-history incompleteness horizon and the instant when
attempt-history collection began. Neither is a blanket retention promise.

`spent_attempt_count` can exceed `observed_attempt_count` when an attempt
ends without a retained verdict. Such a gap is reported, never filled with
an invented attempt result. Payloads, bodies, headers, credentials,
signatures, diagnostic errors and destination URL paths are never returned.

### Query Parameters

- `cursor: optional string`

- `delivery_id: optional string`

- `endpoint_id: optional string`

- `event_id: optional string`

- `event_kind: optional string`

- `from: optional string`

- `limit: optional number`

- `outcome: optional string`

- `to: optional string`

- `trace_id: optional string`

### Returns

- `DeliveryPage object { attempt_history_coverage_started_at, data, has_more, 3 more }`

  A bounded page of webhook deliveries. Parent deliveries are never split across pages.

  - `attempt_history_coverage_started_at: string`

    Inclusive instant when attempt-history collection began. Earlier deliveries cannot claim complete attempt history.

  - `data: array of Delivery`

    - `id: string`

    - `attempt_history_complete: boolean`

      True only when every spent attempt has a retained applied verdict and collection covered this delivery from creation.

    - `attempts: array of DeliveryAttempt`

      - `attempt: number`

        The spent attempt number. Gaps mean a lease expired without an applied verdict.

      - `attempt_completed_at: string`

      - `attempt_started_at: string`

      - `destination: string`

        Scheme, host and effective port only. Path, query, fragment and credentials are never returned.

      - `http_status: number`

        Response status, or `null` when no response was received.

      - `phase: string`

        `pre_dial` when no request began, or `wire` after the HTTP round trip began.

      - `reason_code: string`

        A bounded machine reason. Treat unknown values as `unknown`.

      - `verdict: string`

        `delivered`, `retryable`, or `permanent`. Treat unknown values as an unavailable verdict.

      - `wire_completed_at: string`

      - `wire_duration_ms: number`

      - `wire_started_at: string`

      - `trace_id: optional string`

        W3C trace id when one was recorded. Correlation only; never authorization.

    - `created_at: string`

    - `endpoint_id: string`

    - `event_id: string`

    - `event_kind: string`

    - `observed_attempt_count: number`

      Applied attempt verdicts retained below.

    - `seq_from: number`

    - `seq_to: number`

    - `spent_attempt_count: number`

      Attempts spent by the delivery machine, including leases that expired without an applied verdict.

    - `state: string`

      `pending`, `delivering`, `delivered`, `permanent_refusal`, or `retry_exhausted`.

    - `chat_id: optional string`

  - `has_more: boolean`

  - `older_successful_history_may_have_been_swept: boolean`

    True when successful delivery detail may have been swept from this account partition.

  - `successful_history_incomplete_through: string`

    Inclusive creation-time horizon through which successful delivery detail may be incomplete.

  - `next_cursor: optional string`

### Example

```http
curl https://whatsapp.messages.api.linqapp.com/v1/webhook_deliveries \
    -H "Authorization: Bearer $LINQ_WHATSAPP_API_KEY"
```

#### Response

```json
{
  "attempt_history_coverage_started_at": "2019-12-27T18:11:19.117Z",
  "data": [
    {
      "id": "id",
      "attempt_history_complete": true,
      "attempts": [
        {
          "attempt": 0,
          "attempt_completed_at": "2019-12-27T18:11:19.117Z",
          "attempt_started_at": "2019-12-27T18:11:19.117Z",
          "destination": "destination",
          "http_status": 0,
          "phase": "phase",
          "reason_code": "reason_code",
          "verdict": "verdict",
          "wire_completed_at": "2019-12-27T18:11:19.117Z",
          "wire_duration_ms": 0,
          "wire_started_at": "2019-12-27T18:11:19.117Z",
          "trace_id": "trace_id"
        }
      ],
      "created_at": "2019-12-27T18:11:19.117Z",
      "endpoint_id": "endpoint_id",
      "event_id": "event_id",
      "event_kind": "event_kind",
      "observed_attempt_count": 0,
      "seq_from": 0,
      "seq_to": 0,
      "spent_attempt_count": 0,
      "state": "state",
      "chat_id": "chat_id"
    }
  ],
  "has_more": true,
  "older_successful_history_may_have_been_swept": true,
  "successful_history_incomplete_through": "2019-12-27T18:11:19.117Z",
  "next_cursor": "next_cursor"
}
```

## Domain Types

### Delivery

- `Delivery object { id, attempt_history_complete, attempts, 10 more }`

  One webhook delivery and every retained applied attempt belonging to it.

  - `id: string`

  - `attempt_history_complete: boolean`

    True only when every spent attempt has a retained applied verdict and collection covered this delivery from creation.

  - `attempts: array of DeliveryAttempt`

    - `attempt: number`

      The spent attempt number. Gaps mean a lease expired without an applied verdict.

    - `attempt_completed_at: string`

    - `attempt_started_at: string`

    - `destination: string`

      Scheme, host and effective port only. Path, query, fragment and credentials are never returned.

    - `http_status: number`

      Response status, or `null` when no response was received.

    - `phase: string`

      `pre_dial` when no request began, or `wire` after the HTTP round trip began.

    - `reason_code: string`

      A bounded machine reason. Treat unknown values as `unknown`.

    - `verdict: string`

      `delivered`, `retryable`, or `permanent`. Treat unknown values as an unavailable verdict.

    - `wire_completed_at: string`

    - `wire_duration_ms: number`

    - `wire_started_at: string`

    - `trace_id: optional string`

      W3C trace id when one was recorded. Correlation only; never authorization.

  - `created_at: string`

  - `endpoint_id: string`

  - `event_id: string`

  - `event_kind: string`

  - `observed_attempt_count: number`

    Applied attempt verdicts retained below.

  - `seq_from: number`

  - `seq_to: number`

  - `spent_attempt_count: number`

    Attempts spent by the delivery machine, including leases that expired without an applied verdict.

  - `state: string`

    `pending`, `delivering`, `delivered`, `permanent_refusal`, or `retry_exhausted`.

  - `chat_id: optional string`

### Delivery Attempt

- `DeliveryAttempt object { attempt, attempt_completed_at, attempt_started_at, 9 more }`

  One applied attempt to deliver an account event to a webhook endpoint.

  - `attempt: number`

    The spent attempt number. Gaps mean a lease expired without an applied verdict.

  - `attempt_completed_at: string`

  - `attempt_started_at: string`

  - `destination: string`

    Scheme, host and effective port only. Path, query, fragment and credentials are never returned.

  - `http_status: number`

    Response status, or `null` when no response was received.

  - `phase: string`

    `pre_dial` when no request began, or `wire` after the HTTP round trip began.

  - `reason_code: string`

    A bounded machine reason. Treat unknown values as `unknown`.

  - `verdict: string`

    `delivered`, `retryable`, or `permanent`. Treat unknown values as an unavailable verdict.

  - `wire_completed_at: string`

  - `wire_duration_ms: number`

  - `wire_started_at: string`

  - `trace_id: optional string`

    W3C trace id when one was recorded. Correlation only; never authorization.

### Delivery Page

- `DeliveryPage object { attempt_history_coverage_started_at, data, has_more, 3 more }`

  A bounded page of webhook deliveries. Parent deliveries are never split across pages.

  - `attempt_history_coverage_started_at: string`

    Inclusive instant when attempt-history collection began. Earlier deliveries cannot claim complete attempt history.

  - `data: array of Delivery`

    - `id: string`

    - `attempt_history_complete: boolean`

      True only when every spent attempt has a retained applied verdict and collection covered this delivery from creation.

    - `attempts: array of DeliveryAttempt`

      - `attempt: number`

        The spent attempt number. Gaps mean a lease expired without an applied verdict.

      - `attempt_completed_at: string`

      - `attempt_started_at: string`

      - `destination: string`

        Scheme, host and effective port only. Path, query, fragment and credentials are never returned.

      - `http_status: number`

        Response status, or `null` when no response was received.

      - `phase: string`

        `pre_dial` when no request began, or `wire` after the HTTP round trip began.

      - `reason_code: string`

        A bounded machine reason. Treat unknown values as `unknown`.

      - `verdict: string`

        `delivered`, `retryable`, or `permanent`. Treat unknown values as an unavailable verdict.

      - `wire_completed_at: string`

      - `wire_duration_ms: number`

      - `wire_started_at: string`

      - `trace_id: optional string`

        W3C trace id when one was recorded. Correlation only; never authorization.

    - `created_at: string`

    - `endpoint_id: string`

    - `event_id: string`

    - `event_kind: string`

    - `observed_attempt_count: number`

      Applied attempt verdicts retained below.

    - `seq_from: number`

    - `seq_to: number`

    - `spent_attempt_count: number`

      Attempts spent by the delivery machine, including leases that expired without an applied verdict.

    - `state: string`

      `pending`, `delivering`, `delivered`, `permanent_refusal`, or `retry_exhausted`.

    - `chat_id: optional string`

  - `has_more: boolean`

  - `older_successful_history_may_have_been_swept: boolean`

    True when successful delivery detail may have been swept from this account partition.

  - `successful_history_incomplete_through: string`

    Inclusive creation-time horizon through which successful delivery detail may be incomplete.

  - `next_cursor: optional string`
