Skip to main content

API Reference

Base URL: https://api.sandbox.openprodkt.com

Interactive docs: Swagger UI and OpenAPI JSON

This reference is organized by module so customers can find the surface they need without needing to know the implementation details behind it.

Prefer a language client? See SDKs.

Conventions​

List endpoints accept limit (1-100, default 25) and offset, and return total alongside the results. Most also accept search for case-insensitive partial matching.

GET /v1/assets?limit=25&offset=0&search=invoice

Write operations additionally require an appropriate role. See Auth and Access.

Public endpoints​

MethodPathDescription
GET/healthHealth check
GET/docsInteractive API docs
GET/swaggerInteractive API docs (legacy alias)
GET/openapi.jsonOpenAPI schema (JSON)
GET/openapi.yamlOpenAPI schema (YAML)

Authentication​

OpenProdkt uses two credential types:

  1. JWT for human Console sessions.
  2. API keys for machine workloads.

Header format:

Authorization: Bearer <jwt-or-api-key>

Identity and workspace​

This module covers organization setup, sign-in, profile access, settings, and member invites.

MethodPathPurpose
POST/auth/registerCreate an organization and first owner
GET/auth/onboarding-requests/{id}Check onboarding request status
POST/auth/request-codeRequest one-time login code
POST/auth/verifyExchange code for JWT
POST/auth/logoutRevoke the current session
GET/meCurrent user profile
GET/settingsWorkspace settings
GET/membersList workspace members
POST/membersInvite workspace member (roles user, billing_admin, auditor; optional accessExpiresAt, required for auditor)
POST/members/{id}/activateReactivate a member
POST/members/{id}/deactivateDeactivate a member
POST/members/{id}/access-expiryRenew, change or remove a member's access expiry (super_admin JWT only; see Time-bound access)

Member records include accessExpiresAt, an RFC3339 UTC time or null. A request the read-only auditor role may not make returns 403 with read_only_role.

Register example:

{
"organizationName": "Acme Ltd",
"email": "owner@acme.com"
}

Governance decisions​

This module covers decision evaluation and the playground. Applications call /v1/evaluate through an SDK or framework adapter. The transparent proxy calls /v1/proxy/evaluate. Both use the same canonical request.

MethodPathCallerPurpose
POST/v1/evaluateSDKs and framework adaptersAuthorize an operation
POST/v1/proxy/evaluateTransparent proxy (requires proxy.enabled)Authorize a proxied request; never returns 202
GET/v1/proxy/operations/{operation_id}MCP adapter and transparent proxy (requires mcp.enabled or proxy.enabled)Read an operation's status for reconciliation
POST/v1/proxy/outcomesMCP stdio adapter and SDK callersReport the outcome of an allowed call: succeeded, failed, or unknown, with optional execution correlation
POST/v1/playground/decisionConsole playgroundTest a policy; not an application contract

Request example:

{
"version": "v1",
"asset": { "id": "ast_e8f1a2c3" },
"operation_id": "pay-2026-001",
"transport": { "kind": "http" },
"metadata": {
"operation": "payment.execute",
"amount": 12000,
"currency": "USD"
}
}

operation_id is required and must identify one business operation. Put all context inside metadata. Top-level action, amount, and workflow fields are rejected with 400 invalid_request.

Every 400 on the evaluation, proxy evaluation, outcome-reporting, operation-status, and playground routes contains code and error. invalid_request identifies malformed requests or invalid envelopes, transport combinations, outcome reports, or playground asset selection. invalid_context identifies invalid evaluation metadata/schema or runtime kinds. Operation-status path validation uses invalid_operation_id. Use the error-code registry, not message text; these failures do not record/charge decisions, consume approvals or change operation/outcome state.

Typical pending response (/v1/evaluate, HTTP 202):

{
"version": "v1",
"operation_id": "pay-2026-001",
"decision": "approval_required",
"decisionId": "dec_9f2a1c4e",
"approvalId": "apr_5c6d7e8f",
"approvalStatus": "pending",
"payload_hash": "sha256:<hash>",
"approval_expires_at": "2026-09-13T11:15:00Z"
}

Status codes:

StatusMeaning
200Allowed, including a validated redemption of an approved operation
202Approval pending (/v1/evaluate only)
400Invalid request
402Decision, approval, or notification quota exhausted
403Denied, or the approval is rejected, expired, revoked, or consumed. On /v1/proxy/evaluate, a pending approval also returns 403 with a challenge
404Referenced approval does not exist
409asset_identity_conflict, operation_id_conflict, approval_retry_mismatch, or operation_in_progress
503Policy evaluation failed; the request fails closed

