# List all files

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

Return a list of files.

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

**cURL**

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

**PHP**

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

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

## Example response

```json
{
  "count": 2,
  "results": [
    {
      "length": 4898,
      "chunkSize": 261120,
      "uploadDate": "2024-01-03T11:31:09.153Z",
      "filename": "image.jpg",
      "content_type": "image/jpeg",
      "date_created": "2024-01-03T11:31:09.143Z",
      "date_uploaded": "2024-01-03T11:31:09.158Z",
      "md5": "f082a5c3677bb757e11d738cb6f60624",
      "url": "https://cdn.swell.store/f082a5c3677bb757e11d738cb6f60624/image.jpg",
      "id": "6595457d82e01f0012243057"
    },
    {
      "length": 5120,
      "chunkSize": 261120,
      "uploadDate": "2024-01-04T09:12:44.201Z",
      "filename": "other-image.jpg",
      "content_type": "image/jpeg",
      "date_created": "2024-01-04T09:12:44.190Z",
      "date_uploaded": "2024-01-04T09:12:44.205Z",
      "md5": "3c9a1de5b7f204e8c6d1b0a95e4f7d38",
      "url": "https://cdn.swell.store/3c9a1de5b7f204e8c6d1b0a95e4f7d38/other-image.jpg",
      "id": "65965a1c82e01f0012243099"
    }
  ],
  "page": 1,
  "page_count": 1,
  "limit": 25
}
```
