Skip to main content Skip to content

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.

6 min read

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.

Terminal window
curl "$ZOPNIGHT_API/orgs/$ORG_ID/resources?view=parents&provider=aws" \
-H "Authorization: Bearer $ZOPNIGHT_PAT"

List resources

Terminal window
GET /orgs/{orgID}/resources

Returns the discovered inventory, the same data as Cloud Estate → Inventory.

ParameterTypeDescription
viewstringparents returns top-level resources (clusters, servers, registries) with their children counted. children returns the children of one parent. One of parents, children.
parent_uidstringWith view=children, the parent whose children to return.
providerstringReturns every account of that provider. One of aws, gcp, azure.
cloud_account_idstringOne cloud account ID, or several separated by commas.
Terminal window
GET /orgs/{orgID}/resources/filter-fields

Returns 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

Terminal window
GET /orgs/{orgID}/resources/activity-events

Returns the raw control-plane events read from CloudTrail, Cloud Logging, and the Azure Activity Log.

Terminal window
GET /orgs/{orgID}/reports/resources/activity

Returns one resource’s operations, bucketed over time. It backs the Recent Activity tab in the recommendation drawer.

ParameterTypeDescription
resource_uidstringThe resource whose activity to return.
Terminal window
GET /orgs/{orgID}/reports/resources/metrics

Returns 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

Terminal window
GET /orgs/{orgID}/resources/blast-radius

Returns 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.

ParameterTypeDescription
target_typestringThe kind of target. One of resource, autoscaler_policy, schedule.
target_idstringThe target’s ID. For a resource, its UID.
operationstringThe change you plan, such as delete or stop.
Terminal window
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

Terminal window
GET /orgs/{orgID}/recommendations

Returns recommendations. Each one carries its title, description, current and optimised cost, potential savings, cloud account, and the evidence that fired it.

FilterDescription
statusFor example, open.
providerThe provider, for example aws.
categoryThe recommendation category.
resource_typeComma-separated.
severityThe severity.
cloud_account_idComma-separated.
searchFree-text search.
resource_uidRecommendations for one resource.
Terminal window
GET /orgs/{orgID}/recommendations/count

Takes the same filters as the list and returns how many match.

Terminal window
GET /orgs/{orgID}/recommendations/{id}

Returns one recommendation.

Terminal window
GET /orgs/{orgID}/recommendations/activity

Returns 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.

ParameterTypeDescription
rec_idstringOne or more recommendation IDs, separated by commas (at most 200).

Start and stop

Terminal window
POST /orgs/{orgID}/actions

Submits 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

Terminal window
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.

ParameterTypeDescription
action (required)stringWhat to do with the step. One of approve, reject, advance.
reasonstringWith reject, why the step was rejected.
Terminal window
{ "action": "reject", "reason": "Needs a maintenance window" }

Existing autoscaling policies

Terminal window
GET /orgs/{orgID}/autoscaler/cloud-scaling-policies

Before 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.

ParameterDescription
resource_uidThe scaling target.
provideraws, gcp, or azure.
target_typeThe kind of scaling target.
cloud_account_idThe target’s cloud account.
regionThe 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.

Next steps

Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·