# Replays

## Replay retained webhook events

**post** `/v1/webhook_endpoints/{endpoint}/replays`

Accept a bounded replay of events still present in account history.
Account-event history has no fixed minimum retention period in beta.
Retrying the same acceptance key recovers its response for 24 hours.

### Path Parameters

- `endpoint: string`

### Header Parameters

- `"Idempotency-Key": string`

### Body Parameters

- `after_cursor: optional string`

  Exclusive event-log cursor. Omit to begin inclusively at retained history.

- `through_cursor: optional string`

  Inclusive event-log cursor. Omit to snapshot the committed tail.

### Returns

- `ReplayAcceptance object { id, after_cursor, created_at, 3 more }`

  - `id: string`

  - `after_cursor: string`

  - `created_at: string`

  - `selected: number`

  - `state: "pending"`

    - `"pending"`

  - `through_cursor: string`

### Example

```http
curl https://whatsapp.messages.api.linqapp.com/v1/webhook_endpoints/$ENDPOINT/replays \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LINQ_WHATSAPP_API_KEY" \
    -d '{}'
```

#### Response

```json
{
  "id": "id",
  "after_cursor": "after_cursor",
  "created_at": "2019-12-27T18:11:19.117Z",
  "selected": 0,
  "state": "pending",
  "through_cursor": "through_cursor"
}
```

## Get webhook replay status

**get** `/v1/webhook_endpoints/{endpoint}/replays/{replay}`

Read durable replay progress and its immutable terminal verdict.
During ordinary operation, a successfully completed replay remains
readable for at least 30 days after `terminal_at`, then returns the same
tenant-scoped 404 as an unknown replay. Pending and running replays are
never age-swept; failed replay evidence has no scheduled expiry.

### Path Parameters

- `endpoint: string`

- `replay: string`

### Returns

- `Replay object { id, after_cursor, created_at, 12 more }`

  - `id: string`

  - `after_cursor: string`

  - `created_at: string`

  - `delivered: number`

  - `delivering: number`

  - `exhausted: number`

  - `failure_reason: string`

  - `materialized: number`

  - `pending: number`

  - `selected: number`

  - `started_at: string`

  - `state: "pending" or "running" or "completed" or "failed"`

    - `"pending"`

    - `"running"`

    - `"completed"`

    - `"failed"`

  - `terminal_at: string`

  - `through_cursor: string`

  - `unmaterialized: number`

### Example

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

#### Response

```json
{
  "id": "id",
  "after_cursor": "after_cursor",
  "created_at": "2019-12-27T18:11:19.117Z",
  "delivered": 0,
  "delivering": 0,
  "exhausted": 0,
  "failure_reason": "failure_reason",
  "materialized": 0,
  "pending": 0,
  "selected": 0,
  "started_at": "2019-12-27T18:11:19.117Z",
  "state": "pending",
  "terminal_at": "2019-12-27T18:11:19.117Z",
  "through_cursor": "through_cursor",
  "unmaterialized": 0
}
```

## Domain Types

### Replay

- `Replay object { id, after_cursor, created_at, 12 more }`

  - `id: string`

  - `after_cursor: string`

  - `created_at: string`

  - `delivered: number`

  - `delivering: number`

  - `exhausted: number`

  - `failure_reason: string`

  - `materialized: number`

  - `pending: number`

  - `selected: number`

  - `started_at: string`

  - `state: "pending" or "running" or "completed" or "failed"`

    - `"pending"`

    - `"running"`

    - `"completed"`

    - `"failed"`

  - `terminal_at: string`

  - `through_cursor: string`

  - `unmaterialized: number`

### Replay Acceptance

- `ReplayAcceptance object { id, after_cursor, created_at, 3 more }`

  - `id: string`

  - `after_cursor: string`

  - `created_at: string`

  - `selected: number`

  - `state: "pending"`

    - `"pending"`

  - `through_cursor: string`