Trace context​

POST /v1/evaluate and POST /v1/proxy/evaluate accept an optional traceparent HTTP request header and return a traceparent response header. It is a header only: it is never a request-body or response-body member, and the outcome and operation-status endpoints do not read or return it.

Availability. Trace correlation, outcome correlation members and AI inventory require a control plane and SDK build that includes them. They are additive, and older builds ignore or reject them. Check the release notes of the version you run before relying on them.

Accepted format. W3C Trace Context traceparent, lowercase hexadecimal only:

00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
PartRule
VersionTwo hex characters. ff is invalid. Version 00 must be exactly 55 characters. Another version must start with the same 55-character layout, and may continue only with - followed by at least one more character.
Trace ID32 hex characters, not all zeros
Parent ID16 hex characters, not all zeros
FlagsTwo hex characters
Whole valueAt most 512 characters; no spaces, tabs, commas, or line breaks; uppercase hex is invalid

Behavior.

  • If you send one valid header, the control plane keeps your trace ID and flags and creates its own random span ID for this evaluation. The response traceparent is 00-<your trace ID>-<new span ID>-<your flags>. The response always uses version 00.
  • If the header is missing, invalid, repeated on several header lines, or comma-joined, the request is not rejected. The control plane starts a new trace with a random trace ID and flags 00, and returns it.
  • The response header may be absent when a request is rejected before evaluation starts, for example an invalid body, a missing scope or entitlement, or a validation error.
  • tracestate and baggage are not read or stored.
  • The trace context is observation only. It is not policy input, is not part of the approval payload hash, and never changes a decision. A retry after approval may send a different traceparent without a mismatch.

What is stored. The trace ID and the control plane's span ID are stored with the organization, the calling principal and the operation_id, and are attached to later evidence records for that operation. The first evaluation of an operation wins: a later evaluation, such as an approval retry, returns its own response span but does not replace the stored context. Your parent ID, other headers, request bodies and raw MCP arguments are not stored by this feature. The operation detail endpoint returns the recorded trace when present; audit events and webhooks do not. You can also read each response header and record it in your own system.

Execution correlation on outcome reports​

POST /v1/proxy/outcomes accepts three optional top-level members in addition to the existing operation_id, status, completed_at and result_hash. They are caller-asserted identifiers. The control plane validates their format and does not check them against any upstream system.

MemberType and boundsMeaning
execution_idLowercase UUIDv7 (xxxxxxxx-xxxx-7xxx-[89ab]xxx-xxxxxxxxxxxx)Identifies the actual attempt. Keep it unchanged when you retry the same report; use a new one for a genuinely new attempt
attemptJSON integer from 1 to 2147483647Attempt number. Zero, negative, fractional, exponent, string and out-of-range values are rejected
upstream_request_id1 to 128 characters from A-Z a-z 0-9 . _ : -Opaque identifier from the upstream system
{
"operation_id": "refund-123",
"status": "succeeded",
"completed_at": "2026-01-02T03:04:05Z",
"execution_id": "0196f111-1234-7123-8123-123456789abc",
"attempt": 1,
"upstream_request_id": "req-2"
}
  • Additive. Each member is independently optional. A request without them behaves exactly as before.
  • Validation. A value that is null or does not match the format returns 400 invalid_request, and nothing is stored.
  • One outcome per operation. The first report for an operation_id is authoritative. A repeat must carry the same status, completion time, result hash and the same optional members, with the same presence, to be accepted as idempotent (200). Adding, removing or changing any of them returns 409 operation_outcome_conflict. Attempts are not appended as separate outcomes.
  • No authority. These members do not authorize a retry, reuse or redeem an approval, or change authorization, approval or billing state. Do not replay an operation because a new execution_id is possible.
  • Where they appear. When supplied, the members are returned in the outcome object of GET /v1/proxy/operations/{operation_id}, and are included in the operation.outcome.reported audit event payload and webhook payload.
  • Authorization is unchanged. Only the principal that received the allow can report, and the transport entitlement check is unchanged. See Audit and Decision Records.

Correlation does not make the trail tamper-proof or prove that an upstream system executed a call. See Limits of the trail.

Late outcome reports and first-report authority​

