Skip to main content

Overview

The Pastures Engine exposes a REST API that the Rancher extension consumes. All endpoints accept and return JSON (Content-Type: application/json).

Authentication

Authentication is optional and configured per-installation in Pastures → Settings. When an API key is set, every request includes an Authorization header:
Authorization: Bearer <api-key>
If no key is configured, requests are sent without the header.

Base URL

The Engine URL is stored in localStorage and configurable in Settings. All API paths in this reference are relative to that base URL.

Endpoint Groups

Diagnostics

POST /api/diagnose — AI-powered root-cause analysis and remediation plans.

Advisories

GET /api/advisories — Security and operational advisories relevant to the cluster.

Health & Status

GET /health and GET /api/llm/status — Engine health check and AI provider status.

Clusters

GET /api/clusters/* — Cluster inventory, status, and metadata.

Operations

/api/cis/*, /api/etcd/*, /api/monitoring/*, /api/audit/* — CIS benchmarks, etcd health, monitoring, and audit logs.

GPU

/api/gpu/* — GPU inventory, utilization, and scheduling.

Support

POST /api/support-bundle — Generate and download support bundles.

Actions

POST /api/clusters/{id}/actions/execute — Execute remediation actions on a cluster.

Demo Mode

When demo mode is enabled in the extension, engineFetch() short-circuits and returns synthetic data from lib/demoResponses.ts without making any network calls. This allows the full UI to function without a running Engine instance.

Error Handling

The Engine returns standard HTTP status codes:
StatusMeaning
200Success
400Bad request — invalid or missing parameters
401Unauthorized — invalid or missing API key
404Endpoint not found
500Internal server error
503Service unavailable — Engine or AI provider is down
Error responses include a JSON body:
{
  "error": "Description of what went wrong"
}