Nexform Govern API reference
Versioned under /api/v1. JSON in, JSON out. Consistent error envelope. All executions are simulated in this release.
Bearer credentials
Agents use per-agent credentials (ngk_<env>_…) issued in the Agent Registry. Management integrations use organisation API keys (ngo_…). Keys are stored only as HMAC-SHA256 hashes, can expire, rotate with a 24-hour overlap and be revoked instantly. Organisation and agent identity are always derived from the credential.
Authorization: Bearer ngk_prod_xxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Reference
/api/v1/actions/evaluateAuthenticates the agent, derives organisation/agent identity from the credential, enforces replay protection and idempotency, then evaluates deterministic policy. ALLOW returns a single-use, 5-minute execution token bound to the exact parameters. REQUIRE_APPROVAL creates a human approval.
/api/v1/actions/executeVerifies the token/approval binding (agent, parameters hash, executor, expiry, single use), consumes it atomically, re-evaluates current policies, kill switches and authorisations, then executes via the simulated adapter and returns a signed receipt.
/api/v1/decisions/{id}/api/v1/approvals/{id}/api/v1/events/api/v1/agents/api/v1/evaluations/api/v1/evaluations/{id}/api/v1/healthFull machine-readable schema: /api/v1/openapi.json
Evaluate → (approve) → execute
POST /api/v1/actions/evaluate
{
"action": {
"action_type": "initiate_payment",
"tool": "payments.simulated_transfer",
"parameters": { "amount": 12000, "currency": "GBP", "payee": "Fictional Supplier Ltd" },
"data_classification": "confidential",
"subject_ref": "CUST-1002",
"consent_ref": "DA-DEMO-2001"
},
"context": { "channel": "back_office" },
"correlation_id": "corr_batch_2026_11_24",
"idempotency_key": "3f1c9a3e-6c1b-4b4e-9a43-1f2d1d0c7a11",
"timestamp": "2026-11-24T10:15:00Z"
}201 Created
{
"decision_id": "…",
"action_request_id": "…",
"decision": "REQUIRE_APPROVAL",
"reason_codes": ["HIGH_VALUE_PAYMENT"],
"policy_refs": [{ "policy_key": "payments-approval-threshold",
"version": 1, "rule": "over-5k", … }],
"policy_epoch": 3,
"approval": { "approval_id": "…", "status": "pending",
"expires_at": "…", "required_approvals": 1 },
"advisory": { "prompt_injection": false, … }
}
# poll GET /api/v1/approvals/{id} → "approved", then:
POST /api/v1/actions/execute
{ "action_request_id": "…", "approval_id": "…",
"action": { …identical action… } }Connecting third-party frameworks
- Register the agent and assign only the tools it needs; define allowed, restricted and prohibited actions.
- Issue a credential for the agent's environment and place it in the agent runtime's secret store.
- Wrap each consequential tool with the SDK's
governedTool(TS) or@governed_tool(Python). The wrapper evaluates, waits for approval if configured, and executes via the gateway. - Move privileged tool credentials into the trusted executor — the agent should never be able to call the underlying system directly.
- Report model or configuration changes with
POST /api/v1/events; Nexform flags the agent for reassessment. - Run the assurance suites against the agent before requesting deployment approval.
# LangGraph / LangChain (Python) — governed node or tool
from nexform_govern import NexformGovern, governed_tool
govern = NexformGovern(BASE_URL, api_key=os.environ["NEXFORM_AGENT_KEY"])
@governed_tool(govern, action_type="send_customer_message", tool="messaging.secure_reply", classification="confidential")
def send_message(receipt, customer_id: str, body: str):
return receipt["result"] # executor result (simulated in this release)
# graph.add_node("reply", lambda state: send_message(customer_id=state["cid"], body=state["draft"]))Signed event delivery
Events: decision.deniedapproval.requiredapproval.approvedapproval.rejectedincident.createdagent.suspendedagent.resumedevaluation.completedalert.triggered. HTTPS endpoints only; private, loopback and internal addresses are rejected after DNS resolution; redirects are not followed.
X-Nexform-Signature: t=1795519200,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")> // Verify: recompute the HMAC with your whsec_ secret, compare in constant time, reject if |now - t| > 300 s.
Decision reason codes
| ORG_EMERGENCY_STOP | Organisation emergency stop is active. |
| AGENT_KILL_SWITCH | Agent kill switch engaged. |
| AGENT_SUSPENDED | Agent suspended. |
| AGENT_RETIRED | Agent retired. |
| AGENT_NOT_APPROVED_FOR_ENVIRONMENT | Lifecycle status does not permit acting in this environment. |
| ENVIRONMENT_NOT_AUTHORISED | Production request from an agent not registered for production. |
| RATE_LIMITED | Agent exceeded its configured per-minute rate. |
| UNKNOWN_TOOL | Tool not registered or not assigned to the agent. |
| ACTION_NOT_PERMITTED | No permission grants the action (default deny). |
| ACTION_PROHIBITED | Action explicitly prohibited. |
| DATA_CLASSIFICATION_EXCEEDED | Data classification above the permitted maximum. |
| CONSENT_REQUIRED | A registered authorisation reference is required. |
| CONSENT_NOT_FOUND / _REVOKED / _EXPIRED / _UNVERIFIED / _SUBJECT_MISMATCH / _AGENT_MISMATCH / _SCOPE_MISMATCH / _NOT_YET_VALID | Authorisation check failed. |
| CONSENT_AMOUNT_EXCEEDED | Amount above the authorised maximum. |
| ACTION_RESTRICTED | Permission requires human approval. |
| AMOUNT_ABOVE_PERMISSION_LIMIT | Amount above the agent's autonomous limit. |
| AGENT_RESTRICTED | Agent in restricted mode. |
| REASSESSMENT_PENDING | Material change awaiting reassessment. |
| HUMAN_APPROVAL_GRANTED | Execution allowed by a valid human approval. |
| APPROVAL_SCOPE_CHANGED | Policies changed since approval; new rules are not covered. |
| EXECUTION_TIME_POLICY_CHECK_FAILED | Re-evaluation at execution time did not allow the action. |
| PERMITTED_BY_SCOPE / POLICY_ALLOW | Allowed. |
| ENGINE_ERROR_FAIL_CLOSED | Evaluation error; denied. |
| <custom> | Organisation-defined reason codes from published policies (e.g. HIGH_VALUE_PAYMENT). |
Error envelope
{ "error": { "code": "PARAMETERS_MODIFIED", "message": "…", "details": … }, "request_id": "req_…" }| 400 | VALIDATION_ERROR | Body failed schema validation; see details[]. |
| 400 | MALFORMED_JSON | Body is not valid JSON. |
| 400 | TIMESTAMP_OUT_OF_RANGE | timestamp is more than 5 minutes from server time (replay protection). |
| 401 | MISSING_CREDENTIALS | No bearer credential supplied. |
| 401 | INVALID_CREDENTIALS | Credential not recognised. |
| 401 | REVOKED_CREDENTIALS | Credential revoked (or organisation inactive). |
| 401 | EXPIRED_CREDENTIALS | Credential expired. |
| 403 | INSUFFICIENT_SCOPE | Credential lacks the required scope. |
| 403 | IDENTITY_MISMATCH | organisation_id/agent_id in body differ from the credential (recorded as a security event). |
| 403 | INVALID_EXECUTION_TOKEN | Token does not exist or is not bound to this action request. |
| 403 | EXECUTOR_MISMATCH | Authorisation is bound to a different executor. |
| 403 | ORG_KEY_REQUIRED | Endpoint requires an organisation API key. |
| 404 | ACTION_REQUEST_NOT_FOUND | Unknown action request (or not owned by this agent). |
| 404 | DECISION_NOT_FOUND | Unknown decision (or not owned by this agent). |
| 404 | APPROVAL_NOT_FOUND | Unknown approval (or not owned by this agent). |
| 409 | IDEMPOTENCY_CONFLICT | idempotency_key reused with different parameters. |
| 409 | PARAMETERS_MODIFIED | Execute body differs from the evaluated/approved action (recorded as a security event). |
| 409 | AUTHORISATION_ALREADY_USED | Execution authorisations are single-use (replay recorded as a security event). |
| 409 | AUTHORISATION_EXPIRED | Authorisation expired before execution. |
| 409 | AUTHORISATION_REVOKED | Revoked by kill switch, emergency stop or authorisation revocation. |
| 409 | APPROVAL_NOT_GRANTED | Approval is not in 'approved' status. |
| 413 | PAYLOAD_TOO_LARGE | Body exceeds 64KB. |
| 415 | UNSUPPORTED_MEDIA_TYPE | Content-Type must be application/json. |
| 429 | RATE_LIMITED | Per-address API rate limit exceeded (per-agent limits are returned as DENY decisions). |
| 503 | SERVICE_UNAVAILABLE_FAIL_CLOSED | Unexpected error; no action is authorised (fail closed). |
Limits
- 600 requests per minute per source address (HTTP 429).
- Per-agent gateway limit (default 120/min, configurable): exceeded requests receive a recorded
DENYwithRATE_LIMITED. - Request bodies up to 64 KB; parameters and context up to 32 KB each.