Availability. The coverage notices described here exist only when the control plane build includes them and the operator has turned on outcome deadline monitoring, which is off by default (see Outcome deadline monitoring). The report rules in this section apply to every build.

  • No reporting window. POST /v1/proxy/outcomes does not reject a report because it is late. The principal that received the allow can report at any time, subject to the same principal, entitlement and format checks as any other report.
  • First report wins. The first accepted report for an operation_id returns 201 and is authoritative. An identical later report returns 200 and records nothing new. A report that differs in status, completion time, result hash or any optional member returns 409 operation_outcome_conflict. Concurrent first reports for one operation are decided once: one wins, and the other is treated as an identical retry or conflicts.
  • A coverage notice is not a report. When monitoring is on and no report has arrived by the deadline, the control plane stores an execution.outcome.missing audit event. For an allow whose decision declared outcome_reporting: none, it stores an execution.outcome.not_reportable event instead, without waiting for the deadline, unless a report already exists. See Coverage events. A notice never occupies the first-report slot and never blocks a later report. The control plane never writes a synthetic succeeded, failed or unknown report for you.
  • Late reports are accepted and notices stay. If the real report arrives after a notice, it is accepted as the first report (201) and is stored as operation.outcome.reported. The earlier notice is not deleted or edited; the audit trail then shows both, in time order. GET /v1/proxy/operations/{operation_id} shows the reported outcome.
  • Reading coverage. GET /v1/audit?operation_id=... includes a stored notice for that operation. For an allow that declared outcome_reporting: none, the read-time operation.outcome.not_reported row is no longer added once monitoring has recorded a result for the operation, so the page does not show two overlapping coverage states.
  • No authority. A missing, unknown or late outcome never replays or re-executes a call, and never changes authorization, approval state or billing. See Detection and Decision Flow.

Reporters that retry should keep sending the identical report (same status, completion time and identifiers). Do not send a new status for an operation that already has an outcome, and do not treat a 409 as a reason to run the operation again.

Inventory​

This module covers the inventory concepts customers use to describe what they are governing.

MethodPath
GET, POST/v1/assets
PATCH, DELETE/v1/assets/{id}
GET, POST/v1/groups
PATCH, DELETE/v1/groups/{id}
GET/v1/integration-presets

AI inventory on assets​

POST /v1/assets and PATCH /v1/assets/{id} accept an optional ai_inventory object, and asset reads return it when set. It is a customer-asserted description of an AI asset. It is not a legal classification, it is not policy input, and it does not change any decision.

MemberRule
intended_purpose1 to 512 UTF-8 bytes, no control characters. Do not include personal data, secrets, assessment text or raw prompts
risk_tierminimal, limited, high or prohibited_check. A label only; it has no built-in enforcement behavior
high_risk_categoryOpaque, 1 to 128 characters from A-Z a-z 0-9 . _ : -
accountable_ownerSame character rule. Must be the ID of an active user in your organization; an unknown or other-organization user returns 404
impact_assessment_ref, fundamental_rights_impact_assessment_ref, model_card_refA reference of the form urn:opk: followed by A-Z a-z 0-9 . _ : -, at most 256 characters. References are stored as text and never fetched; URLs are rejected
{
"name": "support-assistant",
"environment": "production",
"group": "support",
"ai_inventory": {
"intended_purpose": "Drafts replies for customer support agents",
"risk_tier": "limited",
"accountable_owner": "usr_example",
"model_card_ref": "urn:opk:model-card:support-assistant:1"
}
}
  • Bounds. The encoded object is at most 2 KiB. Unknown members, null members, empty strings and a null object are rejected with 400.
  • Permissions. Writing ai_inventory needs exactly the permissions that asset create and update already need: the assets:write scope for API keys, the super_admin role for signed-in users, and the asset-management entitlement that those calls already require. There is no new scope, role or entitlement. Anyone who can read an asset can read its inventory. See Access & Permissions.
  • Update behavior. Omitting ai_inventory on PATCH leaves it unchanged. Providing it replaces the whole object, so members you leave out are removed, except that an omitted risk_tier keeps the current tier. Clearing a tier or removing the object is not supported. Assets created without it have no ai_inventory.
  • Separate from the definition. The inventory is stored apart from the asset definition and from evaluation metadata.
  • Audit. Creating an asset with an inventory, or changing it, records an asset.risk.classified evidence record in the same database transaction as the asset change. Submitting an unchanged inventory records nothing. The record names the asset, carries the inventory members, identifies the acting user (human) or API key (service) and has a SHA-256 event hash. The regular asset.created and asset.updated audit events do not carry inventory members. See Audit and Decision Records.

