When to use this endpoint

Use for settings, metadata and AutoDoc edits that should preserve the rest of the definition. Read with Form_getRequestedDetails, modify selected aliases, then read back after success. Prefer one scalar id for definition or AutoDoc changes.

Authentication and permissions

Authenticate with a signed API key (acting as its owner) or a logged-in CRM session on the routed account host. Session calls include the dispatcher’s CSRF value when configured. IDs refer to the authenticated tenant unless an explicit cross-account copy is described.

Requires Forms Edit (pageForms_edit) through the shared settings guard. Client administrators pass; other actors need the stored/session grant. This guard uses no legacy role-less allowance and is not conditional on the CRM version. The temporary-user edit-lock exception does not bypass it.

The account’s features2.disableFormEdits setting blocks this mutation with form edits are disabled for this account. A temporary user marked meta.is_tmp=1 bypasses that setting only.

Parameters

ParameterTypeRequiredDescription
idInteger-compatible ID or native ID arrayYesOne positive decimal Form ID or a nonempty native list. IDs are validated/deduplicated. Each bulk target receives its own normalization, parent-link synchronization and history; the entire SQL batch rolls back if any target fails. JSON text ID lists are not decoded.
name, template, replyToTextNoDisplay name, legacy template and reply-to address. These mapped names differ from the snake_case/full-editor inputs; replyTo is not normalized to the legacy editor’s fallback address.
fieldsDataNative array or JSON array textNoComplete field definitions stored as fields. Existing stable IDs must be unique; missing legacy IDs remain accepted. Replacing definitions does not migrate saved answers.
onComplete, autodocsNative JSON value or encoded textNoLegacy On Complete definition and AutoDoc configuration. A saved rule is not executed by this write.
autodocsDocJSON textNoAutoDoc object with header, body and footer HTML. See each route’s distinct image/HTML processing below.
typeInteger-compatible valueNoStored form type: current editors use 0 Job, 3 Job Table, 4 Quote, 5 Purchase Order, 6 Quote Table, 7 Invoice, 8 Invoice Table, 9 Opportunity, 10 Opportunity Table. No type allowlist is enforced by this map.
ownerID, emailTemplateID, departmentIDInteger-compatible valuesNoMapped IDs saved to owner_id, email_template_id and department_id. This wrapper does not establish that each referenced record exists.
archived, reportType, portalVisibility, usesStock, isInvoiceable, selectByDefaultInteger-compatible valuesNoStored switches/modes, mapped to archived, report_type, portal_visibility, uses_stock, is_invoiceable and select_by_default. Do not assume a server-side enum allowlist.
theme, metaTags, metaNotesText/serialized metadata valueNoUpdate meta.theme, meta.tags or meta.notes while retaining sibling metadata. Use these aliases for a targeted metadata edit.
metaJSON textNoWhole metadata document. Replaces the stored document; preserve all unrelated keys when using it.
cdate, lastEditedDatetime textNoMapped creation/edit timestamps. CreateData overrides cdate; ordinary changed updates set last_edited to server time. These are not incremental-read controls.
phpdocxVersionNumberNoStored phpdocx_version selection. No renderer version allowlist is added here.

Example request

$result = FM_api('Form_updateData', [
	'id'=>'1042','theme'=>'fm',
	'autodocsDoc'=>json_encode(['header'=>'','body'=>'<p>Inspection report</p>','footer'=>'']),
]);

Example response

{"ok":1}

Database numeric values can be JSON strings. Examples are representative; legacy application errors can use HTTP 200, so inspect the decoded response.

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 omitted.
{"error":"permission denied"}Forms Edit missing; reason can explain the role grant.
{"error":"Unable to update record"}Checked primary update failed.

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 mapped aliases are name, fieldsData, template, ownerID, lastEdited, onComplete, autodocs, type, archived, replyTo, reportType, portalVisibility, usesStock, isInvoiceable, autodocsDoc, theme, meta, emailTemplateID, departmentID, selectByDefault, cdate, phpdocxVersion, metaTags, metaNotes. Unknown keys are ignored. Omitted values preserve the record; explicit blank values are saved subject to generic conversion. Null is not a reliable clear control: mapped conversion skips null fields. Use blank text or an explicit serialized empty document/list as appropriate.
  • Validates stable IDs in fieldsData and all nested setJobStatus rules in onComplete. It does not rename old Job answers when definition fields change. No archive restriction is added.
  • Before any AutoDoc normalization, FormImagePolicy rejects unsupported image references: use account uploads or embedded image data, not arbitrary remote image URLs. Hyperlinks remain permitted. Each header/body/footer is cleaned of scripts/iframes; embedded images can be stored as form assets and resized to declared display dimensions. Meta tags and event attributes are removed/disabled.
  • Changed writes advance last_edited, invalidate forms cache and save history. A no-op returns ok. Missing target rows return form does not exist. Bulk saves are atomic for SQL: they do not report partially committed updatedIds.

Side effects

  • Uses a checked SQL transaction for selected rows, Undo baselines/snapshots and supported linked-table parent metadata. Mention notices run only after a top-level commit, with each target’s own old notes and link. Nested callers receive a warning to defer delivery until their outer commit. External asset storage is not rolled back by SQL.

See it in Fieldmotion

CRM1

No direct CRM1 caller found; the full Form editor uses Form_edit.

CRM2

Forms list bulk Archive/Unarchive and settings call updateData with table Form; AutoDoc save sends autodocsDoc and theme; the On Complete editor sends serialized onComplete. Filter Network for Form_updateData.

Related endpoints