When to use this endpoint

Use File_setEditNotesInPortal after portal visibility is enabled. CRM screens clear this flag when hiding the file, but the API does not enforce that relationship.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session and establish the tenant database context.

The handler performs no record-owner or resource-specific permission check. CRM screens may hide the action, but callers with tenant API/session access can target any matching file ID.

Parameters

ParameterTypeRequiredDescription
idInteger-compatibleYesPositive file ID.
valInteger-compatibleNoTruthy stores meta.edit_notes_in_portal=1; absent, zero, or nonnumeric removes the key.

Example request

$result = FM_api('File_setEditNotesInPortal', ['id' => '4821', 'val' => '1']);

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: id"}ID is non-positive.
{"error":"file not found"}The ID does not identify a live 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

  • Malformed legacy metadata is normalized to an empty object before the flag is changed. The update does not change last_edited or write an audit entry.

See it in Fieldmotion

CRM1

On Customer Files, expand portal options and toggle Edit notes in customer portal.

CRM2

The Customer, Job, User, Asset, and Asset Type file option dialogs call this route; hiding a portal file also calls it with zero.

Related endpoints