# Event Attempt

When an Event delivery fails, an event attempt will be registered. It carries information meant to help you debug event reception issues.

### The Event Attempt object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the event attempt. |
| `code` | STRING | Delivery error code. |
| `created` | STRING | Creation datetime. Example: "2020-04-23T23:00:00.000000+00:00". |
| `eventId` | STRING | ID of the associated Event. |
| `message` | STRING | Delivery error description. |
| `webhookId` | STRING | ID of the associated Webhook. |

### List failed Webhook Event delivery attempts

`GET /v2/event/attempt`

Get information on failed webhook event delivery attempts.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `eventIds` | OPTIONAL | List of Event ids to filter attempts. Example: ["5656565656565656", "4545454545454545"] |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `webhookIds` | OPTIONAL | list of Webhook ids to filter attempts. Example: ["5656565656565656", "4545454545454545"] |

**Request**

```python
import starkbank

attempts = starkbank.event.attempt.query(after="2020-01-30")

for attempt in attempts:
    print(attempt)
```

**Response**

```python
Attempt(
    id=4737439230853120,
    code=invalidHttpStatus,
    message=HTTP POST request returned status 404,
    webhook_id=5187231165710336
    event_id=6488144706797568,
    created=2020-01-30 12:35:59.322499,
)
```

### Get an Event Attempt

`GET /v2/event/attempt/:id`

Get a single event attempt by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Unique id of the event attempt entity. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkbank

attempt = starkbank.event.attempt.get("4737439230853120")

print(attempt)
```

**Response**

```python
Attempt(
    id=4737439230853120,
    code=invalidHttpStatus,
    message=HTTP POST request returned status 404,
    webhook_id=5187231165710336
    event_id=6488144706797568,
    created=2020-01-30 12:35:59.322499,
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkbank.com/api/v2/event-attempt-python.md)
- [Node.js](https://docs.starkbank.com/api/v2/event-attempt-node.md)
- [PHP](https://docs.starkbank.com/api/v2/event-attempt-php.md)
- [Java](https://docs.starkbank.com/api/v2/event-attempt-java.md)
- [Ruby](https://docs.starkbank.com/api/v2/event-attempt-ruby.md)
- [Elixir](https://docs.starkbank.com/api/v2/event-attempt-elixir.md)
- [.NET](https://docs.starkbank.com/api/v2/event-attempt-dotnet.md)
- [Go](https://docs.starkbank.com/api/v2/event-attempt-go.md)
- [Clojure](https://docs.starkbank.com/api/v2/event-attempt-clojure.md)
- [cURL](https://docs.starkbank.com/api/v2/event-attempt-curl.md)
