When to use this endpoint

Use ContractType_edit when reproducing CRM1’s name-only edit. CRM2 uses ContractType_updateData for mapped edits.

Authentication and permissions

The request must have a nonzero authenticated user ID. No page, role, ownership, or feature-bit check is performed.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive existing type ID.
nameStringYesTrimmed replacement name, 1–64 Unicode characters. HTML is not stripped and duplicate names are allowed.

Example request

$result = FM_api('ContractType_edit', [
	'id' => '31',
	'name' => 'Planned service',
]);

Example response

{
  "ok": 1
}

An exact no-op returns {"ok":1,"msg":"no update needed"}. Comparison is case-sensitive after trimming.

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"}The ID is absent or nonpositive.
{"error":"missing or invalid parameter: name"}The trimmed name is blank.
{"error":"parameter too long: name. max length 64 characters"}The name exceeds 64 Unicode characters.
{"error":"Contract Type does not exist"}No row has the supplied ID.

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

Behaviour and edge cases

  • The endpoint changes only name. It does not validate uniqueness or modify invoicing behavior.
  • There is no pagination or soft-deleted state for contract types.

Side effects

  • A changed name receives current server last_edited and invalidates the contract-type cache. No generic audit entry is written by this legacy route.

See it in Fieldmotion

CRM1

Open Contracts → Contract Types, click Edit, change the name, and save; CRM1 first calls ContractType_get and then this route.

CRM2

A production-source search found no CRM2 caller. CRM2’s configurable table uses ContractType_updateData.

Related endpoints