When to use this endpoint

Use ScheduleOfRates_setArchived for CRM1’s archive/unarchive action. CRM2 updates the same field through ScheduleOfRate_updateData.

Authentication and permissions

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

All reads and writes use the authenticated tenant. The CRM screens apply client-side Schedule of Rates permissions, but those controls are not repeated by this endpoint.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive tenant-local rate ID.
archivedInteger stringYes in practiceInteger value stored without restricting it to 0/1. Omission is not validated and is coerced toward 0 with a runtime notice.

Example request

FM_api('ScheduleOfRates_setArchived', [
	'id' => '430001',
	'archived' => 1,
]);

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: id"}The ID is absent or not positive.
{"ok":1}The positive ID does not exist; absence is not reported.

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

Behaviour and edge cases

  • Always executes the update, advances last_edited, and returns success; it does not detect a no-op.
  • Archive state affects only callers that filter or visually suppress it. The legacy list route still returns archived rows.

Side effects

  • Advances the scheduleOfRates cache marker.
  • Fires the tenant-configurable SOR_edit event with the rate ID. Any configured listeners run synchronously and can add integration-specific side effects.

See it in Fieldmotion

CRM1

The Archive/Unarchive action on the Schedule of Rates page calls this route.

CRM2

CRM2 sends archived through ScheduleOfRate_updateData, including bulk changes.

Related endpoints