Skip to content
API documentation · v1

Nexform Govern API reference

Versioned under /api/v1. JSON in, JSON out. Consistent error envelope. All executions are simulated in this release.

Authentication

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
Endpoints

Reference

post/api/v1/actions/evaluate
Evaluate a proposed agent action before execution

Authenticates 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.

post/api/v1/actions/execute
Execute an authorised action through the controlled (simulated) executor

Verifies 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.

get/api/v1/decisions/{id}
Get a decision
get/api/v1/approvals/{id}
Get approval status (poll)
post/api/v1/events
Report agent telemetry
get/api/v1/agents
List agents (org key) or the calling agent (agent credential)
post/api/v1/evaluations
Queue an assurance evaluation (org key, evaluations:write)
get/api/v1/evaluations/{id}
Get evaluation run and results
get/api/v1/health
Health check

Full machine-readable schema: /api/v1/openapi.json

Gateway flow

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… } }
Integration guides

Connecting third-party frameworks

  1. Register the agent and assign only the tools it needs; define allowed, restricted and prohibited actions.
  2. Issue a credential for the agent's environment and place it in the agent runtime's secret store.
  3. 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.
  4. Move privileged tool credentials into the trusted executor — the agent should never be able to call the underlying system directly.
  5. Report model or configuration changes with POST /api/v1/events; Nexform flags the agent for reassessment.
  6. 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"]))
Webhooks

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.
Reason codes

Decision reason codes

ORG_EMERGENCY_STOPOrganisation emergency stop is active.
AGENT_KILL_SWITCHAgent kill switch engaged.
AGENT_SUSPENDEDAgent suspended.
AGENT_RETIREDAgent retired.
AGENT_NOT_APPROVED_FOR_ENVIRONMENTLifecycle status does not permit acting in this environment.
ENVIRONMENT_NOT_AUTHORISEDProduction request from an agent not registered for production.
RATE_LIMITEDAgent exceeded its configured per-minute rate.
UNKNOWN_TOOLTool not registered or not assigned to the agent.
ACTION_NOT_PERMITTEDNo permission grants the action (default deny).
ACTION_PROHIBITEDAction explicitly prohibited.
DATA_CLASSIFICATION_EXCEEDEDData classification above the permitted maximum.
CONSENT_REQUIREDA registered authorisation reference is required.
CONSENT_NOT_FOUND / _REVOKED / _EXPIRED / _UNVERIFIED / _SUBJECT_MISMATCH / _AGENT_MISMATCH / _SCOPE_MISMATCH / _NOT_YET_VALIDAuthorisation check failed.
CONSENT_AMOUNT_EXCEEDEDAmount above the authorised maximum.
ACTION_RESTRICTEDPermission requires human approval.
AMOUNT_ABOVE_PERMISSION_LIMITAmount above the agent's autonomous limit.
AGENT_RESTRICTEDAgent in restricted mode.
REASSESSMENT_PENDINGMaterial change awaiting reassessment.
HUMAN_APPROVAL_GRANTEDExecution allowed by a valid human approval.
APPROVAL_SCOPE_CHANGEDPolicies changed since approval; new rules are not covered.
EXECUTION_TIME_POLICY_CHECK_FAILEDRe-evaluation at execution time did not allow the action.
PERMITTED_BY_SCOPE / POLICY_ALLOWAllowed.
ENGINE_ERROR_FAIL_CLOSEDEvaluation error; denied.
<custom>Organisation-defined reason codes from published policies (e.g. HIGH_VALUE_PAYMENT).
Errors

Error envelope

{ "error": { "code": "PARAMETERS_MODIFIED", "message": "…", "details": … }, "request_id": "req_…" }
400VALIDATION_ERRORBody failed schema validation; see details[].
400MALFORMED_JSONBody is not valid JSON.
400TIMESTAMP_OUT_OF_RANGEtimestamp is more than 5 minutes from server time (replay protection).
401MISSING_CREDENTIALSNo bearer credential supplied.
401INVALID_CREDENTIALSCredential not recognised.
401REVOKED_CREDENTIALSCredential revoked (or organisation inactive).
401EXPIRED_CREDENTIALSCredential expired.
403INSUFFICIENT_SCOPECredential lacks the required scope.
403IDENTITY_MISMATCHorganisation_id/agent_id in body differ from the credential (recorded as a security event).
403INVALID_EXECUTION_TOKENToken does not exist or is not bound to this action request.
403EXECUTOR_MISMATCHAuthorisation is bound to a different executor.
403ORG_KEY_REQUIREDEndpoint requires an organisation API key.
404ACTION_REQUEST_NOT_FOUNDUnknown action request (or not owned by this agent).
404DECISION_NOT_FOUNDUnknown decision (or not owned by this agent).
404APPROVAL_NOT_FOUNDUnknown approval (or not owned by this agent).
409IDEMPOTENCY_CONFLICTidempotency_key reused with different parameters.
409PARAMETERS_MODIFIEDExecute body differs from the evaluated/approved action (recorded as a security event).
409AUTHORISATION_ALREADY_USEDExecution authorisations are single-use (replay recorded as a security event).
409AUTHORISATION_EXPIREDAuthorisation expired before execution.
409AUTHORISATION_REVOKEDRevoked by kill switch, emergency stop or authorisation revocation.
409APPROVAL_NOT_GRANTEDApproval is not in 'approved' status.
413PAYLOAD_TOO_LARGEBody exceeds 64KB.
415UNSUPPORTED_MEDIA_TYPEContent-Type must be application/json.
429RATE_LIMITEDPer-address API rate limit exceeded (per-agent limits are returned as DENY decisions).
503SERVICE_UNAVAILABLE_FAIL_CLOSEDUnexpected error; no action is authorised (fail closed).
Rate limits

Limits

  • 600 requests per minute per source address (HTTP 429).
  • Per-agent gateway limit (default 120/min, configurable): exceeded requests receive a recorded DENY with RATE_LIMITED.
  • Request bodies up to 64 KB; parameters and context up to 32 KB each.