{
  "openapi": "3.1.0",
  "info": {
    "title": "AgenticAudit",
    "description": "Log, classify and audit AI agent actions for GDPR/AI Act/SOC2 compliance",
    "version": "0.1.0"
  },
  "paths": {
    "/health": {
      "get": {
        "summary": "Health",
        "description": "Health check endpoint with database connectivity verification.",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Health Health Get"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "post": {
        "summary": "Log an audit event",
        "description": "Record an agent action. The event will be classified for risk, checked for PII, and mapped to compliance frameworks.",
        "operationId": "ingest_event_v1_events_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuditEventCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventRead"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "422": {
            "description": "Validation error in request body"
          }
        }
      },
      "get": {
        "summary": "List events",
        "description": "List events with filtering and pagination.",
        "operationId": "list_events_endpoint_v1_events_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by agent ID",
              "title": "Agent Id"
            },
            "description": "Filter by agent ID"
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by action type",
              "title": "Action"
            },
            "description": "Filter by action type"
          },
          {
            "name": "risk_level",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by risk level",
              "title": "Risk Level"
            },
            "description": "Filter by risk level"
          },
          {
            "name": "pii_detected",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by PII detection",
              "title": "Pii Detected"
            },
            "description": "Filter by PII detection"
          },
          {
            "name": "session_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by session ID",
              "title": "Session Id"
            },
            "description": "Filter by session ID"
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter events after this datetime",
              "title": "After"
            },
            "description": "Filter events after this datetime"
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter events before this datetime",
              "title": "Before"
            },
            "description": "Filter events before this datetime"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "description": "Maximum number of events to return",
              "default": 50,
              "title": "Limit"
            },
            "description": "Maximum number of events to return"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Number of events to skip",
              "default": 0,
              "title": "Offset"
            },
            "description": "Number of events to skip"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List Events Endpoint V1 Events Get"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/stats": {
      "get": {
        "summary": "Get event statistics",
        "description": "Aggregate statistics for events including risk levels, actions, and PII counts.",
        "operationId": "events_stats_v1_events_stats_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter events after this datetime",
              "title": "After"
            },
            "description": "Filter events after this datetime"
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter events before this datetime",
              "title": "Before"
            },
            "description": "Filter events before this datetime"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Events Stats V1 Events Stats Get"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/{event_id}": {
      "get": {
        "summary": "Get event by ID",
        "description": "Get a single event by ID.",
        "operationId": "get_event_by_id_v1_events__event_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Event Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventRead"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "404": {
            "description": "Event not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/org/policy": {
      "get": {
        "summary": "Get organization policy",
        "description": "Returns the current compliance policy for the organization.",
        "operationId": "get_policy_v1_org_policy_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Get Policy V1 Org Policy Get"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "404": {
            "description": "Organization not found"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      },
      "put": {
        "summary": "Update organization policy",
        "description": "Partially update the organization's compliance policy.",
        "operationId": "update_policy_v1_org_policy_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Update Policy V1 Org Policy Put"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "404": {
            "description": "Organization not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/org/api-keys/rotate": {
      "post": {
        "summary": "Rotate API key",
        "description": "Generate a new API key and deactivate the current one. The new raw key is returned once and cannot be retrieved again.",
        "operationId": "rotate_api_key_v1_org_api_keys_rotate_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Rotate Api Key V1 Org Api Keys Rotate Post"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/otlp/v1/logs": {
      "post": {
        "tags": [
          "otlp"
        ],
        "summary": "Receive OTLP logs",
        "description": "OTLP-compatible endpoint that receives OpenTelemetry log records (ExportLogsServiceRequest JSON format). Used by Cowork for event ingestion.",
        "operationId": "receive_otlp_logs_v1_otlp_v1_logs_post",
        "responses": {
          "200": {
            "description": "Events accepted",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Receive Otlp Logs V1 Otlp V1 Logs Post"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "422": {
            "description": "Invalid OTLP payload"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/systems": {
      "post": {
        "tags": [
          "systems"
        ],
        "summary": "Register an AI system",
        "description": "Register a new AI system for compliance tracking.",
        "operationId": "create_v1_systems_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AISystemCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AISystemRead"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "systems"
        ],
        "summary": "List AI systems",
        "description": "List all registered AI systems for the organization.",
        "operationId": "list_all_v1_systems_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "include_inactive",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Include Inactive"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List All V1 Systems Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/systems/{system_id}": {
      "get": {
        "tags": [
          "systems"
        ],
        "summary": "Get AI system",
        "description": "Get a single AI system by ID.",
        "operationId": "get_one_v1_systems__system_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "system_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "System Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AISystemRead"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "systems"
        ],
        "summary": "Update AI system",
        "description": "Partially update an AI system.",
        "operationId": "update_v1_systems__system_id__put",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "system_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "System Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AISystemUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AISystemRead"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "systems"
        ],
        "summary": "Deactivate AI system",
        "description": "Soft-delete (deactivate) an AI system.",
        "operationId": "deactivate_v1_systems__system_id__delete",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "system_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "System Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/systems/{system_id}/events": {
      "get": {
        "tags": [
          "systems"
        ],
        "summary": "List events for an AI system",
        "description": "List audit events matching this system's agent_id_patterns.",
        "operationId": "system_events_v1_systems__system_id__events_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "system_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "System Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response System Events V1 Systems  System Id  Events Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/systems/{system_id}/stats": {
      "get": {
        "tags": [
          "systems"
        ],
        "summary": "Get event statistics for an AI system",
        "description": "Get aggregate event statistics for a system based on its agent_id_patterns.",
        "operationId": "system_stats_v1_systems__system_id__stats_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "system_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "System Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response System Stats V1 Systems  System Id  Stats Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/systems/{system_id}/classification-suggestion": {
      "get": {
        "tags": [
          "systems"
        ],
        "summary": "Suggest AI Act risk classification",
        "description": "Analyze events and suggest risk classification + Annex III category.",
        "operationId": "classification_suggestion_v1_systems__system_id__classification_suggestion_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "system_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "System Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Classification Suggestion V1 Systems  System Id  Classification Suggestion Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/compliance/ai-act/status": {
      "get": {
        "tags": [
          "compliance"
        ],
        "summary": "AI Act compliance status",
        "description": "Get overall AI Act compliance status for the organization.",
        "operationId": "compliance_status_v1_compliance_ai_act_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Compliance Status V1 Compliance Ai Act Status Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/compliance/ai-act/report": {
      "get": {
        "tags": [
          "compliance"
        ],
        "summary": "Download AI Act compliance report PDF",
        "description": "Generate and download an AI Act compliance report.",
        "operationId": "compliance_report_pdf_v1_compliance_ai_act_report_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/v1/compliance/ai-act/fria/{system_id}/pdf": {
      "get": {
        "tags": [
          "compliance"
        ],
        "summary": "Download FRIA PDF for a system",
        "description": "Generate a pre-filled FRIA PDF for a specific AI system.",
        "operationId": "fria_pdf_v1_compliance_ai_act_fria__system_id__pdf_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "system_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "System Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AISystemCreate": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255,
            "title": "Name"
          },
          "vendor": {
            "type": "string",
            "maxLength": 255,
            "title": "Vendor",
            "default": ""
          },
          "description": {
            "type": "string",
            "maxLength": 2000,
            "title": "Description",
            "default": ""
          },
          "use_case": {
            "type": "string",
            "maxLength": 1000,
            "title": "Use Case",
            "default": ""
          },
          "agent_id_patterns": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Agent Id Patterns"
          },
          "risk_classification": {
            "type": "string",
            "maxLength": 20,
            "title": "Risk Classification",
            "default": "unclassified"
          },
          "classification_rationale": {
            "type": "string",
            "maxLength": 2000,
            "title": "Classification Rationale",
            "default": ""
          },
          "annex_iii_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Annex Iii Category"
          },
          "role": {
            "type": "string",
            "maxLength": 20,
            "title": "Role",
            "default": "deployer"
          },
          "contract_has_ai_annex": {
            "type": "boolean",
            "title": "Contract Has Ai Annex",
            "default": false
          },
          "provider_obligations_documented": {
            "type": "boolean",
            "title": "Provider Obligations Documented",
            "default": false
          },
          "contract_last_reviewed": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contract Last Reviewed"
          },
          "contract_notes": {
            "type": "string",
            "maxLength": 2000,
            "title": "Contract Notes",
            "default": ""
          },
          "fria_status": {
            "type": "string",
            "maxLength": 20,
            "title": "Fria Status",
            "default": "not_started"
          },
          "fria_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fria Completed At"
          },
          "fria_next_review": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fria Next Review"
          },
          "next_review_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Review Date"
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "AISystemCreate",
        "description": "Schema for creating an AI system."
      },
      "AISystemRead": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "vendor": {
            "type": "string",
            "title": "Vendor"
          },
          "description": {
            "type": "string",
            "title": "Description"
          },
          "use_case": {
            "type": "string",
            "title": "Use Case"
          },
          "agent_id_patterns": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Agent Id Patterns"
          },
          "risk_classification": {
            "type": "string",
            "title": "Risk Classification"
          },
          "classification_rationale": {
            "type": "string",
            "title": "Classification Rationale"
          },
          "annex_iii_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Annex Iii Category"
          },
          "role": {
            "type": "string",
            "title": "Role"
          },
          "contract_has_ai_annex": {
            "type": "boolean",
            "title": "Contract Has Ai Annex"
          },
          "provider_obligations_documented": {
            "type": "boolean",
            "title": "Provider Obligations Documented"
          },
          "contract_last_reviewed": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contract Last Reviewed"
          },
          "contract_notes": {
            "type": "string",
            "title": "Contract Notes"
          },
          "fria_status": {
            "type": "string",
            "title": "Fria Status"
          },
          "fria_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fria Completed At"
          },
          "fria_next_review": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fria Next Review"
          },
          "is_active": {
            "type": "boolean",
            "title": "Is Active"
          },
          "next_review_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Review Date"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "org_id",
          "name",
          "vendor",
          "description",
          "use_case",
          "agent_id_patterns",
          "risk_classification",
          "classification_rationale",
          "annex_iii_category",
          "role",
          "contract_has_ai_annex",
          "provider_obligations_documented",
          "contract_last_reviewed",
          "contract_notes",
          "fria_status",
          "fria_completed_at",
          "fria_next_review",
          "is_active",
          "next_review_date",
          "created_at",
          "updated_at"
        ],
        "title": "AISystemRead",
        "description": "Schema for reading an AI system (API response)."
      },
      "AISystemUpdate": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "vendor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vendor"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "use_case": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Use Case"
          },
          "agent_id_patterns": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Id Patterns"
          },
          "risk_classification": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Risk Classification"
          },
          "classification_rationale": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Classification Rationale"
          },
          "annex_iii_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Annex Iii Category"
          },
          "role": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Role"
          },
          "contract_has_ai_annex": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contract Has Ai Annex"
          },
          "provider_obligations_documented": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider Obligations Documented"
          },
          "contract_last_reviewed": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contract Last Reviewed"
          },
          "contract_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contract Notes"
          },
          "fria_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fria Status"
          },
          "fria_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fria Completed At"
          },
          "fria_next_review": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fria Next Review"
          },
          "next_review_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Review Date"
          },
          "is_active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Active"
          }
        },
        "type": "object",
        "title": "AISystemUpdate",
        "description": "Schema for partial update of an AI system."
      },
      "AuditEventCreate": {
        "properties": {
          "agent_id": {
            "type": "string",
            "maxLength": 255,
            "title": "Agent Id"
          },
          "action": {
            "type": "string",
            "maxLength": 255,
            "title": "Action"
          },
          "data": {
            "additionalProperties": true,
            "type": "object",
            "title": "Data"
          },
          "context": {
            "additionalProperties": true,
            "type": "object",
            "title": "Context"
          },
          "reasoning": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Reasoning"
          }
        },
        "type": "object",
        "required": [
          "agent_id",
          "action"
        ],
        "title": "AuditEventCreate",
        "description": "Schema for creating an audit event (client request body)."
      },
      "AuditEventRead": {
        "properties": {
          "agent_id": {
            "type": "string",
            "maxLength": 255,
            "title": "Agent Id"
          },
          "action": {
            "type": "string",
            "maxLength": 255,
            "title": "Action"
          },
          "data": {
            "additionalProperties": true,
            "type": "object",
            "title": "Data"
          },
          "context": {
            "additionalProperties": true,
            "type": "object",
            "title": "Context"
          },
          "reasoning": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Reasoning"
          },
          "id": {
            "type": "string",
            "title": "Id"
          },
          "risk_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Risk Level"
          },
          "pii_detected": {
            "type": "boolean",
            "title": "Pii Detected",
            "default": false
          },
          "pii_fields": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Pii Fields"
          },
          "frameworks": {
            "additionalProperties": true,
            "type": "object",
            "title": "Frameworks"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "stored": {
            "type": "boolean",
            "title": "Stored",
            "default": true
          },
          "decision": {
            "type": "string",
            "title": "Decision",
            "default": "allow"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "type": "object",
        "required": [
          "agent_id",
          "action",
          "id",
          "created_at"
        ],
        "title": "AuditEventRead",
        "description": "Schema for reading an audit event (API response body)."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "PolicyUpdate": {
        "properties": {
          "logging_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logging Level"
          },
          "frameworks": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Frameworks"
          },
          "alert_rules": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alert Rules"
          },
          "blocking_rules": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Blocking Rules"
          },
          "compliance_preset": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Compliance Preset"
          },
          "retention_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Retention Days"
          }
        },
        "type": "object",
        "title": "PolicyUpdate",
        "description": "Schema for partial policy updates."
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
