> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/assetmaintenance/_export.md).

# \_export

Exports Asset Maintenance data as a single attached CSV file, can use parameters to filter which Maintenances will be exported.

### Parameters

#### search

Only Maintenances which include the value of this parameter will be valid

#### daysFrom

An integer value for how many days back Maintenances will be considered valid

#### daysTo

An integer filter which only allows Maintenances that will occur in the next few days ahead.

#### active

An integer value which decides if Active or Inactive Maintenances will be exported:\
0 => Only Inactive Maintenances are exported\
1 => Only Active Maintenances are exported

### Example

```
FM_api('AssetMaintenance_export',[
  'search'=>'Finance',
  'daysFrom'=>'-28',
  'daysTo'=>'0',
  'active'=>'0'
]);
```

This would export any Inactive Maintenances between now and 4 weeks ago, which include the term "Finance"

### Results

These results are from downloaded CSV files

#### Example 1:

If there are no Maintenances or they are all excluded due to the filter parameters:

```
"Asset Maintenance ID",Asset,Owner,Description,"Next Job",Started,Expires,Recurs,Status

```

#### Example 2:

Active Jobs a week ago and within the week ahead are included, "search" parameter is unused:

```
"Asset Maintenance ID",Asset,Owner,Description,"Next Job",Started,Expires,Recurs,Status
31016,"Wood (34)",test owner,"Shelves Production","18/08/2023 - api tests",2023-08-15,2023-10-17,"every 3 days",Active
31017,"Transport ()",test owner,"Company Car Fuel","15/08/2023 - api tests",2023-08-15,,"every 1 days",Active
31018,"Budget Review ()",,"Overview and Consideration","15/08/2023 - user not set",2023-08-15,,"every 14 weeks",Active
```

"Wood" has a serial number of 34\
Asset Maintenances 31017 and 31018 do not have an expiration date\
Asset Maintenance 31018 does not have a set user


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.fieldmotion.com/fieldmotion-api-docs/assetmaintenance/_export.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
