When to use this endpoint

Call Assets_export from a browser or form submission when the fixed CRM1 CSV layout is required. The response is a file download, not JSON.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login or an established tenant database context and performs no additional Asset-page or role-permission check unless the page says otherwise.

Every query and write uses the authenticated tenant’s tables. CRM1 and CRM2 may hide actions through client-side permissions that these collection routes do not repeat.

Parameters

ParameterTypeRequiredDescription
search / book_id / serial_number / nameStringNoCase-insensitive substring filters. General search checks book ID, code, type name, and asset name.
type_id / owner_idInteger-compatibleNoExact type or owner filters.
location_id / location_typeIntegersNoExact whereabouts pair, applied when the location ID is positive and not -1.
archivedInteger-compatibleNoPresence applies an exact archive-state filter.
days-from / days-toInteger day offsetsNoRelative local-date window used for linked-job counts or rows. It does not restrict which assets are selected.
one-line-per-jobInteger-compatibleNoA positive value outputs one row for each movement-linked job in the date window. Assets with no matching job then produce no row.

Example request

// Submit as a browser/form request because the response is CSV.
FM_api('Assets_export', [
	'archived' => '0',
	'days-from' => '-30',
	'days-to' => '0',
]);

Example response

Asset ID,Book ID,Asset Name,Type,Code,Value,Owner,Location Type,Location,Warranty,Make,Model,Vehicle Reg,URL,Active,Archived,Last Visited,Jobs in Selected Date Range
4821,BK-004,Compressor 4,Compressor,CMP-004,2500.00,Northwind Service Centre,Location,Plant Room,2027-01-01,ACME,X4,241-D-1234,https://example.test,Yes,No,2026-09-20,3

The download filename is assets.csv. Every legacy field configured on Asset Types is appended as a cust[field name] column; user-type values are replaced with user names.

Location type values are rendered as Location, Customer, or Parent Asset. The last-visited column comes from the most recent completed movement-linked job.

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.
Empty CSV body or server errorThe temporary file cannot be written or a legacy lookup/query fails; the route has no structured JSON error envelope.

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

Behaviour and edge cases

  • Soft-deleted assets are always excluded. Active and inactive assets are both eligible unless another filter removes them.
  • Normal mode emits one row per asset and a count of linked jobs in the date range. Per-job mode replaces that count with job details and omits assets without a matching job.
  • The endpoint creates a tenant-scoped temporary CSV, streams it, and exits the request. It does not alter Asset or job records.

See it in Fieldmotion

CRM1

On Assets, choose the legacy CSV export and submit the current filters. CRM1 navigates directly to this download route.

CRM2

No production CRM2 caller was found. CRM2 uses mapped export selection and Assets_getAssetTableExportData.

Related endpoints