{
  "openapi": "3.1.0",
  "info": {
    "title": "FindForsikring Agent API",
    "version": "2.0.0",
    "description": "Lets AI agents request free, non-binding insurance quotes from up to 3 Danish insurers for a user. Flow: getInsuranceTypes -> getInsuranceQuestions per chosen type -> ask the user in Danish -> (optional validateInsuranceRequest) -> show consent text verbatim, get explicit yes to consent AND terms -> submitInsuranceRequest. Never ask for CPR number.",
    "termsOfService": "https://www.findforsikring.dk/betingelser",
    "x-privacy-policy-url": "https://www.findforsikring.dk/privatlivspolitik",
    "contact": {
      "email": "kontakt@findforsikring.dk"
    }
  },
  "servers": [
    {
      "url": "https://jxaxfmkpgzczwxizkmpd.supabase.co/functions/v1"
    }
  ],
  "paths": {
    "/agent-api/types": {
      "get": {
        "operationId": "getInsuranceTypes",
        "summary": "List the insurance types FindForsikring offers",
        "responses": {
          "200": {
            "description": "Insurance types",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/agent-api/questions": {
      "get": {
        "operationId": "getInsuranceQuestions",
        "summary": "Questions to ask the user for one insurance type, plus personal info fields and consent text",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "bil",
                "indbo",
                "hus",
                "fritidshus",
                "ejerskifte",
                "ulykke",
                "rejse",
                "sundhed",
                "dyr",
                "liv",
                "mc",
                "camping",
                "båd",
                "lønsikring",
                "akasse"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Questions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Unknown type"
          }
        }
      }
    },
    "/agent-api/validate": {
      "post": {
        "operationId": "validateInsuranceRequest",
        "summary": "Check a draft without creating anything",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Submit"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ok + issues[]",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/agent-api/submit": {
      "post": {
        "operationId": "submitInsuranceRequest",
        "summary": "Create the quote request. Only after the user explicitly accepted consent and terms.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Submit"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receipt and message_to_user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid fields (issues[])"
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Agent intake temporarily disabled"
          }
        }
      }
    },
    "/agent-api/address": {
      "post": {
        "operationId": "searchAddress",
        "summary": "Danish address suggestions",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "q": {
                    "type": "string"
                  }
                },
                "required": [
                  "q"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Suggestions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Submit": {
        "type": "object",
        "required": [
          "agent_name",
          "consent_confirmed_by_user",
          "terms_accepted",
          "personal_info",
          "insurances"
        ],
        "properties": {
          "agent_name": {
            "type": "string",
            "description": "e.g. ChatGPT, Grok, Claude"
          },
          "consent_confirmed_by_user": {
            "type": "boolean",
            "description": "true only after the user read the consent text and said yes"
          },
          "terms_accepted": {
            "type": "boolean",
            "description": "true only after the user accepted the terms"
          },
          "personal_info": {
            "type": "object",
            "properties": {
              "navn": {
                "type": "string",
                "description": "Full name"
              },
              "telefon": {
                "type": "string",
                "description": "Danish phone, 8 digits"
              },
              "email": {
                "type": "string"
              },
              "alder": {
                "type": "string"
              },
              "adresse": {
                "type": "string",
                "description": "Address incl. 4-digit postal code"
              },
              "erIRKI": {
                "type": "string",
                "enum": [
                  "ja",
                  "nej"
                ]
              }
            }
          },
          "insurances": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "bil",
                    "indbo",
                    "hus",
                    "fritidshus",
                    "ejerskifte",
                    "ulykke",
                    "rejse",
                    "sundhed",
                    "dyr",
                    "liv",
                    "mc",
                    "camping",
                    "båd",
                    "lønsikring",
                    "akasse"
                  ]
                },
                "data": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    }
  }
}