When to use this endpoint

Use Opportunity_setStatus for CRM1’s inline Status selector. CRM2 uses Opportunity_updateData, where its Quoted value is 3.

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.
valInteger stringYesReplacement status. Exact integer 2 invokes Opportunity_convertToQuote instead of a direct status update.

Example request

$result = FM_api('Opportunity_setStatus', [
	'id' => '481',
	'val' => '2',
]);

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.
{"error":"missing or invalid parameter: val"}val is omitted.
{"error":"opportunities is not existing."}The row is absent—or its current status is numeric zero, which the implementation also treats as missing.
{"ok":"1","warning":"no change required"}The requested integer loosely equals the current status.

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

Behaviour and edge cases

  • For values other than 2, the route writes the integer without checking a status row or transition rule.
  • The lookup/update does not exclude soft-deleted opportunities. A zero current status cannot be changed through this endpoint.

Side effects

  • Ordinary changes update status/last_edited and invalidate the opportunities cache, without audit/notifications.
  • Value 2 creates a quote and links it using Opportunity_convertToQuote, including that route’s quote audit entries.

See it in Fieldmotion

CRM1

The inline Status selector calls this route; rows already at status 2 are rendered as non-editable and linked to the quote.

CRM2

CRM2 uses mapped status updates and its own status constants; it does not call this route.

Related endpoints