Files
Set customer file visibility
/a/File_setCustomerReadable
Set the legacy file-level flag that allows a customer to see or download a file.
When to use this endpoint
Use File_setCustomerReadable for CRM1 portal-visibility toggles. CRM2 normally uses File_setField with field=customerReadable.
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. Explicit id/ids values are checked against visible file records. Other filename-only selections or mapped-filter-only bulk mutations can be rejected for lacking an explicit scoped selection.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive file ID. 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. |
val | Integer-compatible | Yes | Stored 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
| Response | Condition |
|---|---|
{"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. - 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 customer_readable and last_edited. This handler does not request file-cache invalidation or audit/notification and does not check database acknowledgement.
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
File_setFieldis the mapped replacement.File_setEditNotesInPortalcontrols portal note editing.- File identifiers and downloads explains file ID, resource ID, type enum, stored URL and the different content response shapes.