Documentation

Resource Groups

Resource groups let you organize related resources and schedule them together with defined execution ordering.

Overview

A resource group is a logical collection of cloud resources that should be managed together. When a group is attached to a schedule, all its members are started/stopped according to their execution tier and order — ensuring dependencies are respected.

Execution Tiers

Resources within a group are organized into execution tiers. All resources in tier 1 are processed first, then tier 2, and so on. Within a tier, the execution order determines the sequence. This is ideal for dependency chains (e.g., database → cache → application server).

Create Resource Group

POST
/resource-groups

Create a new resource group.

Requestbash
curl -X POST https://zopnight.com/api/resource-groups \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Backend Stack",
    "description": "Database, cache, and app servers for the backend"
  }'
Responsejson
{
  "data": {
    "id": "grp_abc123",
    "name": "Backend Stack",
    "description": "Database, cache, and app servers for the backend",
    "members": [],
    "createdBy": "user@company.com",
    "createdAt": "2025-01-15T10:30:00Z",
    "updatedAt": "2025-01-15T10:30:00Z"
  }
}

List Resource Groups

GET
/resource-groups

List all resource groups.

Get Resource Group

GET
/resource-groups/{groupID}

Get a resource group with its members.

Get Group Schedules

GET
/resource-groups/{groupID}/schedules

List all schedules attached to a resource group.

Update Resource Group

PUT
/resource-groups/{groupID}

Update group name or description.

Requestbash
curl -X PUT https://zopnight.com/api/resource-groups/grp_abc123 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Full Backend Stack",
    "description": "Updated description"
  }'

Delete Resource Group

DELETE
/resource-groups/{groupID}

Delete a resource group. Schedule attachments are also removed.

Add Member

POST
/resource-groups/{groupID}/resources/{resourceID}

Add a resource to the group.

Members are added with a default execution tier and order. Use the update sequence endpoint to configure execution ordering.

Update Execution Order

PATCH
/resource-groups/{groupID}/resources/{resourceID}/sequence

Update the execution tier and order for a group member.

Requestbash
curl -X PATCH https://zopnight.com/api/resource-groups/grp_abc123/resources/res_001/sequence \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "executionTier": "tier-1",
    "executionOrder": 1
  }'

Example ordering for a backend stack:

ResourceTierOrderStarts
PostgreSQL RDStier-11First
Redis ElastiCachetier-12Second
App Server EC2tier-21After tier 1 completes
Worker EC2tier-22After app server

Remove Member

DELETE
/resource-groups/{groupID}/resources/{resourceID}

Remove a resource from the group.

Group Member Object

FieldTypeDescription
idstringMembership ID
resourceUIDstringCloud provider resource UID
resourceNamestringResource display name
resourceTypestringResource type (e.g., aws-ec2)
providerstringCloud provider
cloudAccountIDstringConnected cloud account ID
regionstringCloud region
executionTierstringExecution tier for ordering (e.g., tier-1, tier-2)
executionOrderintegerOrder within the tier