When to use this endpoint

Use Asset_edit for the CRM1 asset edit form or the asset CSV importer’s per-row update path.

For CRM2 named layout fields and circular-whereabouts protection, use Asset_updateData.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive asset ID. The lookup does not exclude soft-deleted rows.
name / code / book_id / make / modelStringsNoSupplied values are trimmed. Name, code, and book ID honor their tenant uniqueness settings; make/model do not.
valueNumeric stringNoConverted with floatval; nonnumeric text becomes zero.
type_id / department_idInteger stringsNoStored IDs. Referenced rows are not validated. A changed type_id controls custom-label normalization in the same request.
owner_idInteger stringNoNew owner customer ID; zero means no owner. Existence is not checked.
location_type / location_idInteger stringsNoNew whereabouts components. They may be supplied independently; type range, target existence, and circularity are not validated.
custom_valuesArrayNoMerged into meta.custom. Custom display labels are converted to canonical layout IDs when the asset type has one unambiguous match. Existing keys omitted from this array remain stored.
main_valuesArrayNoMerged into the separate meta.main object without replacing custom values.
home_location_type / home_location_idInteger/name valuesNoHome-location metadata. Types accept -1..2 and the documented location/customer/asset aliases; names must resolve uniquely. Legacy aliases: loc_type/loc_id.
warrantyDate stringNoShape YYYY-MM-DD. Blank or exact Invalid date clears the SQL value; the shape check does not prove calendar validity.
metaNextDateDate stringNoStored as meta.next_date. Blank or exact Invalid date stores the string "null", not JSON null.
archivedInteger stringNoSets the archived flag. Transitioning to nonzero writes a deletion-log row; transitioning back to zero deletes every asset deletion-log row for this ID.
edited_by_import_idInteger stringNoPositive values are stored in metadata to identify importer edits.
metaServiceFrequencyObjectNoAfter this edit succeeds, delegates a second write to Asset_updateData when both frequency and every exist.

Example request

$result = FM_api('Asset_edit', [
	'id' => '4821',
	'name' => 'Compressor 4',
	'code' => 'CMP-004',
	'owner_id' => '1042',
	'location_type' => '1',
	'location_id' => '1042',
	'warranty' => '2027-09-24',
	'custom_values' => ['inspection_class' => 'A'],
]);

Example response

{
  "ok": 1,
  "id": 4821
}

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.
{"error":"missing or invalid parameter: id"}id is absent, zero, or otherwise not positive.
{"error":"Asset does not exist"}No row has that ID. A soft-deleted row still counts as existing.
{"error":"Invalid format for warranty date"}A nonblank warranty does not match the required digit-and-hyphen shape.
{"error":"Invalid format for next service date"}A nonblank metaNextDate has the wrong shape.
{"error":"An asset … already exists"}A configured name, serial-number, or book-ID uniqueness check finds a non-deleted conflicting asset.
{"error":"Invalid Home Location Type"} / {"error":"Could not resolve Home Location"}Home-location parsing fails.

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

Behaviour and edge cases

  • Every successful call rewrites metadata and last_edited, even if no optional value changed. It can edit archived or soft-deleted assets.
  • Uniqueness uses asset-unique-name, asset-unique-code, and asset-unique-book_id; deleted rows are ignored and archived rows still conflict.
  • Changing owner or whereabouts first ensures an initial movement at creation time, then appends one combined movement. Owner-only changes preserve location; location-only rows store a null owner meaning no owner change.
  • Changing archive state uses deletion-log semantics but does not set deleted. Unarchiving removes deletion logs rather than marking them restored.
  • This is a single-record write with no filtering or pagination.

Side effects

  • Updates the asset and invalidates assets; owner/location changes also invalidate customer_assets.
  • Writes one asset audit entry. Owner changes refresh parent/customer job caches. Location changes archive the old/new resolved address and append movement history.
  • A service-frequency follow-up can produce generic field audits and update2/time2 notification-service events. The writes are not transactional.

See it in Fieldmotion

CRM1

Save the classic asset edit screen or import an assets CSV that updates an existing row, then filter Network requests for Asset_edit.

CRM2

CRM2 custom-field regression coverage calls this legacy route, but the main configurable asset layout saves through Asset_updateData.

Related endpoints