# \_list

Lists all Customers, can use given parameters as filters for returned results.

### Parameters

#### last\_edited

A filter which removes Customers that were last edited outside the range between the date given and when this function is run.

#### is\_active

An optional filter based on if Customers are active or not:\
0 => Only inactive Customers\
1 => Only Active Customers

#### check\_parent

An optional filter which checks the **parent-customer-selection** Setting , if this parameter is set to 1 and **parent-customer-selection** is set to 1, Parent Customers are not included in the results.

#### fields

A JSON-encoded array naming the fields which are to be returned. Valid values are:

account\_number, id, name, notes, email, last\_edited, industry, street\_address1, street\_address2, town, county, postcode, landline, mobile, contact\_name, changes, edited\_uuid, appId, cdate, appointments\_open, appointments\_closed, custom\_values, callback, account\_manager, meta, callback\_notes, lead\_acc, parent\_id, latitude, longitude, is\_active, country, created\_by, files, department\_id, city, state, last\_edited\_all, is\_flagged, contacts, has\_invoices, type, price\_band, accounts\_name, accounts\_number, credit\_terms, area\_id

### Examples

Without the "fields" parameter:

```
FM_api('Customers_list',[
    'last_edited'=> date('Y-m-d H:i:s', strtotime("yesterday")),
    'is_active'=>'1',
    'check_parent'=>'1'
  ]
);
```

With the "fields" parameter:

```
FM_api('Customers_list',[
    'last_edited'=> date('Y-m-d H:i:s', strtotime("yesterday")),
    'is_active'=>'1',
    'check_parent'=>'1',
    'fields'=>json_encode(
      [
        'is_active',
        'cdate'
      ]
    )
  ]
);
```

### Results

Without the "fields" parameter:

```
[{"id":"683138","name":"A Test Customer","is_active":"1"},{"id":"683139","name":"A Test Customer2","is_active":"1"}]
```

With the "fields" parameter, including the **is\_active** and **cdate** fields.

```
[{"id":"683136","name":"A Test Customer","is_active":"1","cdate":"2023-12-10 12:46:32"},{"id":"683137","name":"A Test Customer2","is_active":"1","cdate":"2023-12-10 12:46:32"}]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fieldmotion.com/fieldmotion-api-docs/customers/_list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
