{
  "openapi": "3.1.0",
  "info": {
    "title": "Djinn Company Verifier",
    "description": "Vérification et suivi conformité des entreprises",
    "version": "0.2.0"
  },
  "paths": {
    "/health": {
      "get": {
        "summary": "Health",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}": {
      "get": {
        "summary": "Get Company V1",
        "description": "Lookup company info from SIRENE.",
        "operationId": "get_company_v1_v1_companies__siren__get",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}/compliance": {
      "get": {
        "summary": "Get Compliance V1",
        "description": "Get compliance status combining SIRENE and BODACC data.",
        "operationId": "get_compliance_v1_v1_companies__siren__compliance_get",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComplianceResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}/alerts": {
      "get": {
        "summary": "Get Alerts V1",
        "description": "Get BODACC alerts for a company, paginated.",
        "operationId": "get_alerts_v1_v1_companies__siren__alerts_get",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "title": "Response Get Alerts V1 V1 Companies  Siren  Alerts Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/track": {
      "post": {
        "summary": "Track Company",
        "description": "Start tracking a company by SIREN for the caller's own tenant.\n\nThe tenant is always the authenticated caller's (`_auth.tenant_id`), never\n`request.tenant_id`: trusting a tenant id supplied in the request body\nwould let any authenticated caller write into another tenant's partition.\nThe body field is accepted for backward compatibility but its value is\nignored — no ownership is inferred from it, so it deliberately never\ncauses a mismatch/403 to distinguish \"no such field\" from \"wrong tenant\".",
        "operationId": "track_company_v1_companies_track_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies": {
      "post": {
        "summary": "Add Company",
        "operationId": "add_company_v1_companies_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyInfo"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyInfo"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/lookup": {
      "post": {
        "summary": "Lookup",
        "operationId": "lookup_v1_companies_lookup_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyLookupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyLookupResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}/documents/compliance": {
      "get": {
        "summary": "Get Document Compliance",
        "operationId": "get_document_compliance_v1_companies__siren__documents_compliance_get",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentComplianceResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}/documents": {
      "post": {
        "summary": "Add Document",
        "operationId": "add_document_v1_companies__siren__documents_post",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComplianceDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComplianceDocument"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Get Documents",
        "operationId": "get_documents_v1_companies__siren__documents_get",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ComplianceDocument"
                  },
                  "title": "Response Get Documents V1 Companies  Siren  Documents Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts": {
      "get": {
        "summary": "Get Alerts",
        "operationId": "get_alerts_v1_alerts_get",
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Alert"
                  },
                  "title": "Response Get Alerts V1 Alerts Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}/bank-accounts": {
      "post": {
        "summary": "Register Bank Account",
        "description": "Control a supplier's bank details: IBAN validity, holder vs SIRENE, change vs history.",
        "operationId": "register_bank_account_v1_companies__siren__bank_accounts_post",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankAccountIn"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccountVerdict"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List Bank Accounts",
        "operationId": "list_bank_accounts_v1_companies__siren__bank_accounts_get",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BankAccount"
                  },
                  "title": "Response List Bank Accounts V1 Companies  Siren  Bank Accounts Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}/bank-accounts/from-document": {
      "post": {
        "summary": "Register Bank Account From Document",
        "description": "Read a RIB (PDF/image) through doc-extract, then run the same bank account control.\n\n`x_api_key` is read again here, raw, on top of `_auth` (ADR-023): doc-\nextract must authenticate as *this call's own caller*, not as\ncompany-verifier, so the caller's own key is forwarded as-is. Guaranteed\npresent by the time this body runs, since `_auth` (`require_api_key`)\nalready rejected any request with no key.\n\nAfter the extraction, the same document goes to doc-trust for an\nauthenticity opinion, again with the caller's own key. The opinion is an\nevaluation, never an authorization: at worst it makes the account\n`to_review` (reason codes `document_authenticity_*`); it never blocks and\nnever turns an unavailable doc-trust into an error (`document_authenticity`\nis then `null`, \"not evaluated\").",
        "operationId": "register_bank_account_from_document_v1_companies__siren__bank_accounts_from_document_post",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_register_bank_account_from_document_v1_companies__siren__bank_accounts_from_document_post"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccountVerdict"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}/sanctions": {
      "get": {
        "summary": "Get Sanctions V1",
        "description": "Screen the company and its published directors against the asset-freeze register.",
        "operationId": "get_sanctions_v1_v1_companies__siren__sanctions_get",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SanctionsScreening"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{siren}/risk": {
      "get": {
        "summary": "Get Risk V1",
        "description": "Combine every control into one risk assessment — a control, never an authorization.\n\n`verdict` reports what the underlying checks found (SIRENE status,\nBODACC alerts, document compliance, bank-account control, sanctions\nscreening); it is not a payment decision and this route never blocks\nanything on the caller's behalf.",
        "operationId": "get_risk_v1_v1_companies__siren__risk_get",
        "parameters": [
          {
            "name": "siren",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Siren"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiskReport"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Alert": {
        "properties": {
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "company_siren": {
            "type": "string",
            "title": "Company Siren"
          },
          "company_name": {
            "type": "string",
            "title": "Company Name"
          },
          "alert_type": {
            "$ref": "#/components/schemas/AlertType"
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "severity": {
            "type": "string",
            "title": "Severity",
            "default": "warning"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "resolved": {
            "type": "boolean",
            "title": "Resolved",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "company_siren",
          "company_name",
          "alert_type",
          "message"
        ],
        "title": "Alert",
        "description": "Alerte de conformité."
      },
      "AlertType": {
        "type": "string",
        "enum": [
          "document_expiring",
          "document_expired",
          "bodacc_event",
          "company_inactive"
        ],
        "title": "AlertType",
        "description": "Types d'alertes."
      },
      "AuthenticitySignal": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code"
          },
          "family": {
            "type": "string",
            "title": "Family"
          },
          "strength": {
            "type": "string",
            "title": "Strength"
          },
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "code",
          "family",
          "strength",
          "message"
        ],
        "title": "AuthenticitySignal"
      },
      "BankAccount": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "company_siren": {
            "type": "string",
            "title": "Company Siren"
          },
          "iban_masked": {
            "type": "string",
            "title": "Iban Masked"
          },
          "iban_hash": {
            "type": "string",
            "title": "Iban Hash"
          },
          "bic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bic"
          },
          "bank_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bank Name"
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Country"
          },
          "holder_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Holder Name"
          },
          "holder_match": {
            "type": "string",
            "enum": [
              "match",
              "mismatch",
              "unknown"
            ],
            "title": "Holder Match",
            "default": "unknown"
          },
          "source": {
            "type": "string",
            "title": "Source",
            "default": "manual"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "ok",
              "to_review",
              "blocking"
            ],
            "title": "Verdict",
            "default": "ok"
          },
          "reasons": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Reasons"
          },
          "is_current": {
            "type": "boolean",
            "title": "Is Current",
            "default": true
          },
          "first_seen": {
            "type": "string",
            "format": "date-time",
            "title": "First Seen"
          },
          "last_seen": {
            "type": "string",
            "format": "date-time",
            "title": "Last Seen"
          }
        },
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "company_siren",
          "iban_masked",
          "iban_hash",
          "first_seen",
          "last_seen"
        ],
        "title": "BankAccount"
      },
      "BankAccountIn": {
        "properties": {
          "iban": {
            "type": "string",
            "maxLength": 42,
            "minLength": 15,
            "title": "Iban"
          },
          "bic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bic"
          },
          "holder_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Holder Name"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "rib_document"
            ],
            "title": "Source",
            "default": "manual"
          }
        },
        "type": "object",
        "required": [
          "iban"
        ],
        "title": "BankAccountIn"
      },
      "BankAccountVerdict": {
        "properties": {
          "account": {
            "$ref": "#/components/schemas/BankAccount"
          },
          "iban_check": {
            "$ref": "#/components/schemas/IbanCheck"
          },
          "changed_from_previous": {
            "type": "boolean",
            "title": "Changed From Previous",
            "default": false
          },
          "previous_iban_masked": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Previous Iban Masked"
          },
          "document_authenticity": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DocumentAuthenticity"
              },
              {
                "type": "null"
              }
            ],
            "description": "Avis d'authenticité du justificatif (doc-trust), seulement pour un RIB lu depuis un document. `null` signifie « non évalué » (doc-trust indisponible ou réponse différente de 200), jamais « aucun signal ». Une évaluation, jamais une autorisation."
          }
        },
        "type": "object",
        "required": [
          "account",
          "iban_check"
        ],
        "title": "BankAccountVerdict"
      },
      "Body_register_bank_account_from_document_v1_companies__siren__bank_accounts_from_document_post": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_register_bank_account_from_document_v1_companies__siren__bank_accounts_from_document_post"
      },
      "Company": {
        "properties": {
          "siren": {
            "type": "string",
            "pattern": "^\\d{9}$",
            "title": "Siren"
          },
          "siret": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{14}$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Siret"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "legal_form": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Legal Form"
          },
          "address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Address"
          },
          "naf_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Naf Code"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "ceased",
              "unknown"
            ],
            "title": "Status",
            "default": "unknown"
          },
          "creation_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Creation Date"
          }
        },
        "type": "object",
        "required": [
          "siren",
          "name"
        ],
        "title": "Company",
        "description": "Modèle entreprise exposé par les routes /v1/."
      },
      "CompanyInfo": {
        "properties": {
          "siren": {
            "type": "string",
            "pattern": "^\\d{9}$",
            "title": "Siren",
            "description": "SIREN (9 digits)"
          },
          "siret": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{14}$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Siret",
            "description": "SIRET (14 digits)"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "legal_form": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Legal Form"
          },
          "naf_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Naf Code",
            "description": "Code APE/NAF"
          },
          "naf_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Naf Label"
          },
          "address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Address"
          },
          "postal_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Postal Code"
          },
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "City"
          },
          "creation_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Creation Date"
          },
          "workforce_bracket": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Workforce Bracket"
          },
          "is_active": {
            "type": "boolean",
            "title": "Is Active",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "siren",
          "name"
        ],
        "title": "CompanyInfo",
        "description": "Informations d'une entreprise (depuis API SIRENE)."
      },
      "CompanyLookupRequest": {
        "properties": {
          "siren": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{9}$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Siren",
            "description": "SIREN (9 digits)"
          },
          "siret": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{14}$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Siret",
            "description": "SIRET (14 digits)"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "Raison sociale (recherche partielle)"
          }
        },
        "type": "object",
        "title": "CompanyLookupRequest",
        "description": "Requête de recherche d'entreprise."
      },
      "CompanyLookupResponse": {
        "properties": {
          "results": {
            "items": {
              "$ref": "#/components/schemas/CompanyInfo"
            },
            "type": "array",
            "title": "Results"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          }
        },
        "type": "object",
        "required": [
          "results",
          "total"
        ],
        "title": "CompanyLookupResponse",
        "description": "Réponse de recherche d'entreprise."
      },
      "ComplianceDocument": {
        "properties": {
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id"
          },
          "company_siren": {
            "type": "string",
            "title": "Company Siren"
          },
          "document_type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "filename": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filename"
          },
          "upload_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Upload Date"
          },
          "issue_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Issue Date"
          },
          "expiry_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expiry Date"
          },
          "status": {
            "$ref": "#/components/schemas/ComplianceStatus",
            "default": "pending"
          },
          "verification_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verification Code",
            "description": "Code de vérification URSSAF (15 chars)"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          }
        },
        "type": "object",
        "required": [
          "company_siren",
          "document_type"
        ],
        "title": "ComplianceDocument",
        "description": "Document de conformité d'une entreprise."
      },
      "ComplianceResponse": {
        "properties": {
          "siren": {
            "type": "string",
            "title": "Siren"
          },
          "company": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Company"
              },
              {
                "type": "null"
              }
            ]
          },
          "compliance_status": {
            "type": "string",
            "enum": [
              "compliant",
              "at_risk",
              "non_compliant",
              "unknown"
            ],
            "title": "Compliance Status"
          },
          "data_freshness": {
            "type": "string",
            "enum": [
              "live",
              "stale",
              "partial",
              "unavailable"
            ],
            "title": "Data Freshness"
          },
          "sources_unavailable": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Sources Unavailable",
            "default": []
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Warnings",
            "default": []
          },
          "alerts_count": {
            "type": "integer",
            "title": "Alerts Count",
            "default": 0
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "title": "Checked At"
          }
        },
        "type": "object",
        "required": [
          "siren",
          "company",
          "compliance_status",
          "data_freshness",
          "checked_at"
        ],
        "title": "ComplianceResponse",
        "description": "Réponse statut conformité (routes /v1/)."
      },
      "ComplianceStatus": {
        "type": "string",
        "enum": [
          "compliant",
          "non_compliant",
          "partial",
          "pending",
          "expired"
        ],
        "title": "ComplianceStatus",
        "description": "Statut de conformité."
      },
      "DocumentAuthenticity": {
        "properties": {
          "verdict": {
            "type": "string",
            "enum": [
              "consistent",
              "suspicious",
              "inconsistent"
            ],
            "title": "Verdict"
          },
          "score": {
            "type": "number",
            "title": "Score"
          },
          "signals": {
            "items": {
              "$ref": "#/components/schemas/AuthenticitySignal"
            },
            "type": "array",
            "title": "Signals"
          },
          "explanation": {
            "type": "string",
            "title": "Explanation"
          },
          "rules_version": {
            "type": "string",
            "title": "Rules Version"
          }
        },
        "type": "object",
        "required": [
          "verdict",
          "score",
          "signals",
          "explanation",
          "rules_version"
        ],
        "title": "DocumentAuthenticity",
        "description": "Avis d'authenticité du justificatif rendu par doc-trust.\n\nUne évaluation, jamais une autorisation : au plus `to_review` côté\ncompany-verifier. `signals[].message` est du texte destiné à un humain ;\nil n'est ni persisté ni écrit dans le journal d'audit."
      },
      "DocumentComplianceResponse": {
        "properties": {
          "siren": {
            "type": "string",
            "title": "Siren"
          },
          "status": {
            "$ref": "#/components/schemas/ComplianceStatus"
          },
          "documents": {
            "items": {
              "$ref": "#/components/schemas/ComplianceDocument"
            },
            "type": "array",
            "title": "Documents"
          },
          "alerts": {
            "items": {
              "$ref": "#/components/schemas/Alert"
            },
            "type": "array",
            "title": "Alerts"
          }
        },
        "type": "object",
        "required": [
          "siren",
          "status",
          "documents",
          "alerts"
        ],
        "title": "DocumentComplianceResponse"
      },
      "DocumentType": {
        "type": "string",
        "enum": [
          "kbis",
          "urssaf",
          "fiscal",
          "rc_pro",
          "foreign_workers",
          "other"
        ],
        "title": "DocumentType",
        "description": "Types de documents de conformité."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "HealthResponse": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "ok"
          },
          "service": {
            "type": "string",
            "title": "Service",
            "default": "company-verifier"
          }
        },
        "type": "object",
        "title": "HealthResponse"
      },
      "IbanCheck": {
        "properties": {
          "valid": {
            "type": "boolean",
            "title": "Valid"
          },
          "iban_masked": {
            "type": "string",
            "title": "Iban Masked"
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Country"
          },
          "bank_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bank Code"
          },
          "bank_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bank Name"
          },
          "bic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bic"
          },
          "errors": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Errors"
          }
        },
        "type": "object",
        "required": [
          "valid",
          "iban_masked"
        ],
        "title": "IbanCheck"
      },
      "RiskReport": {
        "properties": {
          "siren": {
            "type": "string",
            "title": "Siren"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "ok",
              "to_review",
              "blocking",
              "unknown"
            ],
            "title": "Verdict",
            "description": "Résultat de l'évaluation, pas une décision : 'blocking' signale un fait de niveau bloquant relevé par le contrôle (ex. entreprise radiée, sanction), jamais un refus de paiement — ce service n'autorise ni ne bloque rien."
          },
          "reasons": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Reasons"
          },
          "checks": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Checks"
          },
          "company": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Company"
              },
              {
                "type": "null"
              }
            ]
          },
          "bank_account": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BankAccount"
              },
              {
                "type": "null"
              }
            ]
          },
          "sanctions_hits": {
            "type": "integer",
            "title": "Sanctions Hits",
            "default": 0
          },
          "documents_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Documents Status"
          },
          "bodacc_alerts": {
            "type": "integer",
            "title": "Bodacc Alerts",
            "default": 0
          },
          "sources_unavailable": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Sources Unavailable"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "title": "Checked At"
          }
        },
        "type": "object",
        "required": [
          "siren",
          "verdict",
          "checked_at"
        ],
        "title": "RiskReport",
        "description": "Synthèse de risque fournisseur : un contrôle, pas une décision.\n\n`verdict` est le résultat d'une **évaluation** combinant l'identité\nSIRENE, les procédures BODACC, la conformité documentaire, le contrôle du\ncompte bancaire et le criblage sanctions (voir `services/risk.py` pour la\nrègle d'ordre exacte). Ce n'est jamais une autorisation ou une garantie de\npaiement : l'intégrant reste seul décisionnaire de la suite à donner."
      },
      "SanctionEntry": {
        "properties": {
          "registre_id": {
            "type": "integer",
            "title": "Registre Id"
          },
          "nature": {
            "type": "string",
            "enum": [
              "person",
              "entity"
            ],
            "title": "Nature"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "first_names": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "First Names"
          },
          "aliases": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Aliases"
          }
        },
        "type": "object",
        "required": [
          "registre_id",
          "nature",
          "name"
        ],
        "title": "SanctionEntry"
      },
      "SanctionsHit": {
        "properties": {
          "entry": {
            "$ref": "#/components/schemas/SanctionEntry"
          },
          "matched": {
            "type": "string",
            "title": "Matched"
          },
          "matched_alias": {
            "type": "string",
            "title": "Matched Alias"
          },
          "rule": {
            "type": "string",
            "enum": [
              "similarity",
              "token_subset"
            ],
            "title": "Rule"
          },
          "score": {
            "type": "number",
            "title": "Score"
          },
          "subject": {
            "type": "string",
            "enum": [
              "company",
              "director"
            ],
            "title": "Subject"
          }
        },
        "type": "object",
        "required": [
          "entry",
          "matched",
          "matched_alias",
          "rule",
          "score",
          "subject"
        ],
        "title": "SanctionsHit",
        "description": "A single sanctions-register hit surfaced by screening.\n\n`rule` and `matched_alias` exist to make a hit reviewable: R18/R19\n(providers/sanctions.py) deliberately lowered the similarity thresholds\nand added a whole-token-subset rule, trading more false positives for\nfewer false negatives (a false negative here means paying a frozen\nentity). That trade-off shifts the sorting burden onto a human reviewer\n— a hit with, say, a 0.615 score and no indication of which rule fired\nor which registered name/alias it matched against is unworkable to\ntriage, which would cancel the benefit of R19."
      },
      "SanctionsScreening": {
        "properties": {
          "siren": {
            "type": "string",
            "title": "Siren"
          },
          "hits": {
            "items": {
              "$ref": "#/components/schemas/SanctionsHit"
            },
            "type": "array",
            "title": "Hits"
          },
          "list_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "List Date"
          },
          "screened_at": {
            "type": "string",
            "format": "date-time",
            "title": "Screened At"
          },
          "sources_unavailable": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Sources Unavailable"
          }
        },
        "type": "object",
        "required": [
          "siren",
          "hits",
          "screened_at"
        ],
        "title": "SanctionsScreening"
      },
      "TrackRequest": {
        "properties": {
          "siren": {
            "type": "string",
            "pattern": "^\\d{9}$",
            "title": "Siren"
          },
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          }
        },
        "type": "object",
        "required": [
          "siren",
          "tenant_id"
        ],
        "title": "TrackRequest",
        "description": "Requête de suivi d'entreprise."
      },
      "TrackResponse": {
        "properties": {
          "siren": {
            "type": "string",
            "title": "Siren"
          },
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "tracked": {
            "type": "boolean",
            "title": "Tracked",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "siren",
          "tenant_id"
        ],
        "title": "TrackResponse"
      },
      "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"
      }
    }
  }
}
