Files
Set portal visibility metadata
/a/File_setShowInPortal
Add or remove the metadata flag used by Job-file portal visibility workflows.
When to use this endpoint
Use File_setShowInPortal where the consuming portal/report code expects meta.show_in_portal. Customer Files commonly use the separate customer_readable column.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive file ID. |
val | Integer-compatible | No | Truthy stores meta.show_in_portal=1; false/absent removes it. |
Example request
$result = FM_api('File_setShowInPortal', ['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":"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 before the flag is changed. The update has no timestamp, audit, or notification side effect.
See it in Fieldmotion
CRM1
On Job Files, toggle show in customer portal.
CRM2
Modern Job/file option menus call this route where that metadata flag is used.
Related endpoints
File_setEditNotesInPortalindependently controls editing.