Customer SFTP imports
Enable or disable a customer SFTP source
/a/ImportCustomersFtp_setStatus
Store source status and reconcile the account’s SFTP usage marker.
When to use this endpoint
Enable only after the connection and map have been checked. The scheduled worker selects any nonzero status.
Authentication and permissions
Use signed API-key authentication or a logged-in CRM session. API keys act as their owner; session requests use dispatcher CSRF protection when configured.
Requires a valid tenant account and View on pageImportsCustomersFtp plus Edit. Source IDs and counts are restricted to the authenticated account owner; client-supplied ownership cannot expand access.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer or decimal integer string | Yes | Use the source or tenant row ID returned by its list/table. Fractions, negative numbers, arrays and out-of-range integers are rejected. This is not the import run token. |
val | 0 or 1 integer/string | Yes | 0 disables and 1 enables; other values are rejected. |
Example request
$result = FM_api('ImportCustomersFtp_setStatus', ['id'=>'18','val'=>'0']);
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": "permission denied"} | The user lacks the required Imports page action. |
{"error": "missing or invalid parameter: id"} | A required row ID is missing or invalid. |
{"error": "no such entry"} | The requested owned source or tenant row does not exist. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Checks ownership and updates status/last_edited only when changed. Reconciles features_used bit 8 from all account-owned sources with nonzero status; other feature bits remain unchanged. The two changes share a checked global transaction.
- Mapped status edits use the same bookkeeping. Enabling does not test the connection or map, and does not run immediately. Disabling does not undo completed imports.
- Checked database writes roll back within their database transaction. Global source settings and tenant audit writes are separate commits: saved=1 with a warning means the setting was saved but a follow-up failed. Inspect the saved state; do not blindly repeat a write.
Side effects
- Writes source configuration/timestamps and usage bookkeeping, invalidates cache and adds a redacted tenant audit. Does not import customers.
See it in Fieldmotion
CRM1
In CRM1, open Settings > Imports > Customers FTP. Change the Status selector; inspect ImportCustomersFtp_setStatus.
CRM2
In CRM2, open Imports > Customers FTP. Status is edited through the generic mapped table (ImportCustomersFtp_updateData); that path reconciles the same feature-usage marker.
Related endpoints
ImportCustomersFtp_save— Configure an owned source.ImportsCustomersFtp_getDataTable— Discover source rows and IDs.ImportCustomersFtp_getImportMaps— Inspect map choices before running.ImportCustomersFtp_runOnce— Understand import writes and remote cleanup.