Opportunities
Retrieve one opportunity
/a/Opportunity_get
Retrieve the fixed legacy field set for one non-deleted opportunity, with two optional flags.
When to use this endpoint
Use Opportunity_get when older code needs one simple opportunity object. Use Opportunity_getRequestedDetails for CRM2 mapped fields, metadata, forms, or batching.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Positive opportunity ID. |
fields | Native array or JSON array | No | May add only is_starred and/or reason. Unknown names are ignored; malformed JSON adds nothing. |
Example request
$opportunity = FM_api('Opportunity_get', [
'id' => '481',
'fields' => ['is_starred', 'reason'],
]);
Example response
{
"id": "481",
"user_id": "18",
"customer_id": "1042",
"value": "2500",
"notes": "Replace reception lighting",
"status": "1",
"marketing_source": "7",
"quote_id": null,
"is_starred": "1",
"reason": "0"
}
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"} | The ID is absent or integer-converts below one. This validation runs before the explicit login check. |
{"error":"opportunity does not exist"} | No non-deleted opportunity has that ID in the authenticated tenant. |
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 default fields are
id,user_id,customer_id,value,notes,status,marketing_source, andquote_id. They cannot be removed withfields. - Database scalar values are normally JSON strings and nullable columns remain
null. No related names or parsed notes/form values are added.
See it in Fieldmotion
CRM1
The current Opportunities screen gets rows through Opportunities_getDT; no direct production CRM1 call to this detail route was found.
CRM2
The CRM2 create regression flow and some integrations use it for a simple saved-value check; normal screens use mapped detail/data-table routes.
Related endpoints
Opportunity_getRequestedDetailsaccepts the full mapped field set and batches IDs.Opportunities_listreturns the basic fields for every non-deleted row.