When to use this endpoint

AssetType_import supports the old CRM1 comma-split importer. New integrations and both current import widgets should use AssetTypes_import.

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
val1AnyYesLegacy placeholder whose presence is required but whose value is never read.
nameStringYesAsset-type name. Blank is rejected; the value is stored without trimming and duplicate names are allowed.
val2Integer-like valueNoLegacy vehicle flag; omission becomes 0. The stored attrs value is 0 when false, otherwise intval(val2)+1. The intended values are 0 and 1, producing masks 0 and 2.

Example request

$created = FM_api('AssetType_import', [
	'val1' => '',
	'name' => 'Mobile Compressor',
	'val2' => '1',
]);

Example response

{
  "id": 58
}

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: val1"}The val1 key is absent, even though its value is unused.
{"error":"no name given"}name is absent, blank, or otherwise false-like.

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

Behaviour and edge cases

  • No duplicate-name check or trimming is performed.
  • Values other than the intended 0/1 vehicle flag can produce unusual attribute masks.
  • The inserted metadata is exactly {}, last_edited is current server time, and rental type uses its database default.

Side effects

  • Inserts one type and invalidates the asset-type cache. It does not write an import-log row, generic audit entry, or shared-template merge.

See it in Fieldmotion

CRM1

The older Asset Types CSV reader references AssetType_import, but omits required val1. The current Import Types widget uses AssetTypes_import.

CRM2

No production CRM2 caller was found; CRM2 uses AssetTypes_import.

Related endpoints