{
  "openapi": "3.0.3",
  "info": {
    "title": "Regence AI \u2014 FLEXCUBE POC Integration",
    "version": "1.0.0",
    "description": "Read-only Regence facade, not native Oracle endpoint names. Public evaluation uses synthetic fixtures. Bank REST integration requires an approved version-specific profile. No core writes, credit approval, disbursement, live model or account provisioning."
  },
  "servers": [
    {
      "url": "https://regenceai.com/integration-api",
      "description": "Synthetic evaluation service"
    },
    {
      "url": "http://127.0.0.1:8091",
      "description": "Local evaluation only"
    }
  ],
  "security": [
    {
      "BankBearer": []
    }
  ],
  "paths": {
    "/v1/customers/{customerId}/credit-context": {
      "get": {
        "operationId": "get_customer",
        "summary": "Customer credit context",
        "tags": [
          "Credit inquiries"
        ],
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            }
          },
          {
            "name": "X-Bank-Branch",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "001"
          },
          {
            "name": "X-Bank-Entity",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "DEMO"
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped inquiry result. Mock responses contain synthetic data; all data is partial unless bank mapping confirms otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/customer"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Required context missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record or endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Bank operation not mapped",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream error or schema mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Upstream unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{customerId}/accounts": {
      "get": {
        "operationId": "get_accounts",
        "summary": "Customer accounts",
        "tags": [
          "Credit inquiries"
        ],
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            }
          },
          {
            "name": "X-Bank-Branch",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "001"
          },
          {
            "name": "X-Bank-Entity",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "DEMO"
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped inquiry result. Mock responses contain synthetic data; all data is partial unless bank mapping confirms otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/accounts"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Required context missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record or endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Bank operation not mapped",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream error or schema mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Upstream unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{customerId}/loans": {
      "get": {
        "operationId": "get_loans",
        "summary": "Existing customer loans",
        "tags": [
          "Credit inquiries"
        ],
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            }
          },
          {
            "name": "X-Bank-Branch",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "001"
          },
          {
            "name": "X-Bank-Entity",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "DEMO"
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped inquiry result. Mock responses contain synthetic data; all data is partial unless bank mapping confirms otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/loans"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Required context missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record or endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Bank operation not mapped",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream error or schema mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Upstream unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/loans/{loanId}/repayment-schedule": {
      "get": {
        "operationId": "get_schedule",
        "summary": "Loan repayment schedule",
        "tags": [
          "Credit inquiries"
        ],
        "parameters": [
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            }
          },
          {
            "name": "X-Bank-Branch",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "001"
          },
          {
            "name": "X-Bank-Entity",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "DEMO"
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped inquiry result. Mock responses contain synthetic data; all data is partial unless bank mapping confirms otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/schedule"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Required context missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record or endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Bank operation not mapped",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream error or schema mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Upstream unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/loans/{loanId}/security": {
      "get": {
        "operationId": "get_security",
        "summary": "Loan security",
        "tags": [
          "Credit inquiries"
        ],
        "parameters": [
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            }
          },
          {
            "name": "X-Bank-Branch",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "001"
          },
          {
            "name": "X-Bank-Entity",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "DEMO"
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped inquiry result. Mock responses contain synthetic data; all data is partial unless bank mapping confirms otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/security"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Required context missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Scope denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record or endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Bank operation not mapped",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream error or schema mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Upstream unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Service health and adapter mode",
        "security": [],
        "responses": {
          "200": {
            "description": "Service running; does not verify bank upstream availability"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BankBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Scoped POC token issued by administrator. Bank gateway credentials are separate."
      }
    },
    "schemas": {
      "customer": {
        "type": "object",
        "required": [
          "customerId",
          "name",
          "branch",
          "entity"
        ],
        "properties": {
          "customerId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "branch": {
            "type": "string"
          },
          "entity": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "accounts": {
        "type": "object",
        "required": [
          "accountId",
          "customerId",
          "currency",
          "balance"
        ],
        "properties": {
          "accountId": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "balance": {
            "type": "string",
            "pattern": "^-?\\d+(\\.\\d+)?$",
            "description": "Decimal amount, never a JSON floating point number"
          }
        },
        "additionalProperties": true
      },
      "loans": {
        "type": "object",
        "required": [
          "loanId",
          "customerId",
          "currency",
          "principalOutstanding"
        ],
        "properties": {
          "loanId": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "principalOutstanding": {
            "type": "string",
            "pattern": "^-?\\d+(\\.\\d+)?$",
            "description": "Decimal amount, never a JSON floating point number"
          }
        },
        "additionalProperties": true
      },
      "schedule": {
        "type": "object",
        "required": [
          "dueDate",
          "currency",
          "principal",
          "interest"
        ],
        "properties": {
          "dueDate": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "principal": {
            "type": "string",
            "pattern": "^-?\\d+(\\.\\d+)?$",
            "description": "Decimal amount, never a JSON floating point number"
          },
          "interest": {
            "type": "string",
            "pattern": "^-?\\d+(\\.\\d+)?$",
            "description": "Decimal amount, never a JSON floating point number"
          }
        },
        "additionalProperties": true
      },
      "security": {
        "type": "object",
        "required": [
          "securityId",
          "type",
          "currency",
          "value"
        ],
        "properties": {
          "securityId": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "value": {
            "type": "string",
            "pattern": "^-?\\d+(\\.\\d+)?$",
            "description": "Decimal amount, never a JSON floating point number"
          }
        },
        "additionalProperties": true
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "requestId": {
                "type": "string"
              }
            }
          }
        }
      },
      "Meta": {
        "type": "object",
        "required": [
          "requestId",
          "mode",
          "synthetic",
          "retrievedAt",
          "source",
          "branch",
          "entity"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "mock",
              "rest"
            ]
          },
          "synthetic": {
            "type": "boolean"
          },
          "retrievedAt": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "object"
          },
          "branch": {
            "type": "string"
          },
          "entity": {
            "type": "string"
          }
        }
      }
    }
  }
}