Asset discovery​

Detection points report assets that are not yet registered. Requires the asset_discovery:write scope for API keys. JWT callers must have the super_admin role.

MethodPathPurpose
POST/v1/asset-discoveriesSubmit an observation
GET/v1/asset-discoveriesList pending observations
DELETE/v1/asset-discoveries/{id}Dismiss an observation

Discovery is observation only. It does not evaluate a policy, return an outcome, or create a decision. The discovery_id you supply is the idempotency key, so repeated sightings aggregate rather than duplicate.

{
"discovery_id": "dsc_01J...",
"asset": {
"key": "billing.refund-api",
"displayName": "Billing Refund API",
"kind": "rest_api",
"environment": "production"
},
"metadata": { "operation": "refund", "amount": 250 }
}

Asset example:

{
"name": "invoice-agent",
"environment": "sandbox",
"group": "payments"
}

Group example:

{
"name": "payments",
"approvers": "finance-lead@acme.com,owner@acme.com"
}

Policies​

This module covers policy creation and lifecycle.

MethodPath
GET, POST/v1/policies
PATCH, DELETE/v1/policies/{id}
POST/v1/policies/{id}/clone
GET/v1/policies/{id}/revisions
PATCH/v1/policies/{id}/activation
POST/v1/policies/{id}/rollback
POST/v1/policies/validate
POST/v1/policies/simulate
POST/v1/policies/{id}/publish
POST/v1/policies/{id}/archive

Every change to a policy creates a revision. rollback restores an earlier revision and records the rollback as a new revision, so history is never discarded.

Policies expose status: draft, published, or archived. Existing policies and API creates without status remain published; send "status": "draft" to prepare a non-enforcing policy. Drafts and archived policies are inactive and never evaluated. Status changes use lifecycle routes, not arbitrary PATCH. Published edits and rollbacks retain their immediate live effect; draft rollbacks remain draft. Archived policies are read-only except delete/clone. Illegal transitions, including publishing an already published policy or activating a nonpublished policy, return HTTP 409 with code: invalid_policy_state. Publish and archive take no request body and return HTTP 200 with the updated policy. Publishing validates and immediately activates the saved draft; archive sets it inactive. The existing clone route takes {"assetId":"ast_example"} and creates a published, active policy at the destination asset, including when the source is draft or archived. Clone requires policy.clone; use explicit draft creation instead when preparing a non-enforcing copy.

Validate and simulate take an assetId and proposed condition/policy definitions; simulation also takes metadata and optional transport. They do not save policies, record decisions/audit, charge usage, consume approvals or create operation/outcome state. Simulation returns a 200 preview decision/trace, never execution permission or an approval ID. Invalid definitions/context return coded 400. Both use existing policy-management authorization; simulation also requires playground access. See lifecycle and previews.

Create, update, clone, activation, publish, and rollback validate conditions against current rules and the current asset schema. Invalid conditions return HTTP 400 with code: invalid_policy_condition without changing the policy or its revisions. Successful writes can include informational warnings, a string array; rule_field_optional warns that a restrictive rule references metadata not explicitly required. See Policy authoring.

Policy preview requests​

Both preview endpoints require assetId and a policies array containing zero to 100 proposed definitions. Each definition contains condition and decision; saved policies are not implicitly added. Requests are limited to 1 MiB. Definitions use the current asset schema. Validation checks definitions only; simulation also checks runtime metadata and transport. Principal identity and role come from the authenticated caller, never the request body.

For POST /v1/policies/validate:

{
"assetId": "ast_example",
"policies": [
{
"condition": {"field": "asset.id", "operator": "=", "value": "ast_example"},
"decision": "approval_required"
}
]
}

Successful validation returns HTTP 200:

{"valid": true}

An optional warnings string array carries authoring warnings. Simulation uses the same definition array, with optional metadata and canonical transport context. Omitted transport defaults to HTTP. For example, an empty proposed set at POST /v1/policies/simulate:

{"assetId": "ast_example", "policies": [], "metadata": {}}

returns HTTP 200:

{
"preview": true,
"decision": "allow",
"reason": "no_policies_assigned",
"assetId": "ast_example",
"evaluationTrace": {"steps": [], "fallbackReason": "no_policies_assigned"}
}

