{
  "openapi": "3.1.0",
  "info": {
    "title": "Rahunok Free Bank Statement Converter & FOP Ledger API",
    "version": "1.0.0",
    "description": "100% free, stateless API for parsing and converting Ukrainian & EU bank statements across Privat24, monobank, PUMB, Oschadbank, A-Bank, Raiffeisen, Ukrgasbank, Pivdenny, ISO 20022 camt.053, SWIFT MT940 and 1CClientBankExchange. Automatically handles UTF-8 / Windows-1251, excludes own-account transfers and builds a consolidated FOP Income Book.",
    "contact": {
      "name": "Rahunok",
      "url": "https://rahunok.com/instrumenty/konverter-vypysok/",
      "email": "rahunok@rahunok.com"
    }
  },
  "servers": [
    {
      "url": "https://rahunok.com"
    }
  ],
  "paths": {
    "/api/statement": {
      "get": {
        "operationId": "getStatementConverterInfo",
        "summary": "Get supported Ukrainian bank statement formats & API guide, or pass ?sample=demo for a live multi-bank parsed output",
        "parameters": [
          {
            "name": "sample",
            "in": "query",
            "required": false,
            "description": "Pass \"demo\" to inspect live parsed multi-bank results (Privat24 + monobank + PUMB).",
            "schema": {
              "type": "string",
              "enum": [
                "demo"
              ]
            }
          },
          {
            "name": "target_format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "universal_csv",
                "fop_income_book_csv",
                "privat24_csv",
                "monobank_csv",
                "oschad_csv",
                "abank_csv",
                "pumb_csv",
                "raiffeisen_csv",
                "ukrgasbank_csv",
                "pivdenny_csv",
                "camt053_xml",
                "mt940_sta",
                "1c_txt",
                "json"
              ],
              "default": "fop_income_book_csv"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "API guide or parsed demo bank statement JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "convertBankStatementPost",
        "summary": "Parse, classify (FOP Income Book) and convert CSV / XML / JSON / SWIFT MT940 / camt.053 / 1C bank statements",
        "parameters": [
          {
            "name": "output",
            "in": "query",
            "required": false,
            "description": "Return \"json\" metadata + converted text (default) or \"file\" for raw file download.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "file"
              ],
              "default": "json"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file_name": {
                    "type": "string",
                    "example": "privat24-fop.csv"
                  },
                  "content": {
                    "type": "string",
                    "description": "Raw CSV, XML, JSON, SWIFT MT940 or 1CClientBankExchange statement text."
                  },
                  "content_base64": {
                    "type": "string",
                    "description": "Optional Base64-encoded bytes (useful when source file is Windows-1251)."
                  },
                  "target_format": {
                    "type": "string",
                    "enum": [
                      "universal_csv",
                      "fop_income_book_csv",
                      "privat24_csv",
                      "monobank_csv",
                      "oschad_csv",
                      "abank_csv",
                      "pumb_csv",
                      "raiffeisen_csv",
                      "ukrgasbank_csv",
                      "pivdenny_csv",
                      "camt053_xml",
                      "mt940_sta",
                      "1c_txt",
                      "json"
                    ],
                    "default": "fop_income_book_csv"
                  },
                  "encoding": {
                    "type": "string",
                    "enum": [
                      "utf-8",
                      "windows-1251"
                    ],
                    "default": "utf-8"
                  },
                  "exclude_internal": {
                    "type": "boolean",
                    "default": true
                  },
                  "output": {
                    "type": "string",
                    "enum": [
                      "json",
                      "file"
                    ],
                    "default": "json"
                  },
                  "files": {
                    "type": "array",
                    "description": "Optional multi-bank batch array to merge multiple accounts at once.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "file_name": {
                          "type": "string"
                        },
                        "content": {
                          "type": "string"
                        },
                        "content_base64": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Normalized transactions, FOP Income Book totals and converted statement output",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              },
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Validation error when statement content is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}