# List all webhooks

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

Return a list of webhooks.

## 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 /:webhooks`

**cURL**

```bash
$ curl https://api.swell.store/:webhooks?where[enabled]=true&limit=25&page=1 \
  -u store-id:secret-key \
  -G
```

**Node**

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

await swell.get('/:webhooks', {
  where: { enabled: true },
  limit: 25,
  page: 1,
});
```

**PHP**

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

$swell->get('/:webhooks', [
  'where' => [ 'enabled' => true ],
  'limit' => 25,
  'page' => 1,
]);
```

## Example response

```json
{
  "count": 4,
  "results": [
    {
      "url": "http://a30d184f.ngrok.io/api/testing",
      "enabled": true,
      "alias": null,
      "description": null,
      "events": [
        "order.created",
        "order.submitted",
        "order.updated"
      ],
      "api": "com",
      "date_final_attempt": "2022-05-09T16:49:19.017Z",
      "date_scheduled": "2022-05-03T03:00:00.000Z",
      "date_created": "2021-09-27T16:30:11.837Z",
      "date_updated": "2022-05-03T02:00:34.789Z",
      "attempts_failed": 30,
      "date_first_failed": "2022-05-02T16:49:19.017Z",
      "id": "6151f193ae97e82ccbf6f0a7"
    },
    {
      "url": "https://schema-webhooks-example.herokuapp.com/",
      "enabled": false,
      "alias": "Test",
      "description": "custom field test",
      "events": [
        "account.created",
        "account.deleted",
        "account.updated",
        "cart.created",
        "cart.deleted",
        "category.created",
        "category.updated",
        "coupon.created",
        "coupon.updated",
        "invoice.created",
        "invoice.updated",
        "order.created",
        "order.updated"
      ],
      "api": "com",
      "date_final_attempt": null,
      "date_scheduled": null,
      "date_created": "2021-04-05T14:22:58.995Z",
      "date_updated": "2021-04-05T14:24:49.173Z",
      "id": "606b1d42f82c45625c64d81f"
    },
    {
      "alias": "test_scheduled",
      "url": "http://a30d184f.ngrok.io/api/webhook3",
      "events": [
        "webhook.scheduled"
      ],
      "enabled": false,
      "schedule": {
        "hour": 0
      },
      "api": "com",
      "date_final_attempt": null,
      "date_scheduled": null,
      "date_created": "2020-04-30T22:25:23.019Z",
      "date_updated": "2020-05-01T17:31:25.304Z",
      "id": "5eab5052ccb62171e667e9e7"
    },
    {
      "alias": "example",
      "api": "com",
      "attempts_failed": 0,
      "date_created": "2017-02-05T19:18:51.000Z",
      "date_final_attempt": null,
      "date_first_failed": null,
      "date_updated": "2021-04-01T15:56:44.173Z",
      "enabled": false,
      "events": [
        "webhook.test",
        "product.updated",
        "order.submitted",
        "payment.succeeded"
      ],
      "url": "https://schema-webhooks-example.herokuapp.com/",
      "testField": "xyz",
      "id": "58977a9badc3891811b54f3c"
    }
  ],
  "page": 1,
  "page_count": 1,
  "limit": 25
}
```
