Email imports: configuration and diagnostics
Remove a task email-import configuration
/a/ImportTasksEmail_delete
Remove a task email-import configuration
When to use this endpoint
Remove an email-import routing configuration that is no longer required. Confirm the selected ID first: this endpoint removes the configuration itself, not the objects previously imported through it.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. The handler calls Core_requireLogin(); it has no separate page, administrator, or role-permission check.
The account must have Import By Email enabled (employer|features bit 32768). There is no separate page, administrator, or role-permission check in these handlers.
The shared mutation helper selects the global database explicitly and locks the authenticated tenant owner and selected configuration rows. Every target must belong to that tenant and match this route’s configuration type: 0 job, 1 customer, or 2 task. Missing, foreign-owned, and wrong-type targets return the same that import does not exist error (the capture setter retains its dedicated not-found message).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer | Yes | ID of an owned configuration of this family. Full positive integer validation is required; omitted, blank, zero, negative, fractional, and malformed IDs are rejected. |
Example request
$result = FM_api('ImportTasksEmail_delete', [
'id' => '1042',
]);
Example response
{"ok":1}
Normal success is {"ok":1}.
Missing, foreign, and wrong-type targets return {"error":"that import does not exist"}, rather than success. A failed primary write is an error and does not clear the feature marker.
If the global deletion commits but tenant history fails, returns saved:1 and a no-replay warning. For the customer/job SQL-string response this is an object carrying the string in result.
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"} | The integer-converted ID is less than one; checked before authentication. |
{"error":"Import By Email feature not enabled"} | The account feature bit is disabled. |
{"error":"that import does not exist"} | No row of this family owned by the authenticated tenant was found. Bulk edits preflight every selected row before writing. |
{"error":"email import write failed"} | A checked global write or insert-ID retrieval failed; the global transaction is rolled back. |
{"error":"email import read failed"} | The checked lookup failed; no configuration write is committed. |
{"error":"email import transaction failed"} | Beginning or committing the global transaction failed. Inspect the configuration before retrying an uncertain commit. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Deletes only an owned configuration of this family; existing customers, jobs, tasks, historical import logs and queued sample mail remain untouched.
- The global row deletion and feature-marker maintenance are transactional and checked. The retention mechanism remains physical deletion pending a separately approved migration.
Side effects
- The primary configuration write uses checked global persistence, advances Unix-seconds
last_edited, and requestsimport_filterscache invalidation. A changed write and any global feature-marker update commit together; a failure rolls back the global transaction. - Change history is written to the authenticated tenant after the global commit, once per changed configuration. These are separate database contexts, not an atomic cross-database audit. If history fails, the committed result includes
saved:1and a warning to avoid replaying the write. For a SQL-string deletion response, the warning result is an object withok:1and the original string underresult. - No mailbox is fetched and no business object is imported synchronously by this configuration mutation.
- If no global email-import filters of any type remain for the owner, clears
employers.features_usedbit4in the same global transaction. This does not change the Import By Email entitlement.
See it in Fieldmotion
CRM1
In Imports → Tasks by Email, delete a row and confirm the browser prompt. Filter for ImportTasksEmail_delete; the server itself does not require a confirmation token.
CRM2
In Tasks by Email, delete a row or selected rows and confirm the UI prompt. Filter for ImportTasksEmail_delete; the list iterates selected IDs through this route.
Related endpoints
- ImportTasksEmail_getDetails: inspect the owned row before removing it.
- ImportTasksEmail_save: create a replacement configuration with a newly generated recipient.