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
| Method | Path | Description |
|---|---|---|
GET | /health | Health check |
GET | /docs | Interactive API docs |
GET | /swagger | Interactive API docs (legacy alias) |
GET | /openapi.json | OpenAPI schema (JSON) |
GET | /openapi.yaml | OpenAPI schema (YAML) |
Authentication
OpenProdkt uses two credential types:
- JWT for human Console sessions.
- 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.
| Method | Path | Purpose |
|---|---|---|
POST | /auth/register | Create an organization and first owner |
GET | /auth/onboarding-requests/{id} | Check onboarding request status |
POST | /auth/request-code | Request one-time login code |
POST | /auth/verify | Exchange code for JWT |
POST | /auth/logout | Revoke the current session |
GET | /me | Current user profile |
GET | /settings | Workspace settings |
GET | /members | List workspace members |
POST | /members | Invite workspace member (roles user, billing_admin, auditor; optional accessExpiresAt, required for auditor) |
POST | /members/{id}/activate | Reactivate a member |
POST | /members/{id}/deactivate | Deactivate a member |
POST | /members/{id}/access-expiry | Renew, 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.
| Method | Path | Caller | Purpose |
|---|---|---|---|
POST | /v1/evaluate | SDKs and framework adapters | Authorize an operation |
POST | /v1/proxy/evaluate | Transparent 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/outcomes | MCP stdio adapter and SDK callers | Report the outcome of an allowed call: succeeded, failed, or unknown, with optional execution correlation |
POST | /v1/playground/decision | Console playground | Test 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:
| Status | Meaning |
|---|---|
200 | Allowed, including a validated redemption of an approved operation |
202 | Approval pending (/v1/evaluate only) |
400 | Invalid request |
402 | Decision, approval, or notification quota exhausted |
403 | Denied, or the approval is rejected, expired, revoked, or consumed. On /v1/proxy/evaluate, a pending approval also returns 403 with a challenge |
404 | Referenced approval does not exist |
409 | asset_identity_conflict, operation_id_conflict, approval_retry_mismatch, or operation_in_progress |
503 | Policy 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
| Part | Rule |
|---|---|
| Version | Two 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 ID | 32 hex characters, not all zeros |
| Parent ID | 16 hex characters, not all zeros |
| Flags | Two hex characters |
| Whole value | At 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
traceparentis00-<your trace ID>-<new span ID>-<your flags>. The response always uses version00. - 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.
tracestateandbaggageare 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
traceparentwithout 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.
| Member | Type and bounds | Meaning |
|---|---|---|
execution_id | Lowercase 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 |
attempt | JSON integer from 1 to 2147483647 | Attempt number. Zero, negative, fractional, exponent, string and out-of-range values are rejected |
upstream_request_id | 1 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
nullor does not match the format returns400 invalid_request, and nothing is stored. - One outcome per operation. The first report for an
operation_idis 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 returns409 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_idis possible. - Where they appear. When supplied, the members are returned in the
outcomeobject ofGET /v1/proxy/operations/{operation_id}, and are included in theoperation.outcome.reportedaudit event payload and webhook payload. - Authorization is unchanged. Only the principal that received the
allowcan 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/outcomesdoes not reject a report because it is late. The principal that received theallowcan 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_idreturns201and is authoritative. An identical later report returns200and records nothing new. A report that differs in status, completion time, result hash or any optional member returns409 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.missingaudit event. For an allow whose decision declaredoutcome_reporting: none, it stores anexecution.outcome.not_reportableevent 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 syntheticsucceeded,failedorunknownreport 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 asoperation.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 declaredoutcome_reporting: none, the read-timeoperation.outcome.not_reportedrow 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.
| Method | Path |
|---|---|
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.
| Member | Rule |
|---|---|
intended_purpose | 1 to 512 UTF-8 bytes, no control characters. Do not include personal data, secrets, assessment text or raw prompts |
risk_tier | minimal, limited, high or prohibited_check. A label only; it has no built-in enforcement behavior |
high_risk_category | Opaque, 1 to 128 characters from A-Z a-z 0-9 . _ : - |
accountable_owner | Same 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_ref | A 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,
nullmembers, empty strings and anullobject are rejected with400. - Permissions. Writing
ai_inventoryneeds exactly the permissions that asset create and update already need: theassets:writescope for API keys, thesuper_adminrole 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_inventoryonPATCHleaves it unchanged. Providing it replaces the whole object, so members you leave out are removed, except that an omittedrisk_tierkeeps the current tier. Clearing a tier or removing the object is not supported. Assets created without it have noai_inventory. - Separate from the definition. The inventory is stored apart from the asset
definitionand from evaluation metadata. - Audit. Creating an asset with an inventory, or changing it, records an
asset.risk.classifiedevidence 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 regularasset.createdandasset.updatedaudit 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.
| Method | Path | Purpose |
|---|---|---|
POST | /v1/asset-discoveries | Submit an observation |
GET | /v1/asset-discoveries | List 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.
| Method | Path |
|---|---|
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).
| Method | Path | Purpose |
|---|---|---|
GET | /v1/approvals | List 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}/approve | Approve decision (user JWT with super_admin or user role; API keys are refused) |
POST | /v1/approvals/{id}/reject | Reject decision (user JWT with super_admin or user role; API keys are refused) |
POST | /v1/approvals/{id}/revoke | Revoke a pending or approved approval (user JWT with super_admin or user role; API keys are refused) |
GET | /v1/decision-explorer | Decision history |
GET | /v1/decisions/{decision_id}/explanation | Read-only decision explanation (decision-explanation.v1); signed-in super_admin or auditor only, API keys are refused (see Audit) |
GET | /v1/audit | Audit 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-coverage | Counts of allowed operations by entry path and outcome state for a window of at most 90 days (see Audit) |
GET | /v1/usage | Usage 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.
| Method | Path | Purpose |
|---|---|---|
GET, POST | /v1/webhooks | List / register a webhook endpoint |
POST | /v1/webhooks/{id}/rotate | Rotate 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.
| Method | Path |
|---|---|
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.
| Surface | Path |
|---|---|
| API docs | /swagger |
| OpenAPI schema | /openapi.json |
Response expectations
- Success responses return JSON.
- Validation errors return 400.
- Authentication failures return 401.
- Permission failures return 403.
- State conflicts return 409.
- 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.