Skip to main content

Upgrade the service's config options

POST 

/services/:id/upgrade

Upgrades the service's configurable options (resource-role groups like RAM/CPU/disk) to new values. The WHMCS UpgradeProduct action is called with type=configoptions; the prorata difference is calculated on the WHMCS side.

Two modes:

  • quote_only=true → with WHMCS calconly=1 returns ONLY a price quote (no order/invoice is created, quote=true).
  • quote_only=false (default) → the real upgrade is applied. A difference invoice is created, and the reseller's credit is applied automatically (same as the OrderService ApplyCredit pattern: pending_provision / pending_payment / payment_failed).

Lock guard: Only role=resource groups (RAM/CPU/disk) can be changed via upgrade. Other groups (fixed, old location, or those with no metadata → safe default locked) CANNOT BE CHANGED; if a selection in these groups is changed it returns 422 location_locked. Leaving it at the same value is valid.

Full config (merge): The FULL config is always sent to WHMCS (all of the service's current selections + the reseller's deltas). Because WHMCS resets an unsent config option to the product's default (1st) value (which would give the wrong location + wrong prorata), no selection — including location — is reset.

Downgrade forbidden: If WHMCS returns negative prorata (credit/refund) it returns 409 downgrade_not_allowed.

Conflict: If there is a previous unpaid upgrade invoice for the service, or WHMCS reports upgradeinprogress, 409 upgrade_conflict.

Idempotency-Key: REQUIRED (POST — 24h replay protection).

Rate limit: services_changes bucket (120 rpm).

Body: config_options = { "<whmcs_config_option_id>": <selection_id_or_quantity> } (cannot be empty, int=>int). quote_only optional bool (default false).

Request

Responses

Upgrade applied or quote returned (depending on quote_only)

Response Headers
    X-RateLimit-Limit

    The per-minute limit defined for this key

    X-RateLimit-Remaining

    Number of requests remaining in the current window

    X-RateLimit-Reset

    Unix epoch of the start of the next window (UTC seconds)