{
  "openapi": "3.0.3",
  "info": {
    "title": "kike-verify API",
    "version": "0.1.0",
    "description": "KYC + KYB verification. Validation, TypeScript types and this document all derive from one TypeBox definition, so they cannot drift."
  },
  "components": {
    "schemas": {}
  },
  "paths": {
    "/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Liveness",
        "tags": [
          "health"
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "status",
                    "version"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    },
                    "version": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases": {
      "post": {
        "operationId": "createCase",
        "summary": "Create a case and run every applicable check",
        "tags": [
          "cases"
        ],
        "description": "Synchronous: returns only once the checks and the verdict are recorded. The verdict is never `rejected` — the engine stops at `review`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "subjectType",
                  "requested"
                ],
                "properties": {
                  "subjectType": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "business"
                        ]
                      },
                      {
                        "type": "string",
                        "enum": [
                          "person"
                        ]
                      }
                    ]
                  },
                  "requested": {
                    "additionalProperties": false,
                    "type": "object",
                    "required": [
                      "name"
                    ],
                    "properties": {
                      "name": {
                        "minLength": 1,
                        "maxLength": 200,
                        "type": "string"
                      },
                      "jurisdiction": {
                        "maxLength": 20,
                        "type": "string"
                      },
                      "registrationNumber": {
                        "maxLength": 64,
                        "type": "string"
                      },
                      "lei": {
                        "pattern": "^[A-Za-z0-9]{18}[0-9]{2}$",
                        "type": "string"
                      }
                    }
                  },
                  "edgarMode": {
                    "default": "optional",
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "optional"
                        ]
                      },
                      {
                        "type": "string",
                        "enum": [
                          "mandatory"
                        ]
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "id",
                    "subjectType",
                    "status",
                    "decisionReason",
                    "requested",
                    "edgarMode",
                    "kikeClientId",
                    "createdAt",
                    "updatedAt",
                    "archivedAt",
                    "checks",
                    "auditEvents"
                  ],
                  "properties": {
                    "id": {
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "type": "string"
                    },
                    "subjectType": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "business"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "person"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "pending"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "verified"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "review"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "rejected"
                          ]
                        }
                      ]
                    },
                    "decisionReason": {
                      "type": "string",
                      "nullable": true
                    },
                    "requested": {
                      "additionalProperties": false,
                      "type": "object",
                      "required": [
                        "name"
                      ],
                      "properties": {
                        "name": {
                          "minLength": 1,
                          "maxLength": 200,
                          "type": "string"
                        },
                        "jurisdiction": {
                          "maxLength": 20,
                          "type": "string"
                        },
                        "registrationNumber": {
                          "maxLength": 64,
                          "type": "string"
                        },
                        "lei": {
                          "pattern": "^[A-Za-z0-9]{18}[0-9]{2}$",
                          "type": "string"
                        }
                      }
                    },
                    "edgarMode": {
                      "default": "optional",
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "optional"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "mandatory"
                          ]
                        }
                      ]
                    },
                    "kikeClientId": {
                      "type": "string",
                      "nullable": true
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "archivedAt": {
                      "format": "date-time",
                      "type": "string",
                      "nullable": true
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "provider",
                          "checkKind",
                          "outcome",
                          "confidence",
                          "attempt",
                          "detail",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "checkKind": {
                            "type": "string"
                          },
                          "outcome": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "pass"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "fail"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "review"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "error"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "skipped"
                                ]
                              }
                            ]
                          },
                          "confidence": {
                            "type": "number",
                            "nullable": true
                          },
                          "attempt": {
                            "type": "integer"
                          },
                          "detail": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    },
                    "auditEvents": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "eventType",
                          "actor",
                          "payload",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "eventType": {
                            "type": "string"
                          },
                          "actor": {
                            "type": "string"
                          },
                          "payload": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCases",
        "summary": "List cases, newest first",
        "tags": [
          "cases"
        ],
        "description": "Keyset pagination: pass the previous nextCursor back as `cursor`. An invalid cursor is a 400, not a silent reset to page one.",
        "parameters": [
          {
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 20,
              "type": "integer"
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "maxLength": 512,
              "type": "string"
            },
            "in": "query",
            "name": "cursor",
            "required": false
          },
          {
            "schema": {
              "default": "false",
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "false"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "all"
                  ]
                }
              ]
            },
            "in": "query",
            "name": "archived",
            "required": false
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "created"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "type"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "status"
                  ]
                }
              ]
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "asc"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "desc"
                  ]
                }
              ]
            },
            "in": "query",
            "name": "order",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "subjectType",
                          "status",
                          "decisionReason",
                          "requested",
                          "edgarMode",
                          "kikeClientId",
                          "createdAt",
                          "updatedAt",
                          "archivedAt"
                        ],
                        "properties": {
                          "id": {
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "type": "string"
                          },
                          "subjectType": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "business"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "person"
                                ]
                              }
                            ]
                          },
                          "status": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "pending"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "verified"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "review"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "rejected"
                                ]
                              }
                            ]
                          },
                          "decisionReason": {
                            "type": "string",
                            "nullable": true
                          },
                          "requested": {
                            "additionalProperties": false,
                            "type": "object",
                            "required": [
                              "name"
                            ],
                            "properties": {
                              "name": {
                                "minLength": 1,
                                "maxLength": 200,
                                "type": "string"
                              },
                              "jurisdiction": {
                                "maxLength": 20,
                                "type": "string"
                              },
                              "registrationNumber": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "lei": {
                                "pattern": "^[A-Za-z0-9]{18}[0-9]{2}$",
                                "type": "string"
                              }
                            }
                          },
                          "edgarMode": {
                            "default": "optional",
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "optional"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "mandatory"
                                ]
                              }
                            ]
                          },
                          "kikeClientId": {
                            "type": "string",
                            "nullable": true
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "updatedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "archivedAt": {
                            "format": "date-time",
                            "type": "string",
                            "nullable": true
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases/{id}": {
      "get": {
        "operationId": "getCaseById",
        "summary": "One case with its checks and audit trail",
        "tags": [
          "cases"
        ],
        "description": "checks is the evidence behind the verdict; auditEvents is who or what moved the case, in order.",
        "parameters": [
          {
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "id",
                    "subjectType",
                    "status",
                    "decisionReason",
                    "requested",
                    "edgarMode",
                    "kikeClientId",
                    "createdAt",
                    "updatedAt",
                    "archivedAt",
                    "checks",
                    "auditEvents"
                  ],
                  "properties": {
                    "id": {
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "type": "string"
                    },
                    "subjectType": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "business"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "person"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "pending"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "verified"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "review"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "rejected"
                          ]
                        }
                      ]
                    },
                    "decisionReason": {
                      "type": "string",
                      "nullable": true
                    },
                    "requested": {
                      "additionalProperties": false,
                      "type": "object",
                      "required": [
                        "name"
                      ],
                      "properties": {
                        "name": {
                          "minLength": 1,
                          "maxLength": 200,
                          "type": "string"
                        },
                        "jurisdiction": {
                          "maxLength": 20,
                          "type": "string"
                        },
                        "registrationNumber": {
                          "maxLength": 64,
                          "type": "string"
                        },
                        "lei": {
                          "pattern": "^[A-Za-z0-9]{18}[0-9]{2}$",
                          "type": "string"
                        }
                      }
                    },
                    "edgarMode": {
                      "default": "optional",
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "optional"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "mandatory"
                          ]
                        }
                      ]
                    },
                    "kikeClientId": {
                      "type": "string",
                      "nullable": true
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "archivedAt": {
                      "format": "date-time",
                      "type": "string",
                      "nullable": true
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "provider",
                          "checkKind",
                          "outcome",
                          "confidence",
                          "attempt",
                          "detail",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "checkKind": {
                            "type": "string"
                          },
                          "outcome": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "pass"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "fail"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "review"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "error"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "skipped"
                                ]
                              }
                            ]
                          },
                          "confidence": {
                            "type": "number",
                            "nullable": true
                          },
                          "attempt": {
                            "type": "integer"
                          },
                          "detail": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    },
                    "auditEvents": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "eventType",
                          "actor",
                          "payload",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "eventType": {
                            "type": "string"
                          },
                          "actor": {
                            "type": "string"
                          },
                          "payload": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "archiveCase",
        "summary": "Archive or restore a case",
        "tags": [
          "cases"
        ],
        "description": "Archive hides a case from the default list without touching its verdict, its checks or its audit trail. Archiving a `pending` case is a 409 — the verification is still in flight. Re-sending the current value is a no-op, not an error. `status` is not accepted here: a verdict changes through verify.decide(), or through a human calling /verify or /reject.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "archived"
                ],
                "properties": {
                  "archived": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "id",
                    "subjectType",
                    "status",
                    "decisionReason",
                    "requested",
                    "edgarMode",
                    "kikeClientId",
                    "createdAt",
                    "updatedAt",
                    "archivedAt",
                    "checks",
                    "auditEvents"
                  ],
                  "properties": {
                    "id": {
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "type": "string"
                    },
                    "subjectType": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "business"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "person"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "pending"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "verified"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "review"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "rejected"
                          ]
                        }
                      ]
                    },
                    "decisionReason": {
                      "type": "string",
                      "nullable": true
                    },
                    "requested": {
                      "additionalProperties": false,
                      "type": "object",
                      "required": [
                        "name"
                      ],
                      "properties": {
                        "name": {
                          "minLength": 1,
                          "maxLength": 200,
                          "type": "string"
                        },
                        "jurisdiction": {
                          "maxLength": 20,
                          "type": "string"
                        },
                        "registrationNumber": {
                          "maxLength": 64,
                          "type": "string"
                        },
                        "lei": {
                          "pattern": "^[A-Za-z0-9]{18}[0-9]{2}$",
                          "type": "string"
                        }
                      }
                    },
                    "edgarMode": {
                      "default": "optional",
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "optional"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "mandatory"
                          ]
                        }
                      ]
                    },
                    "kikeClientId": {
                      "type": "string",
                      "nullable": true
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "archivedAt": {
                      "format": "date-time",
                      "type": "string",
                      "nullable": true
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "provider",
                          "checkKind",
                          "outcome",
                          "confidence",
                          "attempt",
                          "detail",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "checkKind": {
                            "type": "string"
                          },
                          "outcome": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "pass"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "fail"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "review"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "error"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "skipped"
                                ]
                              }
                            ]
                          },
                          "confidence": {
                            "type": "number",
                            "nullable": true
                          },
                          "attempt": {
                            "type": "integer"
                          },
                          "detail": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    },
                    "auditEvents": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "eventType",
                          "actor",
                          "payload",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "eventType": {
                            "type": "string"
                          },
                          "actor": {
                            "type": "string"
                          },
                          "payload": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases/{id}/verify": {
      "post": {
        "operationId": "verifyCase",
        "summary": "A human confirms a case the engine stopped at `review`",
        "tags": [
          "cases"
        ],
        "description": "The engine never produces `verified` from `review` and never writes `rejected` — both are human decisions, and this is one of them. A `pending` case is a 409: its checks have not finished. Re-sending the status it already holds is a no-op, not a second decision. `reason` replaces `decision_reason`; the engine’s own wording is kept in the audit payload as `previousReason`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "actor",
                  "reason"
                ],
                "properties": {
                  "actor": {
                    "minLength": 1,
                    "maxLength": 200,
                    "type": "string"
                  },
                  "reason": {
                    "minLength": 1,
                    "maxLength": 1000,
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "id",
                    "subjectType",
                    "status",
                    "decisionReason",
                    "requested",
                    "edgarMode",
                    "kikeClientId",
                    "createdAt",
                    "updatedAt",
                    "archivedAt",
                    "checks",
                    "auditEvents"
                  ],
                  "properties": {
                    "id": {
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "type": "string"
                    },
                    "subjectType": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "business"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "person"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "pending"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "verified"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "review"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "rejected"
                          ]
                        }
                      ]
                    },
                    "decisionReason": {
                      "type": "string",
                      "nullable": true
                    },
                    "requested": {
                      "additionalProperties": false,
                      "type": "object",
                      "required": [
                        "name"
                      ],
                      "properties": {
                        "name": {
                          "minLength": 1,
                          "maxLength": 200,
                          "type": "string"
                        },
                        "jurisdiction": {
                          "maxLength": 20,
                          "type": "string"
                        },
                        "registrationNumber": {
                          "maxLength": 64,
                          "type": "string"
                        },
                        "lei": {
                          "pattern": "^[A-Za-z0-9]{18}[0-9]{2}$",
                          "type": "string"
                        }
                      }
                    },
                    "edgarMode": {
                      "default": "optional",
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "optional"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "mandatory"
                          ]
                        }
                      ]
                    },
                    "kikeClientId": {
                      "type": "string",
                      "nullable": true
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "archivedAt": {
                      "format": "date-time",
                      "type": "string",
                      "nullable": true
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "provider",
                          "checkKind",
                          "outcome",
                          "confidence",
                          "attempt",
                          "detail",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "checkKind": {
                            "type": "string"
                          },
                          "outcome": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "pass"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "fail"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "review"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "error"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "skipped"
                                ]
                              }
                            ]
                          },
                          "confidence": {
                            "type": "number",
                            "nullable": true
                          },
                          "attempt": {
                            "type": "integer"
                          },
                          "detail": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    },
                    "auditEvents": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "eventType",
                          "actor",
                          "payload",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "eventType": {
                            "type": "string"
                          },
                          "actor": {
                            "type": "string"
                          },
                          "payload": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/cases/{id}/reject": {
      "post": {
        "operationId": "rejectCase",
        "summary": "A human rejects a case",
        "tags": [
          "cases"
        ],
        "description": "AGENTS.md #2: no code path writes `rejected`. This is the one that can, because only a person may condemn a company. Same rules as `/verify` otherwise — 409 on `pending`, idempotent when already `rejected`, and `reason` replaces `decision_reason` while the engine’s wording is preserved in the audit payload.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "actor",
                  "reason"
                ],
                "properties": {
                  "actor": {
                    "minLength": 1,
                    "maxLength": 200,
                    "type": "string"
                  },
                  "reason": {
                    "minLength": 1,
                    "maxLength": 1000,
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "id",
                    "subjectType",
                    "status",
                    "decisionReason",
                    "requested",
                    "edgarMode",
                    "kikeClientId",
                    "createdAt",
                    "updatedAt",
                    "archivedAt",
                    "checks",
                    "auditEvents"
                  ],
                  "properties": {
                    "id": {
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "type": "string"
                    },
                    "subjectType": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "business"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "person"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "pending"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "verified"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "review"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "rejected"
                          ]
                        }
                      ]
                    },
                    "decisionReason": {
                      "type": "string",
                      "nullable": true
                    },
                    "requested": {
                      "additionalProperties": false,
                      "type": "object",
                      "required": [
                        "name"
                      ],
                      "properties": {
                        "name": {
                          "minLength": 1,
                          "maxLength": 200,
                          "type": "string"
                        },
                        "jurisdiction": {
                          "maxLength": 20,
                          "type": "string"
                        },
                        "registrationNumber": {
                          "maxLength": 64,
                          "type": "string"
                        },
                        "lei": {
                          "pattern": "^[A-Za-z0-9]{18}[0-9]{2}$",
                          "type": "string"
                        }
                      }
                    },
                    "edgarMode": {
                      "default": "optional",
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "optional"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "mandatory"
                          ]
                        }
                      ]
                    },
                    "kikeClientId": {
                      "type": "string",
                      "nullable": true
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "archivedAt": {
                      "format": "date-time",
                      "type": "string",
                      "nullable": true
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "provider",
                          "checkKind",
                          "outcome",
                          "confidence",
                          "attempt",
                          "detail",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "checkKind": {
                            "type": "string"
                          },
                          "outcome": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "pass"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "fail"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "review"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "error"
                                ]
                              },
                              {
                                "type": "string",
                                "enum": [
                                  "skipped"
                                ]
                              }
                            ]
                          },
                          "confidence": {
                            "type": "number",
                            "nullable": true
                          },
                          "attempt": {
                            "type": "integer"
                          },
                          "detail": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    },
                    "auditEvents": {
                      "type": "array",
                      "items": {
                        "additionalProperties": false,
                        "type": "object",
                        "required": [
                          "id",
                          "eventType",
                          "actor",
                          "payload",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "eventType": {
                            "type": "string"
                          },
                          "actor": {
                            "type": "string"
                          },
                          "payload": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "statusCode",
                    "message"
                  ],
                  "properties": {
                    "statusCode": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "tags": [
    {
      "name": "cases",
      "description": "Verification cases and their evidence"
    },
    {
      "name": "health",
      "description": "Liveness"
    }
  ]
}
