# List all subscriptions

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

Return a list of subscriptions.

## Fields

- `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 /subscriptions`

**cURL**

```bash
$ curl "https://api.swell.store/subscriptions?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('/subscriptions', {
  limit: 25,
  page: 1
});
```

**PHP**

```php
<?php

use Swell\Client;

$swell = new Client('store-id', 'secret-key');

$swell->get('/subscriptions', [
  'limit' => 25,
  'page' => 1
]);

?>
```

## Example response

```json
{
  "count": 54,
  "results": [
    {
      "currency": "USD",
      "account_id": "62acbadb3edcc300128d4178",
      "billing": {
        "first_name": "Wandering",
        "last_name": "Traveller",
        "name": "Wandering Traveller",
        "card": {
          "brand": "Visa",
          "last4": "4242",
          "exp_month": 7,
          "exp_year": 2024,
          "token": "card_s4FQeFxdb8ErigKVxS9cR3js"
        },
        "method": "card",
        "account_card_id": "62b2117ed9dce40019a6587b",
        "use_account": true
      },
      "shipping": {
        "first_name": "Wandering",
        "last_name": "Traveller",
        "company": "Urbul gro-Orkulg's crew",
        "address1": "1234 City Isle",
        "address2": "Cyrodiil",
        "city": "Heartlands",
        "country": "US",
        "name": "Wandering Traveller",
        "account_address_id": "62acbbe0d69a3b0012c7eae5",
        "use_account": true
      },
      "order_id": "62b9ee09e342a30012319601",
      "order_item_id": "62b9f12391fed80013478224",
      "product_id": "62b1e30767145000197b2bbf",
      "product_name": "Skooma",
      "variant_id": null,
      "options": null,
      "price": 75,
      "quantity": 1,
      "billing_schedule": {
        "interval": "monthly",
        "interval_count": 1,
        "limit": null,
        "trial_days": 0
      },
      "order_schedule": null,
      "coupon_code": null,
      "discounts": [],
      "items": [],
      "price_total": 75,
      "payment_balance": -81,
      "trial": false,
      "paid": false,
      "unpaid": true,
      "sub_total": 75,
      "grand_total": 75,
      "recurring_total": 75,
      "ordering": true,
      "plan_id": null,
      "plan_name": null,
      "active": true,
      "date_period_start": "2023-08-27T18:14:53.861Z",
      "date_period_end": "2023-09-27T18:14:53.861Z",
      "test": true,
      "date_created": "2022-06-27T18:14:53.887Z",
      "status": "unpaid",
      "number": "100004",
      "date_updated": "2023-08-27T18:15:01.146Z",
      "invoices": "62b9f1d191fed8001347822a",
      "invoice_total": 81,
      "payment_total": 0,
      "date_payment_expiring": "2024-07-01T00:00:00.000Z",
      "date_payment_failed": "2023-01-27T18:15:03.450Z",
      "payment_error": "Unable to complete payment, invoice not found",
      "retry_resolve": "unpaid",
      "id": "62b9f39d8b9a9a00133b7784"
    },
    {...}
  ],
  "page": 1,
  "page_count": 3,
  "limit": 25,
  "pages": {
    "1": {
      "start": 1,
      "end": 25
    },
    "2": {
      "start": 26,
      "end": 50
    },
    "3": {
      "start": 51,
      "end": 54
    }
  }
}
```
