# \_setActive

Sets whether an Asset is Active or not.

### Parameters

#### id

The ID of the Asset.

#### val

An integer value which decides if the Asset is Active or not\
0 => Inactive\
1 => Active

### Example

```
FM_api('Asset_setActive',[
    'id'=>'526191',
    'val'=>'0'
    ]
);
```

### Result

#### On Success

```
{'ok':1}
```

If the "val" parameter's value already matches the current status of the Asset:

```
{'ok':1,'msg':'no change needed'}
```

#### On Failure

If the "id" parameter is not given a value or has a value less than 1:

```
{'error':'missing or invalid parameter: id'}
```

If the "value" parameter is not given a set value:

```
{'error':'missing parameter: val'}
```

If the "id" parameter does not match an existing asset:

```
{'error':'asset does not exist'}
```


---

# 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/asset/_setactive.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.
