Quotes: settings, costing and lookups
Read quote cost data
/a/Quote_costsGet
Read the quote’s stored costing payload with its current customer ID.
When to use this endpoint
Load this before editing costs or copying quote lines into another workflow. This is saved metadata, not a live price lookup or a recalculation.
Authentication and permissions
Authenticates a signed API key or CRM session as its tenant user. Requires Quotes View (pageQuotes_view). Non-admin users blocked by legacy crm_access bit 32 are denied. Roleless non-admin users fail closed. Client administrators inherit page permissions.
Uses local tenant IDs. No additional Quote owner/department predicate is applied; these endpoints do not return a visibility-filtered Job list.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer-compatible quote ID | Yes | Positive local quote ID, integer-converted; an active quote is required. |
Example request
$costs = FM_api('Quote_costsGet', ['id'=>'1042']);
Example response
{"stock":[],"labour":[],"sor":[],"other":[],"customer_id":"1088"}
The example is the no-costs default. If meta.costs exists, that structure is returned as stored with customer_id overwritten from the quote column. Missing section keys are not normalized in that branch; extra fields and stored scalar types remain.
verbose is supported by the calculation/UI path but is absent from the default empty envelope. Summary keys such as stock_total_price can be present when saved or previously calculated.
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: id"} | ID missing/null/nonpositive. |
{"error":"no such quote"} | No active quote or failed row read. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Requires deleted=0. Decodes outer meta; absent costs returns stock/labour/sor/other empty arrays plus customer_id. It does not add all empty sections to an existing costs object.
- No catalogue hydration, tax calculation, rounding, discount application, ordering or pagination. A customer_id stored inside costs cannot override the actual quote customer in this response.
- Assumes an array-like existing costs value. Malformed scalar costs metadata has no stable recovery contract; it is not validated into a canonical costing object.
- No direct mobile app/m-service caller for this RPC was found. This is a CRM quotation workflow.
Side effects
- Read-only; no totals write, cache invalidation, audit, file access or message.
See it in Fieldmotion
CRM1
Quotes → Costs opens widgetQuoteCosts and calls Quote_costsGet. Invoice and requisition workflows also read it when copying quote data.
CRM2
No direct Quote_costsGet caller found. moduleQuotes uses mapped cost widgets and then Quote_calculateCost after saving.
Related endpoints
Quote_costsSetreplaces the saved payload using supplied summaries.Quote_calculateCostrebuilds totals from rows.