# \_update

Creates a new Vehicle or changes the settings of a Vehicle with an existing ID.

### Parameters

#### id

The ID of the Vehicle, this parameter is needed to modify an existing Vehicle, if this parameter is not included, a new Vehicle is created instead.

#### cost\_per\_distance

The cost per distance variable of the Vehicle.

#### price\_per\_distance

The price per distance variable of the Vehicle.

#### description

A string value which will be the description of the Vehicle.

### Example

```
FM_api('Vehicle_update',[
    'id'=>'30007'
    'reg'=>'ABC123D',
    'cost_per_distance'=>'1',
    'price_per_distance'=>'2.5',
    'description'=>'test desc'
  ]
);
```

### Result

#### On Failure

If the "cost\_per\_distance" parameter is not given a value:

```
{"error":"missing or invalid parameter: cost_per_distance"}
```

#### On Success

If a new Vehicle is created, the ID and UUID of the Vehicle are returned:

```
{"ok":1,"id":30007,"uuid":"6156d113cb8d77abcda9c1f146b3fb23"}
```

If the Vehicle already exists, the UUID returned is null:

```
{"ok":1,"id":"30007","uuid":null}
```


---

# 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/vehicle/_update.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.
