Compute API
Read your resource inventory, activity, metrics, blast radius, and recommendations, start and stop resources, approve remediation steps, and inspect existing autoscaling policies over REST.
The Compute API exposes the same inventory, recommendations, and actions you see in Cloud Estate → Inventory and Recommendations, so you can script them from CI, runbooks, or your own tools.
Base URL and auth
Paths on this page are relative to your ZopNight API host. Every route is scoped to one organisation, under /orgs/{orgID}.
Send a personal access token in the Authorization: Bearer header. See Authentication for how to create one. A token acts as your user, limited to the organisations and write capabilities chosen when it was created. Every route maps to an RBAC policy, and a role scoped to a list of resources sees only those resources in every response.
curl "$ZOPNIGHT_API/orgs/$ORG_ID/resources?view=parents&provider=aws" \ -H "Authorization: Bearer $ZOPNIGHT_PAT"List resources
GET /orgs/{orgID}/resourcesReturns the discovered inventory, the same data as Cloud Estate → Inventory.
| Parameter | Type | Description |
|---|---|---|
view | string | parents returns top-level resources (clusters, servers, registries) with their children counted. children returns the children of one parent. One of parents, children. |
parent_uid | string | With view=children, the parent whose children to return. |
provider | string | Returns every account of that provider. One of aws, gcp, azure. |
cloud_account_id | string | One cloud account ID, or several separated by commas. |
GET /orgs/{orgID}/resources/filter-fieldsReturns the distinct values you can filter the current view by (resource type, status, region, cloud account, and whether a resource is schedulable). It accepts the same view parameters, so the options narrow to what the view contains.
Resource activity, metrics, and ownership
GET /orgs/{orgID}/resources/activity-eventsReturns the raw control-plane events read from CloudTrail, Cloud Logging, and the Azure Activity Log.
GET /orgs/{orgID}/reports/resources/activityReturns one resource’s operations, bucketed over time. It backs the Recent Activity tab in the recommendation drawer.
| Parameter | Type | Description |
|---|---|---|
resource_uid | string | The resource whose activity to return. |
GET /orgs/{orgID}/reports/resources/metricsReturns per-resource metrics, plus an ownership object with the creator and the lastWriteEvent (caller, operation, timestamp, and whether the caller is a person).
Blast radius
GET /orgs/{orgID}/resources/blast-radiusReturns the resources one hop away from the target and how the operation affects each one (At Risk, Warning, or Safe; At Risk means the resource is affected). See Blast radius for how impact is classified.
| Parameter | Type | Description |
|---|---|---|
target_type | string | The kind of target. One of resource, autoscaler_policy, schedule. |
target_id | string | The target’s ID. For a resource, its UID. |
operation | string | The change you plan, such as delete or stop. |
curl "$ZOPNIGHT_API/orgs/$ORG_ID/resources/blast-radius?target_type=resource&target_id=$UID&operation=delete" \ -H "Authorization: Bearer $ZOPNIGHT_PAT"Recommendations for a resource
GET /orgs/{orgID}/recommendationsReturns recommendations. Each one carries its title, description, current and optimised cost, potential savings, cloud account, and the evidence that fired it.
| Filter | Description |
|---|---|
status | For example, open. |
provider | The provider, for example aws. |
category | The recommendation category. |
resource_type | Comma-separated. |
severity | The severity. |
cloud_account_id | Comma-separated. |
search | Free-text search. |
resource_uid | Recommendations for one resource. |
GET /orgs/{orgID}/recommendations/countTakes the same filters as the list and returns how many match.
GET /orgs/{orgID}/recommendations/{id}Returns one recommendation.
GET /orgs/{orgID}/recommendations/activityReturns the history timeline (generated, viewed, bookmarked, applied, dismissed, reopened, closed) for up to 200 recommendations in one request. It is gated exactly like the recommendations it describes.
| Parameter | Type | Description |
|---|---|---|
rec_id | string | One or more recommendation IDs, separated by commas (at most 200). |
Start and stop
POST /orgs/{orgID}/actionsSubmits a manual or bulk start or stop.
- An action on a resource whose cloud account is Read-only is refused with a read-only error before any cloud call is made. See Read-only vs read + write.
- A bulk start or stop sends one action per resource in parallel and does not follow a group’s start and stop order. To keep the order, use a resource group’s Start all or Stop all.
Remediation approvals
PATCH /orgs/{orgID}/remediation-jobs/{jobID}/steps-by-id/{stepID}Approves, rejects, or advances a remediation step that is waiting on approval, by the step’s stable ID. Addressing the step by ID means a link to it keeps working if the workflow’s step names change. See Auto-remediation.
| Parameter | Type | Description |
|---|---|---|
action (required) | string | What to do with the step. One of approve, reject, advance. |
reason | string | With reject, why the step was rejected. |
{ "action": "reject", "reason": "Needs a maintenance window" }Existing autoscaling policies
GET /orgs/{orgID}/autoscaler/cloud-scaling-policiesBefore ZopNight applies a policy to an Auto Scaling group, VM scale set, managed instance group, or ECS service, it reads any scaling configuration already on the target. This route returns it.
| Parameter | Description |
|---|---|
resource_uid | The scaling target. |
provider | aws, gcp, or azure. |
target_type | The kind of scaling target. |
cloud_account_id | The target’s cloud account. |
region | The target’s region. |
The response says whether the target already has scaling policies (hasExisting), describes the scalable target, and lists the existing policies, in the same shape for every cloud. See Autoscaling for adopting or replacing them.