When to use this endpoint

Use Opportunity_restore only from the Admin deleted-object recovery workflow after an opportunity was soft-deleted.

Authentication and permissions

The request must have a logged-in tenant session whose login_source is exactly admin-console. A normal CRM session or signed API-key login is rejected.

The row is resolved only inside that authenticated tenant.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive ID of a currently soft-deleted opportunity.

Example request

$restored = FM_api('Opportunity_restore', [
	'id' => '481',
]);

Example response

{
  "ok": 1,
  "type": "opportunity",
  "id": 481,
  "label": "Opportunity #481 (Replace reception lighting)",
  "summary": {"type":"opportunity","id":481,"notes":"Replace reception lighting","name":"Replace reception lighting"}
}

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"}The ID integer-converts below one.
{"error":"admin console login required"}Login exists but did not originate from the Admin console.
{"error":"deleted opportunity not found"}The tenant has no opportunity with that ID and deleted=1.

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

Behaviour and edge cases

  • Sets deleted=0 and ddate=0. It does not validate linked customer/user/status rows or restore any related object.
  • The label appends the stored notes when nonblank. The summary contains type, numeric id, notes, and a duplicate name derived from those notes.

Side effects

  • Invalidates the opportunities cache and marks the newest active matching deletion-log row as restored, recording time, acting user, and restore function. A missing log row does not prevent restoration.
  • Does not update last_edited, write a generic opportunity audit entry, or send notifications.

See it in Fieldmotion

CRM1

Normal CRM1 screens do not expose this recovery route.

CRM2

Normal CRM2 screens do not expose this recovery route; it belongs to the separate Admin deleted-object workflow.

Related endpoints