Skip to content

Agents API

Endpoints for managing agents (monitored endpoints).

List Agents

Get a paginated list of all agents.

http
GET /api/v1/agents/
Authorization: Bearer YOUR_TOKEN

Query Parameters

ParameterTypeDefaultDescription
pageint1Page number
per_pageint50Items per page (max 100)
statusstring-Filter: online, offline, pending
searchstring-Search hostname, IP, UUID
sort_bystringhostnameSort field
sort_orderstringascasc or desc
folder_iduuid-Filter by folder
tag_idsstring-Comma-separated tag UUIDs

Response

json
{
  "items": [
    {
      "uuid": "550e8400-e29b-41d4-a716-446655440000",
      "hostname": "web-server-01",
      "ip_address": "192.168.1.100",
      "os": "linux",
      "os_version": "Ubuntu 22.04",
      "arch": "amd64",
      "status": "online",
      "agent_version": "1.0.0",
      "last_seen": "2024-01-15T10:30:00Z",
      "created_at": "2024-01-01T00:00:00Z",
      "folder_id": null,
      "tags": [
        {"id": "...", "name": "Production", "color": "#22c55e"}
      ],
      "maintenance_mode": false
    }
  ],
  "total": 150,
  "page": 1,
  "per_page": 50,
  "pages": 3
}

Get Agent Details

Get detailed information about a specific agent.

http
GET /api/v1/agents/{uuid}
Authorization: Bearer YOUR_TOKEN

Response

json
{
  "uuid": "550e8400-e29b-41d4-a716-446655440000",
  "hostname": "web-server-01",
  "ip_address": "192.168.1.100",
  "os": "linux",
  "os_version": "Ubuntu 22.04.3 LTS",
  "arch": "amd64",
  "status": "online",
  "agent_version": "1.0.0",
  "last_seen": "2024-01-15T10:30:00Z",
  "created_at": "2024-01-01T00:00:00Z",
  "approved_at": "2024-01-01T00:01:00Z",
  "approved_by": "admin",
  "folder_id": null,
  "tags": [],
  "maintenance_mode": false,
  "system_info": {
    "cpu": {
      "model": "Intel Core i7-10700",
      "cores": 8,
      "threads": 16,
      "usage": 25.5
    },
    "memory": {
      "total": 16384,
      "used": 8192,
      "percent": 50.0
    },
    "disk": [
      {
        "mount": "/",
        "total": 500000,
        "used": 250000,
        "percent": 50.0
      }
    ],
    "network": [
      {
        "interface": "eth0",
        "ip": "192.168.1.100",
        "mac": "00:11:22:33:44:55"
      }
    ]
  }
}

Register Agent

Register a new agent. Usually called by the agent itself.

http
POST /api/v1/agents/register
Content-Type: application/json

{
  "hostname": "web-server-01",
  "os": "linux",
  "os_version": "Ubuntu 22.04",
  "arch": "amd64",
  "agent_version": "1.0.0",
  "ip_address": "192.168.1.100",
  "enrollment_token": "optional_token"
}

Response (Approved)

json
{
  "uuid": "550e8400-e29b-41d4-a716-446655440000",
  "status": "approved",
  "certificate": "-----BEGIN CERTIFICATE-----...",
  "private_key": "-----BEGIN PRIVATE KEY-----...",
  "ca_certificate": "-----BEGIN CERTIFICATE-----...",
  "reregistration_secret": "secret"
}

Response (Pending)

json
{
  "uuid": "550e8400-e29b-41d4-a716-446655440000",
  "status": "pending",
  "message": "Agent registration pending approval"
}

Approve Agent

Approve a pending agent registration.

http
POST /api/v1/agents/{uuid}/approve
Authorization: Bearer YOUR_TOKEN

Response

json
{
  "message": "Agent approved",
  "uuid": "550e8400-e29b-41d4-a716-446655440000"
}

Reject Agent

Reject a pending agent registration.

http
POST /api/v1/agents/{uuid}/reject
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "reason": "Unknown device"
}

Execute Action

Execute an action on an agent.

http
POST /api/v1/agents/{uuid}/action
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "action": "restart"
}

Available Actions

ActionDescription
restartRestart the agent
shutdownShutdown the system
rebootReboot the system
updateUpdate the agent
scanTrigger inventory scan

Response

json
{
  "message": "Action queued",
  "action": "restart",
  "agent_uuid": "550e8400-e29b-41d4-a716-446655440000"
}

Update Agent

Update agent metadata.

http
PUT /api/v1/agents/{uuid}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "folder_id": "folder-uuid",
  "tag_ids": ["tag-uuid-1", "tag-uuid-2"],
  "notes": "Primary web server"
}

Toggle Maintenance Mode

Enable or disable maintenance mode.

http
POST /api/v1/agents/{uuid}/maintenance
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "enabled": true,
  "reason": "Scheduled maintenance",
  "expires_at": "2024-01-15T18:00:00Z"
}

When in maintenance mode:

  • Monitoring alerts are suppressed
  • Patch policies are not executed
  • Scripts are blocked

Delete Agent

Remove an agent from the system.

http
DELETE /api/v1/agents/{uuid}
Authorization: Bearer YOUR_TOKEN

Response

json
{
  "message": "Agent deleted",
  "uuid": "550e8400-e29b-41d4-a716-446655440000"
}

Get Agent Software

List software installed on an agent.

http
GET /api/v1/agents/{uuid}/software
Authorization: Bearer YOUR_TOKEN

Response

json
{
  "items": [
    {
      "name": "nginx",
      "version": "1.24.0",
      "vendor": "Nginx Inc.",
      "install_date": "2024-01-01",
      "vulnerabilities": []
    },
    {
      "name": "openssl",
      "version": "3.0.2",
      "vendor": "OpenSSL",
      "install_date": "2024-01-01",
      "vulnerabilities": [
        {
          "cve_id": "CVE-2024-0001",
          "severity": "high",
          "cvss_score": 7.5
        }
      ]
    }
  ],
  "total": 150,
  "vulnerable_count": 5
}

Get Agent Services

List services on an agent.

http
GET /api/v1/agents/{uuid}/services
Authorization: Bearer YOUR_TOKEN

Response

json
{
  "items": [
    {
      "name": "nginx",
      "display_name": "nginx - high performance web server",
      "status": "running",
      "start_type": "automatic"
    },
    {
      "name": "postgresql",
      "display_name": "PostgreSQL Database",
      "status": "running",
      "start_type": "automatic"
    }
  ]
}

Control Service

Start, stop, or restart a service.

http
POST /api/v1/agents/{uuid}/services/{service_name}/action
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "action": "restart"
}

Available Actions

  • start
  • stop
  • restart

Get Agent Metrics

Get historical metrics for an agent.

http
GET /api/v1/agents/{uuid}/metrics
Authorization: Bearer YOUR_TOKEN

Query Parameters

ParameterTypeDefaultDescription
metricstring-cpu, memory, disk, network
fromdatetime24h agoStart time
todatetimenowEnd time
intervalstring5mAggregation interval

Response

json
{
  "metric": "cpu",
  "data": [
    {"timestamp": "2024-01-15T10:00:00Z", "value": 25.5},
    {"timestamp": "2024-01-15T10:05:00Z", "value": 30.2},
    {"timestamp": "2024-01-15T10:10:00Z", "value": 22.1}
  ]
}

Released under the MIT License.