{
  "openapi": "3.1.0",
  "info": {
    "title": "OptinRouter developer contract preview",
    "version": "2026-10-19-preview",
    "description": "Public design contract. /v1 endpoints return 401 for all keys. Only /api/model-rates is an available read API. Signup and production credentials are closed. Draft request shapes and scope names may change before beta."
  },
  "servers": [
    {
      "url": "https://optinrouter.ai"
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "summary": "List eligible models",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "get_v1_models",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "catalog:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed model list. Eligibility comes from current key and policy.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 160
                          },
                          "object": {
                            "const": "model"
                          },
                          "owned_by": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "summary": "OpenAI-format inference",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post_v1_chat_completions",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "inference:write"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed certified chat-completion response or SSE stream.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "choices"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "usage": {
                      "type": "object"
                    }
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object"
                    }
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-OptinRouter-Policy",
            "in": "header",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160,
              "pattern": "^[a-zA-Z0-9_.@:/-]+$"
            },
            "description": "Proposed revision reference. Cannot override organization rules."
          },
          {
            "name": "X-OptinRouter-Actions",
            "in": "header",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160,
              "pattern": "^[a-zA-Z0-9_.@:/-]+$"
            },
            "description": "Proposed revision reference. Cannot override organization rules."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            "description": "Tenant/operation scoped. A different payload with this key conflicts."
          }
        ]
      }
    },
    "/v1/policies": {
      "post": {
        "summary": "Create a versioned policy",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post_v1_policies",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "policy:write"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "201": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyRevision"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Policy"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            "description": "Tenant/operation scoped. A different payload with this key conflicts."
          }
        ]
      }
    },
    "/v1/policies/validate": {
      "post": {
        "summary": "Validate a policy without publishing",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post_v1_policies_validate",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "policy:validate"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Policy"
              }
            }
          }
        }
      }
    },
    "/v1/policies/{policy_id}": {
      "get": {
        "summary": "Read a policy revision",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "get_v1_policies_policy_id",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "policy:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyRevision"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          }
        ]
      }
    },
    "/v1/grammars/validate": {
      "post": {
        "summary": "Validate a grammar contract",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post_v1_grammars_validate",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "grammar:validate"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Grammar"
              }
            }
          }
        }
      }
    },
    "/v1/action-graphs/validate": {
      "post": {
        "summary": "Validate a context action DAG",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post_v1_action-graphs_validate",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "actions:validate"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionGraph"
              }
            }
          }
        }
      }
    },
    "/v1/action-graphs": {
      "post": {
        "summary": "Publish a versioned action DAG",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post_v1_action-graphs",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "actions:write"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "201": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionGraphRevision"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionGraph"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            "description": "Tenant/operation scoped. A different payload with this key conflicts."
          }
        ]
      }
    },
    "/v1/traces/{trace_id}": {
      "get": {
        "summary": "Read a redacted inference trace",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "get_v1_traces_trace_id",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "trace:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trace"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "trace_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          }
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "summary": "Read scoped usage and costs",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized. Metadata aggregates only, tenant-scoped by authenticated identity. Bounded time ranges and pagination required; P95 uses nearest-rank inference-path latency. Inference performed before an output failure remains counted.",
        "operationId": "get_v1_usage",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "usage:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            }
          },
          {
            "name": "endpoint_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "allowed",
                "blocked",
                "cancelled"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ]
      }
    },
    "/v1/reports/sovereignty": {
      "post": {
        "summary": "Request a scoped provenance and sovereignty report",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post_v1_reports_sovereignty",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "reports:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "202": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportJob"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            "description": "Tenant/operation scoped. A different payload with this key conflicts."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportRequest"
              }
            }
          }
        }
      }
    },
    "/api/model-rates": {
      "get": {
        "summary": "Read the public cached model-rate snapshot",
        "operationId": "get_public_model_rates",
        "security": [],
        "x-implementation-status": "available",
        "responses": {
          "200": {
            "description": "Persisted model rates, benchmark metadata, fetchedAt, source and popularityBasis. Refreshed automatically every two minutes."
          },
          "503": {
            "description": "No successful snapshot is available."
          }
        }
      }
    },
    "/v1/policies/{policy_id}/activate": {
      "post": {
        "operationId": "post__v1_policies_policy_id_activate",
        "summary": "Activate or roll back an authorized policy revision",
        "description": "Design preview only. Public access returns 401.",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "policy:activate"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "parameters": [
          {
            "name": "policy_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            "description": "Tenant/operation scoped. A different payload with this key conflicts."
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyRevision"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Activation"
              }
            }
          }
        }
      }
    },
    "/v1/reports/{report_id}": {
      "get": {
        "operationId": "get__v1_reports_report_id",
        "summary": "Read a scoped report job",
        "description": "Design preview only. Public access returns 401.",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "reports:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "parameters": [
          {
            "name": "report_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportJob"
                }
              }
            }
          }
        }
      }
    },
    "/v1/grammars": {
      "post": {
        "summary": "Publish a versioned grammar",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post__v1_grammars",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "grammar:write"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "201": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrammarRevision"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Grammar"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            "description": "Tenant/operation scoped. A different payload with this key conflicts."
          }
        ]
      }
    },
    "/v1/grammars/{grammar_id}": {
      "get": {
        "summary": "Read a grammar revision",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "get__v1_grammars_grammar_id",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "grammar:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrammarRevision"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "grammar_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          }
        ]
      }
    },
    "/v1/action-graphs/{graph_id}": {
      "get": {
        "summary": "Read an action graph revision",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "get__v1_action-graphs_graph_id",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "actions:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionGraphRevision"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "graph_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          }
        ]
      }
    },
    "/v1/reports/provenance": {
      "post": {
        "summary": "Request a scoped provenance report",
        "description": "Design preview. This production capability is not available. The public endpoint currently returns 401 Unauthorized.",
        "operationId": "post__v1_reports_provenance",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "reports:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Usage/rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Required control unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Deadline exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "202": {
            "description": "Proposed success envelope. Not currently available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportJob"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            },
            "description": "Tenant/operation scoped. A different payload with this key conflicts."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportRequest"
              }
            }
          }
        }
      }
    },
    "/v1/routes/explain": {
      "post": {
        "operationId": "explain_routes",
        "summary": "Explain endpoint eligibility against a pinned policy",
        "description": "Preview only. No production implementation; all keys return 401. Inputs are tenant-scoped and must satisfy the active policy.",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "routing:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Proposed preview result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "policy_ref": {
                      "type": "string"
                    },
                    "candidates": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "endpoint_id": {
                            "type": "string"
                          },
                          "eligible": {
                            "type": "boolean"
                          },
                          "reason_codes": {
                            "type": "array",
                            "items": {
                              "enum": [
                                "region_not_allowed",
                                "region_unverified",
                                "grammar_unsupported",
                                "cost_limit",
                                "token_limit"
                              ]
                            }
                          },
                          "region_evidence_ref": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "endpoint_id",
                          "eligible",
                          "reason_codes"
                        ]
                      }
                    }
                  },
                  "description": "Tenant-scoped metadata only. No raw content or commercial effects.",
                  "required": [
                    "simulation",
                    "policy_ref",
                    "candidates"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "policy_ref": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "candidate_ids": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160
                    }
                  }
                },
                "required": [
                  "policy_ref",
                  "candidate_ids"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/actions/simulate": {
      "post": {
        "operationId": "simulate_actions",
        "summary": "Simulate an action graph on a named synthetic fixture without provider calls",
        "description": "Preview only. No production implementation; all keys return 401. Inputs are tenant-scoped and must satisfy the active policy.",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "actions:simulate"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Proposed preview result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "policy_ref": {
                      "type": "string"
                    },
                    "graph_ref": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "node_id": {
                            "type": "string"
                          },
                          "batch": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "status": {
                            "enum": [
                              "passed",
                              "blocked",
                              "failed_optional",
                              "skipped"
                            ]
                          },
                          "placement": {
                            "enum": [
                              "managed",
                              "customer_server",
                              "end_device"
                            ]
                          },
                          "duration_ms": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "reason_code": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "node_id",
                          "batch",
                          "status",
                          "placement",
                          "duration_ms"
                        ]
                      }
                    },
                    "external_effects": {
                      "const": false
                    },
                    "provider_calls": {
                      "const": 0
                    }
                  },
                  "description": "Tenant-scoped metadata only. No raw content or commercial effects.",
                  "required": [
                    "simulation",
                    "policy_ref",
                    "graph_ref",
                    "events",
                    "external_effects",
                    "provider_calls"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "graph_ref": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "policy_ref": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "fixture": {
                    "enum": [
                      "review",
                      "grammar_failure",
                      "risk_block",
                      "lookup_timeout",
                      "stale_policy"
                    ]
                  },
                  "placement": {
                    "enum": [
                      "managed",
                      "customer_server",
                      "end_device"
                    ]
                  }
                },
                "required": [
                  "graph_ref",
                  "policy_ref",
                  "fixture",
                  "placement"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/marketplace/offers/preview": {
      "post": {
        "operationId": "preview_data_offer",
        "summary": "Check consent, provenance and license eligibility without purchasing or delivering",
        "description": "Preview only. No production implementation; all keys return 401. Inputs are tenant-scoped and must satisfy the active policy.",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "marketplace:read"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Proposed preview result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "eligible": {
                      "type": "boolean"
                    },
                    "consent_ref": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "license_ref": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provenance_ref": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "block_reasons": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "delivery_authorized": {
                      "const": false
                    }
                  },
                  "description": "Tenant-scoped metadata only. No raw content or commercial effects.",
                  "required": [
                    "simulation",
                    "eligible",
                    "consent_ref",
                    "license_ref",
                    "provenance_ref",
                    "block_reasons",
                    "delivery_authorized"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "dataset_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "intended_use": {
                    "enum": [
                      "training",
                      "evaluation"
                    ]
                  },
                  "processing_region": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  }
                },
                "required": [
                  "dataset_id",
                  "intended_use",
                  "processing_region"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/provider/certifications/preview": {
      "post": {
        "operationId": "preview_endpoint_certification",
        "summary": "Inspect proposed endpoint certification requirements without registration or live rollout",
        "description": "Preview only. No production implementation; all keys return 401. Inputs are tenant-scoped and must satisfy the active policy.",
        "x-implementation-status": "preview_not_available",
        "x-required-scopes": [
          "provider:validate"
        ],
        "security": [
          {
            "workspaceKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Proposed preview result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "endpoint_ref": {
                      "type": "string"
                    },
                    "checks": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "properties": {
                          "capability": {
                            "type": "string"
                          },
                          "evidence_ref": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "enum": [
                              "passed",
                              "failed",
                              "unknown"
                            ]
                          }
                        },
                        "required": [
                          "capability",
                          "status"
                        ]
                      }
                    },
                    "live_routing_enabled": {
                      "const": false
                    }
                  },
                  "description": "Tenant-scoped metadata only. No raw content or commercial effects.",
                  "required": [
                    "simulation",
                    "endpoint_ref",
                    "checks",
                    "live_routing_enabled"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Public access closed or unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope or policy denial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Invalid contract or unsupported feature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "endpoint_ref": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "profile_ref": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  }
                },
                "required": [
                  "endpoint_ref",
                  "profile_ref"
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "workspaceKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Preview workspace-scoped credential. Key issuance is closed."
      }
    },
    "schemas": {
      "Policy": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "version": {
            "const": "2026-10-19-preview"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "mode": {
            "const": "enterprise_private"
          },
          "allowed_locations": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "enum": [
                "managed",
                "customer_server",
                "end_device"
              ]
            }
          },
          "routing": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "models": {
                "type": "array",
                "minItems": 1,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160,
                  "pattern": "^[a-zA-Z0-9_.@:/-]+$"
                }
              },
              "regions": {
                "type": "array",
                "minItems": 1,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                }
              },
              "require_verified_region": {
                "const": true
              }
            },
            "required": [
              "models",
              "regions",
              "require_verified_region"
            ]
          },
          "retention": {
            "const": "no_content"
          },
          "data_exchange": {
            "const": false
          },
          "input": {
            "type": "array",
            "maxItems": 12,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "enum": [
                    "semantic_filter",
                    "redact",
                    "grammar",
                    "context_lookup",
                    "usage_check"
                  ]
                },
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160,
                  "pattern": "^[a-zA-Z0-9_.@:/-]+$"
                },
                "required": {
                  "type": "boolean"
                }
              },
              "required": [
                "kind",
                "ref",
                "required"
              ]
            }
          },
          "output": {
            "type": "array",
            "maxItems": 12,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "enum": [
                    "semantic_filter",
                    "redact",
                    "grammar",
                    "context_lookup",
                    "usage_check"
                  ]
                },
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160,
                  "pattern": "^[a-zA-Z0-9_.@:/-]+$"
                },
                "required": {
                  "type": "boolean"
                }
              },
              "required": [
                "kind",
                "ref",
                "required"
              ]
            }
          },
          "limits": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "deadline_ms": {
                "type": "integer",
                "minimum": 100,
                "maximum": 120000
              },
              "max_parallel_actions": {
                "type": "integer",
                "minimum": 0,
                "maximum": 8
              },
              "max_repair_attempts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 2
              }
            },
            "required": [
              "deadline_ms",
              "max_parallel_actions",
              "max_repair_attempts"
            ]
          },
          "failure_mode": {
            "const": "block"
          },
          "delivery": {
            "enum": [
              "buffered",
              "validated_stream_units"
            ]
          }
        },
        "required": [
          "version",
          "name",
          "mode",
          "allowed_locations",
          "routing",
          "retention",
          "data_exchange",
          "input",
          "output",
          "limits",
          "failure_mode",
          "delivery"
        ]
      },
      "Grammar": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "version": {
            "const": "2026-10-19-preview"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "format": {
            "const": "json_schema"
          },
          "target": {
            "enum": [
              "request",
              "tool_arguments",
              "response"
            ]
          },
          "definition": {
            "type": "object"
          },
          "max_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1048576
          },
          "max_depth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "on_invalid": {
            "enum": [
              "block",
              "hold"
            ]
          }
        },
        "required": [
          "version",
          "name",
          "format",
          "target",
          "definition",
          "max_bytes",
          "max_depth",
          "on_invalid"
        ]
      },
      "ActionGraph": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "version": {
            "const": "2026-10-19-preview"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "max_parallel": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "nodes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "phase": {
                  "enum": [
                    "input",
                    "output"
                  ]
                },
                "placement": {
                  "enum": [
                    "managed",
                    "customer_server",
                    "end_device"
                  ]
                },
                "trigger": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "field": {
                      "enum": [
                        "context.data_class",
                        "context.task",
                        "result.format",
                        "result.validation"
                      ]
                    },
                    "equals": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "required": [
                    "field",
                    "equals"
                  ]
                },
                "tool": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160,
                  "pattern": "^[a-zA-Z0-9_.@:/-]+$"
                },
                "input_projection": {
                  "type": "array",
                  "maxItems": 12,
                  "uniqueItems": true,
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160,
                    "pattern": "^[a-zA-Z0-9_.@:/-]+$"
                  }
                },
                "depends_on": {
                  "type": "array",
                  "maxItems": 16,
                  "uniqueItems": true,
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "required": {
                  "type": "boolean"
                },
                "timeout_ms": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 30000
                },
                "output_slot": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "on_failure": {
                  "enum": [
                    "block",
                    "hold",
                    "continue_without_result"
                  ]
                }
              },
              "required": [
                "id",
                "phase",
                "placement",
                "trigger",
                "tool",
                "input_projection",
                "depends_on",
                "required",
                "timeout_ms",
                "output_slot",
                "on_failure"
              ]
            }
          },
          "join": {
            "const": "all_required_before_release"
          },
          "external_side_effects": {
            "const": false
          }
        },
        "required": [
          "version",
          "name",
          "max_parallel",
          "nodes",
          "join",
          "external_side_effects"
        ]
      },
      "TraceEvent": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "event_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "parent_event_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "trace_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "request_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "policy_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160,
            "pattern": "^[a-zA-Z0-9_.@:/-]+$"
          },
          "stage": {
            "enum": [
              "input",
              "routing",
              "inference",
              "output",
              "action",
              "delivery"
            ]
          },
          "outcome": {
            "enum": [
              "allowed",
              "blocked",
              "held",
              "failed",
              "cancelled"
            ]
          },
          "location": {
            "enum": [
              "managed",
              "customer_server",
              "end_device"
            ]
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "region_evidence": {
            "enum": [
              "verified",
              "attested",
              "unknown"
            ]
          },
          "duration_ms": {
            "type": "number",
            "minimum": 0
          },
          "content_retained": {
            "type": "boolean"
          }
        },
        "required": [
          "event_id",
          "parent_event_id",
          "trace_id",
          "request_id",
          "policy_ref",
          "stage",
          "outcome",
          "location",
          "region",
          "region_evidence",
          "duration_ms",
          "content_retained"
        ]
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "ValidationResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "path": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "code",
                "message"
              ]
            }
          }
        },
        "required": [
          "valid",
          "errors"
        ]
      },
      "PolicyRevision": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "policy_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "policy_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "policy": {
            "$ref": "#/components/schemas/Policy"
          }
        },
        "required": [
          "policy_id",
          "revision",
          "policy_ref",
          "policy"
        ]
      },
      "ActionGraphRevision": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "graph_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "graph_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "graph": {
            "$ref": "#/components/schemas/ActionGraph"
          }
        },
        "required": [
          "graph_id",
          "revision",
          "graph_ref",
          "graph"
        ]
      },
      "Trace": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "trace_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TraceEvent"
            }
          },
          "coverage": {
            "enum": [
              "complete_for_observed_path",
              "partial",
              "unverified"
            ]
          }
        },
        "required": [
          "trace_id",
          "events",
          "coverage"
        ]
      },
      "Usage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "currency": {
            "const": "USD"
          },
          "input_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "output_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "total_cost_usd": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$"
          }
        },
        "required": [
          "from",
          "to",
          "currency",
          "input_tokens",
          "output_tokens",
          "total_cost_usd"
        ]
      },
      "ReportRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "sovereignty",
              "provenance"
            ]
          },
          "include_content": {
            "const": false
          }
        },
        "required": [
          "from",
          "to",
          "kind",
          "include_content"
        ]
      },
      "ReportJob": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "report_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "ready",
              "failed"
            ]
          },
          "coverage": {
            "enum": [
              "complete_for_observed_path",
              "partial",
              "unverified"
            ]
          },
          "download_ref": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "report_id",
          "status",
          "coverage",
          "download_ref"
        ]
      },
      "Activation": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "revision_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "expected_current_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "rollout_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          }
        },
        "required": [
          "revision_ref",
          "expected_current_ref",
          "rollout_percent"
        ]
      },
      "GrammarRevision": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "grammar_id",
          "revision",
          "grammar_ref",
          "grammar"
        ],
        "properties": {
          "grammar_id": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "grammar_ref": {
            "type": "string"
          },
          "grammar": {
            "$ref": "#/components/schemas/Grammar"
          }
        }
      }
    }
  },
  "x-mcp-manifest": "/docs/optinrouter-mcp-preview.json"
}
