When to use this endpoint

Use Vehicle_setPricePerDistance only for the legacy single-cell workflow. Prefer Vehicle_updateData for mapped integrations.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but performs no additional Vehicles-page, create, edit, delete, or role-permission check.

All reads and writes use the authenticated tenant’s tables. CRM1 and CRM2 may hide controls through client-side permissions; these routes do not repeat those UI checks.

Parameters

ParameterTypeRequiredDescription
idInteger-compatible or 32-character stringEffectively yesNumeric vehicle ID or UUID chosen by exact string length. Invalid and unknown identifiers still produce the normal success response.
valNumeric-compatibleNo validationConverted with floatval(). Missing or nonnumeric input becomes 0; negative values are accepted.

Example request

$result = FM_api('Vehicle_setPricePerDistance', [
	'id' => '30124',
	'val' => '0.75',
]);

Example response

{"ok":1}

Errors and unusual responses

ResponseCondition
{"error":"not logged in"}No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • The update result is ignored, so unknown IDs and unchanged values are indistinguishable from a successful change.
  • The handler does not enforce the zero-minimum layout metadata.

Side effects

  • Updates price_per_distance, advances last_edited, sets edited_uuid to Vehicle_setPricePerDistance, and invalidates the vehicle cache.
  • It does not write Core field history.

See it in Fieldmotion

CRM1

Open Settings → Vehicles in CRM1 and filter browser developer tools for the exact function name. Edit the Price per Mile/KM table cell.

CRM2

No direct CRM2 caller was found; mapped vehicle forms use Vehicle_updateData.

Related endpoints