When to use this endpoint

Use File_setNotes for CRM1 inline note editing. CRM2 normally sends notes through File_updateData.

Authentication and permissions

Normal API transport requires signed API-key fields or a logged-in CRM session and a tenant context. Session CSRF applies except for the dispatcher’s upload/download exceptions.

These handlers do not add general Files Add/Edit/Delete or file-owner role checks. UI visibility is not that protection. Configured team-scope entry checks are separate and may validate the linked record and its Edit permission before a handler runs; see the route-specific note below. This does not introduce CRM2 role requirements for ordinary CRM1 requests.

When department/team or Assigned Jobs Only scope is configured for the actor, the dispatcher adds record-scope checks. This is selected by account features/actor flags, separately from the CRM2-only Files View check; the existing TeamAccess entry guard has no CRM-version condition. The dispatcher recognizes id/ids while this handler writes fileId; a fileId-only request may therefore be rejected before it runs. Do not supply a different ID merely to bypass this check.

Parameters

ParameterTypeRequiredDescription
fileIdInteger-compatibleEffectively yesFile ID. The key is not presence-validated; omitted/nonnumeric becomes zero and normally returns file not found. Use the tenant file-record ID returned by upload/list/detail calls. This is separate from type_id/typeId (the linked resource ID), and from the random token in a storage URL.
notesStringYesReplacement notes. Empty string is valid.

Example request

$result = FM_api('File_setNotes', ['fileId' => '4821', 'notes' => 'Check pressure before service.']);

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: notes"}The notes key is absent.
{"error":"file not found"}No live row exists for the ID, including zero or a deleted file.

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

Behaviour and edge cases

  • A live row receives the notes and current server-local last_edited. For User files (type 4), the endpoint also writes a User audit message containing a shortened filename.
  • Other file types receive no audit event or notification.
  • No pagination applies to this write. A success acknowledgement from a dedicated metadata switch does not prove a checked database commit; those handlers do not inspect the update result. Generic mapped writers check their primary UPDATE but later history/notification work is separate.

Side effects

  • Updates notes and last_edited, invalidates files cache, and for a positive User-file parent writes a User audit message. Other file types receive no extra User audit. The database update result is not checked before returning success.

See it in Fieldmotion

CRM1

Edit Notes on Customer, Job, Asset, User, Task, recurring-Job, or related file tables.

CRM2

Modern file tables use File_updateData; no direct current CRM2 caller was found.

Related endpoints