A nonempty set returns a trace of those proposed policies. allow, deny and approval_required all remain previews: no real decision ID, approval ID, operation ID, payload binding, or execution grant is issued. Invalid requests, definitions and context return HTTP 400 with invalid_request, invalid_policy_condition, or invalid_context, respectively.

Policy condition example​

{
"field": "metadata.amount",
"operator": ">",
"value": 5000
}

Conditions also support exists and not_exists with no value, case-sensitive string starts_with, and any for homogeneous list/scalar membership. {"not":{...}} negates one permitted leaf: required-metadata comparisons, metadata presence tests, or supported asset/principal fields. Transport negation, nested wrappers and optional-metadata comparisons under not are rejected. An all group can contain negated leaves. See the matching reference for type, null, schema and missing-field rules; any is not a logical OR group.

Approvals and history​

This module covers the review queue and traceability surfaces. See Approvals & Webhooks for the full delivery model (webhook, app-managed retry, short wait, polling).

MethodPathPurpose
GET/v1/approvalsList approvals. Filter with status: pending, approved, rejected, expired, or consumed
GET/v1/approvals/{id}Get a single approval (polling/short-wait)
POST/v1/approvals/{id}/approveApprove decision (user JWT with super_admin or user role; API keys are refused)
POST/v1/approvals/{id}/rejectReject decision (user JWT with super_admin or user role; API keys are refused)
POST/v1/approvals/{id}/revokeRevoke a pending or approved approval (user JWT with super_admin or user role; API keys are refused)
GET/v1/decision-explorerDecision history
GET/v1/decisions/{decision_id}/explanationRead-only decision explanation (decision-explanation.v1); signed-in super_admin or auditor only, API keys are refused (see Audit)
GET/v1/auditAudit trail
GET/v1/audit/operations/{operation_id}Recorded operation detail (see Audit; an auditor's read is recorded, see Auditor access records)
GET/v1/audit/outcome-coverageCounts of allowed operations by entry path and outcome state for a window of at most 90 days (see Audit)
GET/v1/usageUsage counters

Approval example:

{
"id": "apr_5c6d7e8f",
"decisionId": "dec_9f2a1c4e",
"assetId": "invoice-agent",
"policyId": "pol_8a1b2c3d",
"requesterId": "key_4f5e6d7c",
"status": "pending",
"expiresAt": "2026-09-13T11:15:00Z"
}

Webhooks​

Register an endpoint to receive signed, async approval lifecycle events — the recommended delivery model over polling. See Approvals & Delivery.

MethodPathPurpose
GET, POST/v1/webhooksList / register a webhook endpoint
POST/v1/webhooks/{id}/rotateRotate the signing secret
DELETE/v1/webhooks/{id}Remove a webhook endpoint

Event types: approval.pending, approval.approved, approval.rejected, approval.expired, and approval.revoked. The approval.pending payload includes approvalId, decisionId, operation_id, policyId, and expiresAt. For MCP tool calls, it also includes mcpServer and mcpTool. Each delivery includes X-OpenProdkt-Event-Id and X-OpenProdkt-Timestamp headers. X-OpenProdkt-Signature uses the form v1=sha256=<hex> and contains an HMAC-SHA256 of the exact timestamp header, a period, and the raw request body, using the endpoint secret (shown once, at creation or rotation).

Access and permissions​

This module covers API keys and machine permissions.

MethodPath
GET, POST/v1/api-keys
POST/v1/api-keys/{id}/rotate
POST/v1/api-keys/{id}/revoke

POST /v1/api-keys requires name, scopes, and expiresAt (an RFC3339 timestamp, at most 365 days in the future). Key status is active, revoked, or expired, and each key reports lastUsed. Create, rotate, and revoke require a super_admin user JWT. See Auth and Access for rotation guidance.

Delivery and integrations​

This module covers the public API and SDK contract.

SurfacePath
API docs/swagger
OpenAPI schema/openapi.json

Response expectations​

  1. Success responses return JSON.
  2. Validation errors return 400.
  3. Authentication failures return 401.
  4. Permission failures return 403.
  5. State conflicts return 409.
  6. Rate or quota limits return 429.

Only 429 and 5xx responses are worth retrying. See the Developer Guide for retry and pagination guidance.

Source of truth​

Use /openapi.json for exact request and response schemas.