OS templates allowed for rebuild on this VPS (service-specific filter)
GET/services/:id/os-templates
Selection list for the VPS rebuild operation. ENH-001 (live test 2026-05-19): the list is now service-specific — the ostemplates field returned by the Virtualizor act=rebuild&vpsid=X form-load call is parsed. This is the list filtered by the media group assigned to the VPS in Virtualizor. Previously the global list (act=ostemplates, 255+ OS) was returned, and when a reseller picked the wrong OS and rebuilt, Virtualizor threw "The OS you submitted is invalid". Now only allowed OSes are shown.
NOTE: The initial order (POST /orders) does NOT use this endpoint. During provisioning the WHMCS Virtualizor module assigns the OS from its own config options. This endpoint is only for the rebuild flow.
Cache: APCu, key os_templates:v2:vps:{vpsId} (per-VPS), TTL 300 seconds. A global key is NOT A SOLUTION because different VPSes can be in different media groups. Two VPSes in the same media group do not benefit from this cache — practical impact zero (the OS list updates about once a month).
Cache invalidation: Becomes visible within max 5 minutes after an operator adds a new OS image. An admin CLI hook for urgent invalidation is coming (Phase 4).
Rate limit: Default bucket (60 req/min).
vps_id null case: Returns 422 service_not_provisioned — a rebuild cannot be done for a service still awaiting provisioning anyway.
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OS template list
Response Headers
The per-minute limit defined for this key
Number of requests remaining in the current window
Unix epoch of the start of the next window (UTC seconds)
Authentication failed — missing header, wrong credential, outside the IP whitelist, or a revoked key. No detail is leaked; all cases return a single message.
Response Headers
RFC 7617 Basic Auth challenge
Insufficient authorization — the reseller tried to access another reseller's service_id, or has insufficient scope for an endpoint requiring admin scope. The message is kept generic (ServiceOwnershipMiddleware prevents leakage).
Resource not found (or hidden from the reseller). To prevent inventory/resource leakage between resellers, "not found" and "not accessible" return a single response.
The VPS is still awaiting provisioning (vps_id null). Since a rebuild cannot be done, the OS list cannot be fetched either. The reseller module should show a "waiting for OS list" message until provisioning completes.
Per-minute limit exceeded
Response Headers
Seconds to wait before retrying after a 429 (RFC 7231 §7.1.3)
The per-minute limit defined for this key
Unix epoch of the start of the next window (UTC seconds)