When to use this endpoint

Use File_setCustomerReadable for CRM1 portal-visibility toggles. CRM2 normally uses File_setField with field=customerReadable.

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-compatibleYesStored directly as an integer; callers use 1 to enable and 0 to disable.

Example request

$result = FM_api('File_setCustomerReadable', ['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":"not logged in"}No tenant database prefix exists.
{"error":"missing or invalid parameter: id"}ID is non-positive.
{"error":"missing or invalid parameter: val"}The key is absent; blank is accepted and becomes zero.
{"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

  • A matching row receives the integer flag and current server-local last_edited. No audit log, notification, or related-resource rebuild is performed.

See it in Fieldmotion

CRM1

Toggle customer can download or show in customer portal on legacy file tables.

CRM2

Modern Customer/Asset/Job file options use File_setField instead.

Related endpoints