When to use this endpoint

Use Opportunity_convertToQuote for the legacy single-row Convert action. CRM2 status edits normally go through Opportunity_updateData, which invokes this route internally with a special hand-off flag.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesOpportunity ID after integer conversion. Presence, rather than a positive value, is validated.
fromUpdateDataInteger stringInternal onlyWith value 1 in a CRM2 session, return the new quote ID without updating the opportunity; the outer update writes the status and link. Other callers should omit it.

Example request

$result = FM_api('Opportunity_convertToQuote', [
	'id' => '481',
]);

Example response

{
  "ok": 1,
  "quoteId": 9021
}

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.
{"error":"missing or invalid parameter: id"}id is omitted. A present zero/blank ID proceeds and normally fails while creating the quote because no customer/user was loaded.
{"error":"missing or invalid parameter: customer_id"}The opportunity does not exist, or its customer ID integer-converts below one.
{"error":"missing or invalid parameter: user_id"}The stored assigned-user ID integer-converts below one.
{"error":"no such customer"}The referenced customer row does not exist. The quote helper does not exclude a soft-deleted customer.
{"0":"no such user"}The referenced user row does not exist; this legacy error has no error key.
{"ok":0,"error":"There was a problem creating the quote."}The quote insert fails.

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

Behaviour and edge cases

  • The quote receives the opportunity’s assigned user, customer, value as total_net/profit, notes, and lead source. Tax, gross total, and discount default to zero; sale chance defaults to 100; the quote starts at status -1 with a new quote number.
  • The opportunity lookup does not exclude soft-deleted rows and does not check its current status or quote link. Repeating the call can create another quote and replace quote_id.
  • Except for the CRM2 hand-off case, the route writes status 2, the new quote ID, and the current server epoch to last_edited.

Side effects

  • Creates and audit-logs a quote, then records an additional quote audit entry saying it was created from this opportunity.
  • Invalidates the opportunities cache when it links the quote. It sends no opportunity notification or mention notice.

See it in Fieldmotion

CRM1

The Opportunities table’s Convert button calls this route and treats status 2 as converted.

CRM2

The Opportunities table’s row-level Convert action calls this route directly. Status edits to CRM2’s Quoted value instead use Opportunity_updateData.

Related endpoints