{
  "openapi": "3.1.0",
  "info": {
    "title": "LendlyX Verification API",
    "version": "1.0.0",
    "summary": "Lending Intelligence Infrastructure API",
    "description": "Programmatic access to LendlyX verification intelligence. Every lending decision deserves evidence. Access is granted per integration agreement; contact LendlyX for credentials.",
    "contact": {
      "name": "LendlyX",
      "url": "https://lendlyx.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://lendlyx.com/api/v1",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "url": "https://lendlyx.com/developers",
    "description": "API documentation"
  },
  "security": [{ "bearerAuth": [] }],
  "paths": {
    "/verifications": {
      "post": {
        "operationId": "createVerification",
        "summary": "Submit evidence for verification",
        "description": "Submits borrower evidence (identity, documents, inspection photos) and returns a verification record.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/VerificationRequest" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Verification created",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Verification" }
              }
            }
          },
          "400": { "description": "Invalid request" },
          "401": { "description": "Missing or invalid credentials" }
        }
      }
    },
    "/verifications/{id}": {
      "get": {
        "operationId": "getVerification",
        "summary": "Retrieve a verification result",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Verification record",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Verification" }
              }
            }
          },
          "404": { "description": "Not found" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "VerificationRequest": {
        "type": "object",
        "required": ["loan_reference", "evidence"],
        "properties": {
          "loan_reference": { "type": "string" },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["kind", "url"],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": ["identity", "document", "photo", "budget"]
                },
                "url": { "type": "string", "format": "uri" }
              }
            }
          }
        }
      },
      "Verification": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "loan_reference": { "type": "string" },
          "status": {
            "type": "string",
            "enum": ["pending", "verified", "flagged"]
          },
          "created_at": { "type": "string", "format": "date-time" },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": { "type": "string" },
                "outcome": {
                  "type": "string",
                  "enum": ["pass", "review", "fail"]
                },
                "explanation": { "type": "string" }
              }
            }
          }
        }
      }
    }
  }
}
