API-Led Grid Operations: SCADA to Agentforce with NERC-CIP Controls Deliverable: A three-layer MuleSoft API estate (6 System APIs, 8 Process APIs, 3 Experience APIs) that turns raw SCADA, AMI, weather, DER and asset data into outage-aware, life-safety-prioritized grid events. Control-room dashboards, field-agent apps and Agentforce agents consume the same contract, and every write path is gated and auditable. Objective: Grid operators get SCADA signals like a device ID, a status code and a voltage drop, with no sense of who is affected. Working out whether a failed transformer feeds a hospital means phone calls, spreadsheets and manual cross-referencing against asset records. Meanwhile each tool (SCADA, AMI, weather, work management, Salesforce Energy Cloud) speaks its own dialect. This blueprint puts a governed API layer between OT/IT data and every consumer, with a "semantic" Process layer that adds business context (critical facility, severity, priority) so people and AI agents act on meaning instead of codes, and so that actions that touch the grid pass through controlled, logged, human-approved paths. What's Getting Built SCADA Devices / SCADA Device Status (System API) — telemetry and real-time status from field devices · GET /scada/devices, GET /scada/devices/status Smart Meter Usage (System API) — AMI usage per meter · GET /meters/{meterId}/usage Weather Forecast (System API) — forecast for grid prediction · GET /weather/forecast DER Devices (System API) — distributed energy resource data · GET /der/devices Salesforce Assets (System API) — critical assets from Salesforce Energy Cloud · GET /salesforce/assets Incident Create (Process API) — logs an outage or critical failure · POST /incident/create Critical Infrastructure Alerts (Process API) — outages touching hospitals and emergency services · GET /alerts/critical-infrastructure Grid Coordination (Process API) — coordinates restoration with agents · POST /grid/coordination Crew Dispatch (Process API) — sends work orders to field crews · POST /dispatch/crew Agent-to-Agent Coordination and Priority Alerts (Process API) — mobile field agents and AI systems · POST /a2a/coordination, GET /a2a/priority-alerts MCP Grid Exchange and Safety Orchestration (Process API) — central coordination point ("Master Coordination Point") decisions and safety restoration flows · POST /mcp/grid-exchange, POST /mcp/safety-orchestration Dashboard Overview (Experience API) — operator metrics · GET /dashboard/overview Agent Alerts / Agent Dashboard (Experience API) — targeted alerts for field agents · GET /agent/alerts Define all 17 contracts as OpenAPI 3.0.1, starting at version 1.0.0, with base path /v1. Prerequisites Anypoint Platform org with API Manager, Exchange, and a non-production environment plus a network path (VPC/VPN or Runtime Fabric) that can reach the OT-adjacent historian or SCADA gateway. This network approval is usually the longest lead item. Read access to SCADA/EMS data through a DMZ, historian or gateway, never directly into the control network. Confirm with the NERC-CIP compliance owner which of your systems are BES Cyber Systems and where your Electronic Security Perimeter sits before designing connectivity. Credentials for each backend (AMI/head-end, weather provider, DER aggregator, Salesforce Energy Cloud connected app), held in secure properties or a secrets manager. An identity provider that can issue OAuth 2.0 tokens with distinct read and control scopes. Recommended scopes: read:energy and write:control. Salesforce org with Energy Cloud assets modelled (facility criticality must exist in data, not in code) and Agentforce enabled if agents will consume the Experience layer. A named business owner for the critical-facility list (hospitals, dialysis centers, emergency services). The priority logic is only as good as this list. Agreement from operations on which actions an agent may take on its own and which need a human approval step. Choose your path Pull-based System APIs (this blueprint) — Choose this when SCADA data is already exposed through a historian, gateway or DMZ replica that supports request/response polling. It is the simplest approach and the one the specs describe. Event-driven ingestion — Choose this when you need sub-minute detection during storm events and your platform offers a message bus. Keep the same Process and Experience contracts and swap only the System API implementation, so consumers never change. Architecture 1. Contract-first: fix the specs before writing flows Write the 17 OpenAPI specs before any Mule code, and make them complete, not skeletons. A spec that declares only 200, 400 and 500 with a loose type: object response gives clients and agents nothing to validate against. Include query parameters (region, device, time window) on every GET, a requestBody schema on every POST, and typed response schemas built from example payloads. Adopt naming and error rules up front: kebab-case path segments, camelCase JSON properties, plural resource names, URI versioning as /v{version}, and one shared error body (code, message, timestamp). Lint the specs against those rules in CI. Verb paths (/incident/create) and singular resources (/dashboard/overview) are the usual violations; rename or record them as exceptions before consumers depend on them. Declare every error the runtime can return: 400, 401, 403, 404, 429 and 500. Policies emit 401, 403 and 429 even if the flow never does, and a client generated from a spec cannot handle a 403 it was never told about. Keep operationIds unique across all specs and free of path-template characters such as braces (derive them from verb and resource, not by pasting the path). Never define the same method and path in two specs. Duplicate operationIds break code generation and Agentforce action import. 2. System APIs: one per source, no business logic Build each System API as a thin, stateless wrapper that normalizes units and field names and nothing else. Target response shapes: {"deviceId":"TX123","status":"online","voltage":12.8}, {"meterId":"MTR567","usageKWh":34.2,"timestamp":"2025-06-19T17:00:00Z"}, {"deviceId":"DER01","capacityKw":75.5}. Keep GET /scada/devices (telemetry) and GET /scada/devices/status (state) separate. Give the two specs distinct response schemas: decide which fields belong to which and enforce it, otherwise callers will poll the heavier telemetry endpoint just to learn if a device is up. Make SCADA access read-only at this layer. No System API in the contract writes to the control network, and that boundary is a core NERC-CIP argument. Put timeouts, retries with backoff and a circuit breaker on every backend call. Return an explicit "stale" or "unavailable" signal rather than a cached value that looks live; downstream priority decisions must know when data is old. 3. Semantic Process APIs: turn signals into meaning This is the layer that justifies the platform. Design it in four stages: ingest, normalize and enrich (customer type, facility criticality, GIS location), generate intelligence (impact, priority, recommended action), and expose it through the API. GET /alerts/critical-infrastructure is the join: a SCADA node failure plus asset records plus customer/facility classification yields a facility-level alert such as {"facilityId":"HOSP001","status":"outage","priority":"highest"}. POST /incident/create records the event (region, type, priority) and is the system of record for later steps. Make it idempotent on a deterministic key derived from region plus source event so a re-polled SCADA alarm does not open a second incident. Keep priority rules in configuration or Salesforce data, not in DataWeave constants. A voltage-drop severity threshold or a revenue-loss multiplier hardcoded in DataWeave belongs to the utility, and both change. Use consistent severity vocabulary across all APIs. Pick one severity and priority enum and use it in every API; mixing high, highest and critical across payloads forces every consumer to guess. 4. Action Process APIs: gate every write POST /dispatch/crew, POST /grid/coordination, POST /a2a/coordination, POST /mcp/grid-exchange and POST /mcp/safety-orchestration all change the state of operations. Treat them as one class with shared controls. Require the write:control scope (separate from read) and a caller identity that is logged with each request. Put a human approval step in front of anything that moves crews or alters load (reroute-load in the grid-exchange example). Allow auto-execution only for actions the operations owner has explicitly pre-approved, and only for low-risk types. Add a deduplication key and a conflict check. Two agents sending different task values to the same targetAgentId or crew must resolve deterministically, not race. Keep /mcp/safety-orchestration (for example life-support-priority, critical) on the highest-priority path with its own rate-limit tier, so storm-time dashboard polling can never starve a safety flow. 5. Experience APIs: shape for each consumer GET /dashboard/overview returns operator counters (alertsActive, crewsDispatched); GET /agent/alerts returns per-agent alerts. Resolve the duplicate /agent/alerts first (step 1), then keep one Experience API per consumer type. Experience APIs only aggregate and cache. They call Process APIs, never System APIs, so a change in a SCADA vendor never touches a consumer. For Agentforce, publish the Experience APIs to Exchange and import them as external actions. Read operations can be agent-callable directly; anything that triggers a Process API write goes through the approval path in step 4. Keep operation descriptions precise, because they are what the agent reads to choose a tool. 6. Governance and runtime policies Register every API in API Manager and apply policies per layer. Recommended starting points: OAuth 2.0 with JWT (RS256) validation, a client-ID enforcement header (X-API-Key, 90-day rotation), and rate limits scaled by criticality (1000 req/min default, 10000 for high, 100 for low) with bronze/silver/gold tiers and X-RateLimit-* headers. Health checks: /health every 30 s with a 5 s timeout, a /metrics check, and a dependency check every 5 min. Starting SLA targets are 100 ms for System APIs and 500 ms for Process and Experience APIs, with alerts at availability below 99.9% (critical) and error rate above 1% (warning). Mark SCADA and control-adjacent APIs criticality: high so they get the highest tier, and restrict them by network (IP allow-list) as well as token. 7. Security and compliance Map controls to NERC CIP-003 (security management), CIP-005 (electronic security perimeter) and CIP-007 (system security management), and consider CIP-014 for critical-facility restoration. Have your compliance team confirm which standards and which assets apply; this blueprint is not a compliance determination. CIP-005: System APIs reaching SCADA live behind the perimeter, over mutual TLS, with network segmentation and no direct inbound path from Experience consumers. Recommended baseline: TLS 1.3 minimum, mTLS for system-to-system calls and AES-256 at rest. CIP-007: log authentication events, data access and configuration changes, retain for the audit window (recommended default 1095 days, 3 years; confirm with compliance), and ship logs outside the Mule runtime so they cannot be altered from it. Never log SCADA payloads in full or personal data tied to meters or facilities. Mask PII and sensitive grid identifiers in logs and dashboards, and keep secrets in secure properties. The two controls most often left partial in early builds are multi-factor authentication and recurring access reviews. Close both before go-live: MFA on operator consoles and a scheduled access-review report. Keep an audit record for every action decision, including who approved, what was proposed, and what was executed. Sample payload — critical-facility alert and semantic event { "facilityId": "HOSP001", "status": "outage", "priority": "highest" } Request to log the matching incident (POST /incident/create): { "region": "TX-78", "type": "outage", "priority": "high" } Target semantic event shape for the Process layer (illustrative; finalize the schema with operations): { "event": "Storm-induced cascading outage", "severity": "CRITICAL", "affectedAreas": [ { "name": "Downtown Medical District", "priority": "LIFE-SAFETY", "criticalFacilities": ["{critical_facility_1}", "{critical_facility_2}"], "restorationPriority": 1 } ] } Deterministic checks Every GET returns 200 with a body that validates against its response schema. Every POST rejects an invalid body with 400 and the shared error shape (code, message, timestamp). Missing or invalid token returns 401; a valid read-only token calling any POST action returns 403. No exception for any dashboard. POST /incident/create replayed with the same region and source event returns the original incident and never creates a duplicate. Specs lint clean: unique operationIds across all 17 files, no duplicate method-plus-path pair, kebab-case paths, camelCase properties, /v{version} base path. No System API exposes a write operation against SCADA. A contract test fails the build if one does. No Experience API calls a System API directly. A dependency check on the API graph enforces this. Responses built from stale source data carry the explicit stale indicator defined in step 2. MUnit suites for every flow pass with at least 80% coverage (a recommended bar), and an integration suite per API (health, auth required, valid auth, response-time SLA, concurrency, SQL-injection input, rate limiting returning 429) passes for each API. Testing and validation End to end: inject a SCADA offline status for a node linked in Salesforce to a hospital asset. Confirm GET /alerts/critical-infrastructure shows the facility at highest, an incident is created once, and the dashboard counter updates. Edge case that breaks a naive build: a storm produces many correlated SCADA alarms at once. Without correlation and deduplication, one outage becomes dozens of incidents and crew dispatches. Test with a burst of alarms for one region and assert a single incident and a single recommended dispatch. Second edge case: a backend (for example AMI) is down mid-event. The semantic response must degrade explicitly, listing what is missing, instead of silently ranking with partial data. Prove the mapping, not only the flow: for a sample of real devices, compare System API output against the source system value-for-value, including units. Authorization matrix: run every endpoint with no token, a read token and a control token, and assert 401, 403 and 200 as appropriate. Load test at storm-level fan-out using this pattern (100 concurrent users for 60 s, error rate under 1%, p95 under 1000 ms), then tune to your real peak. Treat published throughput and availability figures as targets until you have measured them. Phased rollout Phase 1 — Connect Fix and lint the specs, publish them to Exchange, and stand up the System APIs against read-only non-production sources. Prove OAuth, mTLS and network reachability to the SCADA gateway. Phase 2 — Map and validate Build the semantic Process APIs and load real critical-facility and asset data. Run in shadow mode alongside the control room for a full storm season or a replay of historical events, and compare machine priorities with what operators actually did. Close the MFA and access-review gaps and finish the compliance review. Phase 3 — Production Enable Experience APIs and the Agentforce actions read-only first. Turn on action APIs one at a time (incident, then coordination, then dispatch), each behind approval. Hand dashboards and alerting to operations with named owners. Success metrics Time from first SCADA alarm to a prioritized, facility-aware incident, measured against today's manual baseline. Establish your own baseline before claiming any improvement. Duplicate-incident rate per outage event (target: zero). Platform side: p95 latency by layer against the 100/500 ms starting SLAs, error rate, 429 counts per client, and policy coverage (every API governed). Troubleshooting Agentforce action import fails or picks the wrong operation — Likely cause: duplicate operationId across specs, or path-template characters such as braces in an operationId. Fix: make operationIds unique and brace-free, then re-publish and re-import. Generated client cannot handle an auth failure — Likely cause: the spec lists only 400/500 while policies return 401/403/429. Fix: add these responses to every operation. Dashboard shows the same data on /scada/devices and /scada/devices/status — Likely cause: both specs were given the same response example, so both flows were built to return the same shape. Fix: split fields between telemetry and status explicitly. Multiple incidents for one outage — Likely cause: no idempotency key and no alarm correlation on POST /incident/create. Fix: derive a key from region plus source event and correlate alarms in a window before creating. Priority looks wrong for a hospital feeder — Likely cause: the facility-to-asset link is missing or stale in Salesforce Energy Cloud, not a code bug. Fix: audit the link data and add a data-quality check to the Process API. Safety flows slow during a storm — Likely cause: all APIs share one rate-limit tier. Fix: set criticality per API and isolate safety orchestration.