Quotes: queries, documents and delivery
Generate a quote PDF or HTML preview
/a/Quote_getPdf
Render a quote through the report service and return base64 PDF bytes or HTML.
When to use this endpoint
Use for downloading or previewing the quote’s configured Form document. Quote_print is a separate basic browser print view.
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 |
|---|---|---|---|
id | Positive integer-compatible quote ID | Yes | Must resolve to an active quote. |
html | Integer-compatible switch | No | Nonzero requests HTML; default 0 returns PDF. HTML bypasses report caching. |
skip_cache | Integer-compatible switch | No | Nonzero bypasses the report cache for PDF generation. Default 0 permits a fresh cache; html=1 always bypasses. |
Example request
$pdf = FM_api('Quote_getPdf', ['id'=>'1042']);
Example response
{"ok":1,"base64":"JVBERi0x...","filename":"quote"}
With html=1 the response is {"ok":1,"html":"…","filename":"quote"}. PDF base64 is abbreviated here.
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"} | Missing/nonpositive ID. |
{"error":"quote does not exist"} | No active quote. |
{"error":"REPORTSERVER_URL not defined"} | Report service is not configured. |
{"error":"report generate route unavailable"} | Missing/non-JSON report response. Renderer errors can also pass through with filename. |
{"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
- Requires an active visible quote, then calls the report service as kind=quote using the quote’s Form. It does not recalculate costs or modify quote data as part of the read.
- html=1 requests fresh HTML; otherwise base64 contains PDF bytes. Explicit skip_cache is forwarded to the report helper, including for PDF generation. The service can populate a fresh document cache after rendering.
- quote-filename substitutes {{ID}}, {{NUMBER}}, {{DATE}}, {{CUSTOMER}} and {{CUSTOMER_STREET_ADDRESS1}}. DATE uses stored cdate; an empty setting defaults to quote. The wrapper adds filename even on service errors, without appending an extension.
- The current renderer reads Form fields/autodocs_doc, not the legacy account Word/PDF template settings. Report errors pass through.
- No direct caller for this endpoint was found in the mobile app or its m-service intermediary.
Side effects
- Read-only for business records: no implicit quote cost save, history, mail or Job-count cache repair. PDF generation/settings getters may populate their existing document/settings cache.
See it in Fieldmotion
CRM1
Quotes → PDF and Customer → Quotes → PDF call Quote_getPdf via requestReportPdf; filter Network for that exact function.
CRM2
Quotes → PDF and Job Costs quote preview call Quote_getPdf through requestReportPdf.
Related endpoints
Quote_printoutputs a basic HTML print summary.Quote_calculateCostexplicitly recalculates costs with checked permissions.