Forms
Export filtered forms
/a/Forms_getExportData
Run the two-phase Forms CSV export contract: first select IDs, then fetch requested export columns.
When to use this endpoint
Use _ids=1 with table filters to capture the export set, then submit those IDs as JSON with the chosen field names. CRM1 and CRM2 exporters both use this contract.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session and is scoped to the authenticated tenant.
The handler performs no form, department, owner, or page-permission check unless the page below says otherwise. CRM navigation may impose additional UI-only access rules.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
_ids | String | Yes | Exact 1 starts the ID phase. Otherwise it must be a JSON array of IDs for the data phase. |
type / archived / search / id / name / metaTags | Mixed | ID phase | Basic filters. Type defaults to 0; -1 means all types. Archived values below 2 filter exactly; 2 means both. Search covers ID, name, creation date, and raw metadata. |
typeIDList / portalVisibilityList / usesStockList / isInvoiceableList / selectByDefaultList / archivedList / departmentIDList | Native array | No | Validated export inclusion lists. |
referenceDateField / dateFromFilter / dateToFilter / isDateUnix | String / mixed | No | Date-range filter. Both bounds and a recognized field are required; recognized fields include ID, creation/edit date, type, archive, department, portal, stock, invoice, and default-selection fields. |
fields | JSON array string | Data phase | Allowed names: archived, id, cdate, department_id, is_invoiceable, meta.tags, name, on_complete, portal_visibility, portal_pickable, select_by_default, form_tables, type, and uses_stock. Colon-containing custom-field names are silently skipped. |
Example request
$selection = FM_api('Forms_getExportData', [
'_ids' => '1',
'type' => '0',
'archived' => '0',
]);
$rows = FM_api('Forms_getExportData', [
'_ids' => json_encode($selection['ids']),
'fields' => json_encode(['id', 'name', 'type', 'portal_visibility', 'portal_pickable']),
]);
Example response
[
{"form_id": "1042", "meta": "{\"tags\":\"service\"}", "f0": "1042", "f1": "Service visit", "f2": "Job", "f3": "yes", "f4": "no"}
]
Requested columns are returned as positional aliases f0, f1, and so on; form_id and raw meta are always added.
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: _ids"} | Mode selector is absent. |
{"error":"_ids should be a JSON array of numbers"} | Data-phase IDs do not decode to a non-empty array. |
{"error":"fields should be an array of requested field names"} | Fields are absent, malformed, or empty. |
{"error":"unknown field name: ..."} | A non-custom field is outside the allowlist. |
{"error":"invalid filter value: ..."} | A shared inclusion/date filter rejects a value. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- ID-phase results are ascending numeric IDs and are not paginated.
- Boolean-like export columns become
yes/no. Type numbers are converted to display labels.form_tablescounts fields whose type issubform. meta,meta.tags,portal_visibility, andportal_pickablecan each be requested independently. Pickable is bit 2 of the stored portal visibility value.- The data phase does not preserve requested ID order and does not reject missing IDs. It assumes valid JSON in
on_completeandfieldsfor derived columns.
See it in Fieldmotion
CRM1
The Forms page export widget performs the two calls.
CRM2
The Forms page first obtains filtered IDs through the modern table, then uses this endpoint to format selected export columns.
Related endpoints
Forms_getDataTablesupplies CRM2 filter state.Forms_listis a lightweight non-export list.