Quotes: queries, documents and delivery
Read a selected batch of quote fields
/a/Quotes_getById
Fetch active quotes by primary ID using a small allowlist of raw database fields.
When to use this endpoint
Use after a list/export selection supplies IDs. This is not the full raw Quote_get row or the mapped CRM2 field contract.
Authentication and permissions
Authenticate with signed API-key fields or a CRM session. Requires Quotes View (pageQuotes_view); non-admin users blocked by legacy crm_access bit 32 are denied. Client administrators inherit page permissions.
Quote visibility follows the account’s department/account-manager customer filters for non-admin users, including signed keys. Export routes additionally require pageMain_exportTableData. Linked Jobs require Jobs View and their TeamAccess scope; invoice enrichment requires Invoices View and the legacy invoice access check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | Native array or JSON-encoded array | Yes | Integer-converts and deduplicates entries. An empty list fails; missing/deleted IDs are omitted. Invalid JSON/non-lists are not safely normalized. |
fields | JSON-encoded array of strings | No | Defaults to all allowed fields: id, quote_num, cdate, notes, total_net, total_tax, total_gross, status, cost, profit, discount_rate, won_date, marketing_source and date_expiry. Unknown names and duplicates are dropped. An explicit selection with no valid fields fails. Native fields arrays are not accepted by the JSON decoder. |
Example request
$quotes = FM_api('Quotes_getById', [
'ids'=>json_encode(['1042','1088']),
'fields'=>json_encode(['id','quote_num','total_gross']),
]);
Example response
[{"id":"1042","quote_num":"QT-1042","total_gross":"120.00"}]
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"} | ids missing/null. |
{"error":"no ids in list"} | No IDs remain after parsing. |
{"error":"no fields selected"} | Explicit fields contains no supported fields. |
{"error":"permission denied"} | Required Quotes/Export permission is absent or legacy access restrictions apply. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- ids must be a nonempty native list or encoded JSON list of positive IDs. Malformed, object-keyed and scalar JSON inputs fail before SQL. Entries are deduplicated; deleted/invisible/missing records are omitted.
- fields remains an encoded JSON list of names from the existing raw allowlist. Unsupported names are ignored; an all-unsupported selection fails. Malformed field structures produce explicit errors. id is not added when omitted from fields.
- Returns database strings/null without JSON-column expansion. No guaranteed ID-input order, pagination or batch cap.
- No direct caller for this endpoint was found in the mobile app or its m-service intermediary.
Side effects
- Reads active permitted records without quote cost, history, email or derived Job-cache writes.
See it in Fieldmotion
CRM1
Export widgets use Quotes_getById to resolve quote fields for selected references; inspect widgetExport Network requests.
CRM2
Export/CRM2 export widgets resolve selected quote IDs through Quotes_getById with encoded ids and fields.
Related endpoints
Quote_getreads one complete active raw row.Quote_getRequestedDetailsuses native mapped field arrays.