Vehicles
Permanently delete a vehicle
/a/Vehicle_delete
Permanently remove one vehicle row by numeric ID or 32-character UUID.
When to use this endpoint
Use Vehicle_delete only after checking assignments and stock/tracking relationships yourself. Both CRM vehicle screens use it for deletion.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible or 32-character string | Yes | Numeric vehicle ID or UUID. Every 32-character value is treated as a UUID lookup; other values are integer-converted. |
Example request
$result = FM_api('Vehicle_delete', [
'id' => '30124',
]);
Example response
{"ok":1}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing or invalid parameter: id"} | id is absent, blank, or otherwise false-like. This validation occurs before the login guard. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- An unknown ID, a UUID that resolves to no row, or a nonnumeric non-UUID value still returns
{"ok":1}. - Vehicles have no soft-delete flag, so there is no restore route.
- The delete query does not explicitly invalidate the vehicle cache.
Side effects
- Hard-deletes the tenant vehicle row and records the numeric ID in the tenant deletion log.
See it in Fieldmotion
CRM1
Open Settings → Vehicles in CRM1 and filter browser developer tools for the exact function name. Choose the row’s delete link and confirm the dialog.
CRM2
Open Stock → Vehicles in CRM2 and filter browser developer tools for the exact function name. Select vehicles, choose the bulk delete action, and confirm; CRM2 calls this endpoint once per selected ID.
Related endpoints
Vehicle_getcan verify whether the row still exists.VehicleTracking_saveMappingsexplicitly replaces tracking mappings before deletion if cleanup is required.