When to use this endpoint

Use MarketingSource_createData for CRM2’s create workflow or when the new row ID is required. The legacy MarketingSource_new route returns success without the ID.

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
idInteger-compatible or native arrayNoIgnored for creation; the database assigns the ID.
nameStringYesLead-source name, maximum 100 characters. It must be nonempty during mapped creation.
createDateUnix timestamp or date stringNoMapped creation time stored as a Unix timestamp. Creation defaults to the current server time; nonnumeric strings are parsed with strtotime().
lastEditedUnix timestamp or date stringNoMapped edit time stored as a Unix timestamp. Creation defaults to now and ordinary updates advance it automatically.

Example request

$source = FM_api('MarketingSource_createData', [
	'name' => 'Trade show',
]);

Example response

{"ok":1,"id":30124}

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.
{"error":"missing or invalid parameter: name"}name is absent or blank.
{"error":"name is too long."}The name exceeds 100 characters.

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

Behaviour and edge cases

  • No duplicate-name check is performed. Names that differ only by case, or exact duplicates, can coexist.
  • createDate and lastEdited default to the current server Unix timestamp when omitted.
  • Marketing-source rows have no active or soft-delete flag.

Side effects

  • Inserts the tenant row, invalidates the marketing-source cache, and writes Core history entries for supplied/defaulted fields.

See it in Fieldmotion

CRM1

CRM1’s Source Create dialog calls MarketingSource_new, not this mapped route.

CRM2

Open Marketing → Marketing Lead Source in CRM2 and filter browser developer tools for the exact function name. Choose Create; the shared display widget derives MarketingSource_createData from the page API prefix.

Related endpoints