Skip to main content Skip to content

Compute API

REST endpoints for compute inventory, schedules, and remediation actions across EC2, GCE, Azure VMs, ASGs, MIGs, and VMSS.

3 min read Last updated: 

Base URL and auth

Terminal window
https://api.zop.dev/v1

All requests require a personal access token in the Authorization: Bearer … header. See Authentication for how to mint one.

Read-only PATs can call every endpoint in this section except POST /compute/:id/actions (requires compute:write scope).

List compute resources

Terminal window
GET /compute

Query parameters

NameTypeDescription
accountstringFilter by cloud account ID.
providerenumaws, gcp, azure.
typestringResource type, e.g. ec2, gce-vm, azure-vm, asg.
environmentstringprod, stage, uat, dev.
teamstringOwning team slug.
stateenumrunning, stopped, pending, terminated.
pageint1-indexed.
pageSizeintMax 200, default 50.

Example

Terminal window
curl "https://api.zop.dev/v1/compute?provider=aws&environment=dev&state=running" \
-H "Authorization: Bearer $ZOPNIGHT_PAT"

Response

Terminal window
{
"data": [
{
"id": "i-0abc12340def56789",
"provider": "aws",
"type": "ec2",
"account": "123456789012",
"region": "us-east-1",
"state": "running",
"environment": "dev",
"team": "payments-platform",
"tags": { "env": "dev", "owner": "payments-platform" },
"instanceType": "m5.xlarge",
"launchedAt": "2026-04-12T08:14:00Z",
"cost": {
"monthlyProjected": 124.32,
"currency": "USD",
"reconciledTo": "aws-cost-explorer"
},
"schedule": {
"id": "sched_dev_night_shift",
"nextAction": "stop",
"nextActionAt": "2026-06-01T14:30:00Z"
}
}
],
"pagination": { "page": 1, "pageSize": 50, "total": 412 }
}

Get a compute resource

Terminal window
GET /compute/:id

Returns the full resource document including dependency edges (security-group references, target-group memberships, attached volumes).

List recommendations for a compute resource

Terminal window
GET /compute/:id/recommendations

Returns the open recommendations for this resource (idle, right-size, schedule, orphan) each with the rule ID, the observed metric, the threshold, the action, and the projected dollar.

Apply an action

Terminal window
POST /compute/:id/actions

Body

Terminal window
{
"action": "stop",
"reason": "manual-test",
"reviewerNote": "Confirmed with team-payments on Slack",
"dryRun": false
}

Supported actions: stop, start, reboot, terminate, resize, apply-schedule, remove-schedule. Each action runs through the standard four-step gate: precondition → approval → cloud call → validate.

Response

Terminal window
{
"actionId": "act_01HK3F2V8X7QZP",
"status": "applied",
"appliedAt": "2026-06-01T05:01:23Z",
"validation": {
"preCondition": "pass",
"approval": "auto",
"cloudResult": "EC2 stop-instances completed",
"postValidation": "instance state = stopped"
}
}

If dryRun: true, the response shows what would have happened without making the cloud call.

Errors

Errors use standard HTTP status codes. The body carries a machine-readable code, a human-readable message, and the numeric status.

StatusMeaning
400Invalid or malformed parameters (bad enum value, missing required field).
401Missing or invalid token.
403Token lacks the required scope (e.g. compute:write on POST /compute/:id/actions).
404Resource not found, or not visible to the token’s role.
429Rate limited; see Rate limits.
5xxServer error; safe to retry with backoff.
Terminal window
{
"error": {
"code": "forbidden",
"message": "token is missing the compute:write scope",
"status": 403
}
}

Rate limits

  • Read endpoints: 600 requests/min per workspace.
  • Action endpoints: 60 requests/min per workspace.

Headers X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset are returned on every response.

Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001 · zero-trust· 30% average cloud cost cut· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001 · zero-trust· 30% average cloud cost cut· 4 platforms · 1 console·