# List all events

Source: https://developers.swell.is/backend-api/events/list-all-events

Return a list of events.

## Arguments

- `expand` (string): Expand link fields and child collections by using the expand argument.

  - For example, `expand=account` would return a related customer account if one exists.

  When the field represents a collection, you can specify the query limit.

  - For example, `expand=variants:10` would return up to 10 records of the variants collection.

  See [expanding](https://developers.swell.is/backend-api/querying/expanding) for more details.
- `fields` (string): Returns only the specified fields in the result.

  - For example `fields=name,slug` would return only the fields `name` and `slug` in the response.

  Supports nested object and array fields using dot-notation.

  - For example, `items.product_id`. The product `id` is always returned.
- `include` (object): Include one or more arbitrary queries in the response which are potentially related to the main query.

  See [including](https://developers.swell.is/backend-api/querying/including) for more details.
- `limit` (int): Limit the number of records returned, ranging between `1` and `1000`. Defaults to `15`. Default: `15`.
- `page` (int): The page number of results to return given the specified or default `limit`.
- `search` (string): A text search is performed using the search argument. Searchable fields are defined by the model.

  - For example, `search=red` would return records containing the word "red" anywhere in the defined text fields.

  See [searching](https://developers.swell.is/backend-api/querying/searching) for more details.
- `sort` (string): Expression to sort results by using a format similar to a SQL sort statement.

  - For example, `sort=name asc` would return records sorted by name ascending.

  See [sorting](https://developers.swell.is/backend-api/querying/sorting) for more details.
- `where` (object): An object with criteria to filter the result.

  - For example, `active=true` would return records containing a field `active` with the value `true`.

  It's also possible to use query operators, for example, `$eq`, `$ne`, `$gt`, and more.

  See [querying](https://developers.swell.is/backend-api/querying) for more details.

## Example request

`GET /events`

**cURL**

```sh
$ curl https://api.swell.store/events \
  -u store-id:secret-key
```

**Node**

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.get('/events');
```

**PHP**

```php
<?php $swell = new \Swell\Client('store-id', 'secret-key');

$swell->get('/events');
```

## Example response

```json
{
  "count": 1105,
  "results": [
    {
      "user_id": "606f0fdd255b020caaa3f577",
      "model": "accounts",
      "type": "account.updated",
      "data": {
        "id": "62b1e36767145000197b2bd6",
        "shipping": {
          "first_name": "Runs-in-circles",
          "last_name": null,
          "company": "",
          "address1": "Shivering isles",
          "address2": null,
          "city": null,
          "zip": "34534",
          "country": "US",
          "state": "AL",
          "phone": null,
          "name": "Runs-in-circles",
          "account_address_id": "62bcb8ec629aa900197ffb8d"
        }
      },
      "date_created": "2022-06-29T20:41:17.225Z",
      "id": "62bcb8ed629aa900197ffb8f"
    },
    {
      "user_id": "606f0fdd255b020caaa3f577",
      "model": "accounts:addresses",
      "type": "account.address.created",
      "data": {
        "parent_id": "62b1e36767145000197b2bd6",
        "name": "Runs-in-circles",
        "first_name": "Runs-in-circles",
        "last_name": null,
        "address1": "Shivering isles",
        "address2": null,
        "city": null,
        "state": "AL",
        "zip": "34534",
        "country": "US",
        "phone": null,
        "company": null,
        "fingerprint": "0f1d3af32dd2dc0607c12ace5b2ea9c5",
        "date_created": "2022-06-29T20:41:16.931Z",
        "active": true,
        "id": "62bcb8ec629aa900197ffb8d"
      },
      "date_created": "2022-06-29T20:41:17.192Z",
      "id": "62bcb8ed629aa900197ffb8e"
    },
    {
      "model": "settings",
      "type": "setting.updated",
      "data": {
        "id": "store",
        "settings": {
          "date_updated": "2022-06-29T19:45:22.163Z"
        }
      },
      "date_created": "2022-06-29T19:45:22.598Z",
      "id": "62bcabd2bc89e4001a4c4ecf"
    },
    {
      "user_id": "606f0fdd255b020caaa3f577",
      "model": "settings",
      "type": "setting.updated",
      "data": {
        "id": "store",
        "settings": {
          "date_updated": "2022-06-29T19:40:52.478Z"
        }
      },
      "date_created": "2022-06-29T19:40:53.402Z",
      "id": "62bcaac5629aa900197ffb35"
    },
    {...}
  ],
  "page": 1,
  "page_count": 74,
  "limit": 15,
  "pages": {
    "1": {
      "start": 1,
      "end": 15
    },
    "2": {
      "start": 16,
      "end": 30
    },
    "3": {
      "start": 31,
      "end": 45
    },
    "4": {
      "start": 46,
      "end": 60
    },
    "5": {
      "start": 61,
      "end": 75
    },
    "6": {
      "start": 76,
      "end": 90
    },
    "7": {
      "start": 91,
      "end": 105
    },
    "8": {
      "start": 106,
      "end": 120
    },
    "9": {
      "start": 121,
      "end": 135
    },
    "10": {
      "start": 136,
      "end": 150
    }
  }
}
```
