When to use this endpoint

Use with a full editor payload. For a small change that must preserve omitted values, use Form_updateData instead. Save existing values for fields and report settings before assembling this request.

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.

Existing positive-ID saves require Forms Edit with no legacy role-less allowance. Creation with id=0 does not invoke that settings permission guard.

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
idNonnegative integer-compatible IDNoDefaults 0 to create. A positive ID edits; negative is rejected. Existing edits require Forms Edit.
nameTruthy text without |YesDisplay name; blank and "0" fail. Pipe characters are rejected.
type, report_typeInteger-compatible modesNoBoth default 0. Current type codes: 0 Job, 3 Job Table, 4 Quote, 5 Purchase Order, 6 Quote Table, 7 Invoice, 8 Invoice Table, 9 Opportunity, 10 Opportunity Table. This handler does not enforce that list.
fieldsNative array or JSON array textNoFull field list. Omitted/malformed/empty input becomes an empty list. Nameless definitions are removed; duplicate nonempty stable meta.id values are rejected.
replytoEmail textNoInvalid or omitted address becomes no-reply@fieldmotion.com.
template, themeTextNoBoth default empty. theme is stored in meta.
email_template_idInteger-compatible IDNoDefaults 0; unlike the mapped route, this name is snake_case.
onCompleteSerialized JSON textNoWhole legacy automation definition; defaults empty when saved. Ignored while Workflows is enabled, and skipped by onlyField.
autodocsSerialized JSON textNoWhole AutoDoc configuration; defaults empty, unless onlyField skips it.
report_docJSON textNoAutoDoc header/body/footer HTML. Defaults to an empty normalized document, unless onlyField. Uploaded image policy and normalization apply.
disable_pdf_conversion, disable_doc_export, send_notification, do_not_update_stock_levels, do_not_add_stock_to_job_costsInteger-compatible switchesNoStored metadata toggles; omission resets each to 0. These configure later workflows; the save does not execute them.
docx_exportFlagNoWhen present, 1/"1"/true enables meta.docx-export; other values disable it. Omission preserves saved state; new forms default off.
hide_from_job_history0/1, string 0/1 or booleanNoWhen provided, saves 0/1; omission preserves. Other values, including null, are rejected.
slotsStored valueNoIf set, replaces meta.slots; omission/null preserves.
required_skillsJSON textNoIf set, JSON-decoded into meta.required_skills; omission/null preserves.
attach_reports_inline_on_emailsEmpty, link or attachNoIf set, empty removes this metadata override, link/attach save it; other values fail. Omission preserves.
phpdocx_versionNumberNoIf set, float-converted and saved; omission preserves.
onlyFieldInteger-compatible legacy flagNoNonzero skips only automation/AutoDoc report assignments. It still overwrites other full-editor values and fields; avoid using it as a generic patch control.

Example request

$form = FM_api('Form_edit', [
	'id'=>'0','name'=>'Inspection','type'=>'0','report_type'=>'1',
	'fields'=>[['name'=>'Result','type'=>'input','meta'=>json_encode(['id'=>1042001])]],
	'onComplete'=>'[]','autodocs'=>'[]',
	'report_doc'=>json_encode(['header'=>'','body'=>'<p>Inspection</p>','footer'=>'']),
]);

Example response

{"id":1088,"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: name"}Name absent, blank or falsey.
{"error":"you cannot use the | symbol in your form name"}Name contains a pipe.
{"error":"form does not exist"}Positive ID does not match a form.
{"error":"permission denied"}Existing form edit lacks Forms Edit.
{"error":"invalid parameter: hide_from_job_history"}Unsupported history flag.

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

Behaviour and edge cases

  • Omission semantics are destructive for full lists and defaulted settings. onlyField does not preserve name/type/template/fields/replyto/report_type or the always-written metadata toggles.
  • Existing metadata is retained before explicitly overwritten keys are applied. Optional docx_export and hide_from_job_history preserve omitted values. New rows are initially inserted with portal_visibility=1 and server cdate.
  • When Workflows is off, validates nested setJobStatus values before saving on_complete. When Workflows is enabled, skips both that legacy automation assignment and its validation, preserving the existing stored definition.
  • AutoDoc image policy runs before normalization. Scripts/iframes, meta tags and event attributes are removed/disabled; embedded images can be resized and stored as form assets. Unsupported remote image references are rejected, while ordinary hyperlinks remain permitted.
  • Normalizes Asset field filter metadata, saves last_edited, synchronizes linked-table form_parents and records history. It does not rename/migrate historical Job answers. No list filtering or pagination applies.

Side effects

  • Validates attach_reports_inline_on_emails before inserting a new row or normalizing images. The definition, supported parent links, Undo baseline/snapshot and history are saved inside the checked SQL transaction; failed primary writes do not continue or claim success. Normalized image assets are external and can remain after SQL rollback.

See it in Fieldmotion

CRM1

Open Forms → edit a Form, change its fields or report configuration and Save. Filter Form_edit; the editor sends the full field array and snake_case settings. Imported definition creation also uses this route.

CRM2

The Form editor’s Save and AI-create flow call Form_edit. AutoDoc partial saves instead use Form_updateData. Compare report_doc here with autodocsDoc in that mapped route.

Related endpoints