When to use this endpoint

Use MarketingExpenses_list only for a small tenant-wide snapshot. It has no filters, pagination, edit checkpoint, or ordering.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but performs no additional Marketing-page, create, edit, delete, or role-permission check.

All reads and writes use the authenticated tenant’s tables. CRM1 and CRM2 hide some controls through client-side permissions; these routes do not repeat those UI checks.

Parameters

ParameterTypeRequiredDescription
fieldsJSON array or native arrayNoOptional additions from expense and expense_date. id and source_id are always present. Unknown names are ignored.

Example request

$expenses = FM_api('MarketingExpenses_list', [
	'fields' => json_encode(['expense', 'expense_date']),
]);

Example response

[
  {"id":"7124","source_id":"30124","expense":"425.5","expense_date":"2026-10-01"}
]

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.
[]The tenant has no expense rows.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Fields use raw snake-case database names, unlike mapped expense routes.
  • There is no source-existence join; orphaned source_id values remain visible.
  • Malformed fields JSON and unknown field names are ignored.
  • No order is specified and there is no active/deleted state.

See it in Fieldmotion

CRM1

No production CRM1 caller was found; the Settings page uses MarketingExpenses_getDT.

CRM2

No production CRM2 caller was found; the Marketing Expenses page uses MarketingExpenses_getDataTable.

Related endpoints