When to use this endpoint

Use ContractType_createData for CRM2’s Contract Types create dialog. For the older name-only CRM1 workflow, use ContractTypes_new.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler has no page, role, or feature-bit check.

CRM1 and CRM2 show contract management only when tenant feature bit 64 is enabled, but this API does not enforce that setting.

Parameters

ParameterTypeRequiredDescription
nameStringNoType name, limited to 64 Unicode characters. The map does not require a nonblank name and does not check uniqueness.
disableInvoicingInteger stringNoStored disable_invoicing value after integer conversion; defaults to 0. CRM2 labels 0 Invoiceable Yes and 1 Invoiceable No. Other integers are accepted.
lastEditedDatetime stringNoStored timestamp. The endpoint supplies current server time when omitted; the string is not date-validated.
metaString or JSON-compatible valueNoComplete raw metadata text. Arrays/objects are JSON-encoded by the shared helper; strings are stored verbatim.
idAnyNoIgnored during creation even though it exists in the read/update map.

Example request

$created = FM_api('ContractType_createData', [
	'name' => 'Planned maintenance',
	'disableInvoicing' => '0',
]);

Example response

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

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":"name is too long."}name exceeds 64 Unicode characters.

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. Integer input is coerced with PHP integer conversion.
  • The table has no deleted/status column. This operation performs one insert and has no filtering or pagination.

Side effects

  • Inserts the tenant row, invalidates the contract-type cache, and writes generic audit entries for accepted/defaulted fields.
  • It does not create contracts, change existing contracts, or send notifications.

See it in Fieldmotion

CRM1

No production CRM1 caller was found. CRM1’s Contract Types Create dialog calls ContractTypes_new.

CRM2

Open Contracts → Types with Contracts enabled and create a row. The shared display widget derives ContractType_createData from its API prefix.

Related endpoints