When to use this endpoint

Use Opportunities_convertToQuote for CRM2’s bulk Convert action only when legacy status-2 semantics are acceptable.

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
idsNon-empty native integer arrayYesOpportunity IDs inserted into an SQL IN list. The implementation neither decodes JSON nor integer-sanitizes entries.

Example request

$result = FM_api('Opportunities_convertToQuote', [
	'ids' => [481, 482],
]);

Example response

{
  "ok": 1
}

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: ids"}ids is omitted.
Runtime type/database errorids is not a native array, is empty, or contains values that produce invalid SQL.
Quote-creation errorAny selected row’s user/customer is invalid or its quote insert fails. Processing stops at that row; earlier rows remain converted.

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

Behaviour and edge cases

  • Rows already at status 2 are skipped. Other statuses—including CRM2 status 3—are converted again; missing IDs are silently absent.
  • Each quote receives assigned user, customer, value as net/profit, notes, and lead source. The opportunity then gets status 2, quote_id, and current last_edited.
  • The response does not report created quote IDs or per-ID outcomes.

Side effects

  • Creates and audit-logs one quote per selected eligible row, then invalidates the opportunities cache for each link update.
  • Does not add the single-route “created from opportunity” audit message and sends no opportunity notifications.

See it in Fieldmotion

CRM1

CRM1 exposes only the row-level conversion control.

CRM2

The table’s bulk Convert action calls this route when the user has the client-side edit permission.

Related endpoints