# Events

Events are used to keep track of different actions related to your company account. For example, when a transaction is created, an TransactionCreated event is created.

A full list of available events and associated endpoints is available in the API reference (opens new window).

# Working with events

You can retrieve all existing events from the API. By default, you will see the most recent events that have occurred.

TIP

In order to receive transaction events please note that your API key should have Get all transaction details permission.

 




GET /v1/events

Content-Type: application/json
Authorization: Bearer <access_token>

In the response you will receive a list of events and a has_more field, which informs you if there are more events on the next page.

 
















HTTP 200 OK

{
  "data": [
    {
      "created_at": "2022-08-16T12:45:33.000Z",
      "id": "b1ded866-79cc-44d2-aa61-69c26a2f580a",
      "name": "ExampleEvent",
      "payload": {
        "example_field": "Example value"
      }
    },
    ...
  ],
  "has_more": true
}

# Polling

In order to reliably process events and ensure data consistency, your system must integrate with events by polling the event listing endpoint.

Between each request, your system must retain the cursor (id of the last seen event) in order to retrieve events that occurred after.

 




GET /v1/events?sort_type=ASC&starting_after=0abfb90a-4d6d-451d-bd55-c3e064fb795a

Content-Type: application/json
Authorization: Bearer <access_token>

In this case we have chosen ascending order to retrieve the oldest events first, and we specify the last seen event id.

 
























HTTP 200 OK

{
  "data": [
    {
      "created_at": "2022-08-16T12:45:33.000Z",
      "id": "b1ded866-79cc-44d2-aa61-69c26a2f580a",
      "name": "ExampleEvent",
      "payload": {
        "example_field": "Example value"
      }
    },
    ...
    {
      "created_at": "2022-08-17T13:51:10.000Z",
      "id": "42943401-f3cb-4c33-a2ed-ffe87055d227",
      "name": "ExampleEvent",
      "payload": {
        "example_field": "Example value"
      }
    }
  ],
  "has_more": true
}

We save the id of the last event in the list. Since the has_more field has the value true, your system should repeat this process until it is false. At that point, the next polling interval should start with the last saved cursor and begin the process again.