When to use this endpoint

Use AssetType_createData when saving CRM2’s configurable Asset Type create layout. For the stricter legacy create workflow with duplicate-name checking and shared-template propagation, use AssetType_new.

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
nameStringNoStored name. The field map does not mark it required and does not check uniqueness; an omitted name is allowed when another mapped field is present.
metaString or JSON-compatible valueNoComplete metadata value. Supplying an array/object stores its JSON encoding; a string is stored verbatim.
attrsInteger stringNoComplete attribute bitmask. CRM screens use bit 2 for Vehicle.
rentalTypeIDInteger stringNoStored as rental_type_id. The referenced value is not validated.
metaURLStringNoWrites meta.url, creating a metadata object when necessary. If both meta and metaURL are sent, field-map order makes metaURL the final URL value.
lastEditedDatetime stringNoLow-level mapped timestamp. When omitted, the helper writes the current server time.
idAnyNoIgnored during creation even though it appears in the map.

Example request

$created = FM_api('AssetType_createData', [
	'name' => 'Mobile Compressor',
	'attrs' => '2',
	'metaURL' => 'https://example.test/assets',
]);

Example response

{
  "ok": 1,
  "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 parameters."}No writable mapped field is supplied.

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

Behaviour and edge cases

  • Unknown request keys and id are ignored. Layout hidden and readonly flags are presentation metadata, not API write protection.
  • Integer fields are coerced with PHP integer conversion. Metadata paths are merged into the supplied or newly created metadata value.
  • This endpoint performs one insert and has no filtering or pagination.

Side effects

  • Inserts the row, invalidates the asset-type cache, and writes generic audit entries for accepted fields.
  • It does not create a type-specific custom layout, merge shared custom fields, or send notifications.

See it in Fieldmotion

CRM1

No direct production CRM1 caller was found; CRM1 creates types with AssetType_new.

CRM2

Open Asset Types and create a type through the configurable create dialog. The shared layout registry maps that save to AssetType_createData.

Related endpoints