When to use this endpoint

Use for the old CKEditor template editor. The stored value is HTML/template text, not a DOCX upload and not the current Quote Form layout.

Authentication and permissions

Authenticate with signed API-key fields or a CRM session. Requires Quotes View (pageQuotes_view); non-admin users blocked by legacy crm_access bit 32 are denied. Client administrators inherit page permissions.

Requires Quotes Edit and client-administrator permission.

Quote visibility follows the account’s department/account-manager customer filters for non-admin users, including signed keys. Export routes additionally require pageMain_exportTableData. Linked Jobs require Jobs View and their TeamAccess scope; invoice enrichment requires Invoices View and the legacy invoice access check.

Parameters

ParameterTypeRequiredDescription
templateStringYesNonblank HTML/template text. Whitespace-only or literal 0 is rejected; HTMLPurifier removes unsafe HTML before the checked setting save.

Example request

$result = FM_api('Quotes_templateWordSet', ['template'=>'<p>Quote terms: valid for 30 days.</p>']);

Example response

{"ok":1}

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: template"}template absent/null, checked before tenant context.
{"error":"you are not an admin"}Not a client administrator.
{"error":"Could not save template as it is empty or not fully uploaded"}Filtered content is false-like, including empty text or literal 0.
{"error":"permission denied"}Required Quotes/Export permission is absent or legacy access restrictions apply.

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

Behaviour and edge cases

  • Requires nonblank HTML/template text; whitespace-only and literal 0 fail before persistence.
  • Uses the installed HTMLPurifier sanitizer instead of regex tag replacements. Removes executable tags/attributes and unsafe URLs while preserving supported formatting and ordinary template code text. This does not parse template-code semantics or save an uploaded DOCX.
  • Persists setting value and audit together under the tenant owner lock with checked acknowledgement and caller savepoints. Clears the settings cache; no quote/Form rows or PDF caches are rewritten.
  • No direct caller for this endpoint was found in the mobile app or its m-service intermediary.

Side effects

  • Updates the account setting and history in a checked transaction; clears the local settings cache. No email or quote/Form mutation.

See it in Fieldmotion

CRM1

Quote Word settings loads Quotes_templateWordGet, edits HTML in CKEditor and saves through Quotes_templateWordSet with template text.

CRM2

No direct caller found. CRM2 Quote layout/PDF actions use Forms.

Related endpoints