{
  "openapi": "3.0.3",
  "info": {
    "title": "JLJ Treasury — Norma 43 & SEPA ISO 20022 API",
    "version": "1.1.0",
    "description": "Deterministic, zero-retention European B2B treasury & banking automation API by JLJ Lab: AEB Cuaderno 43 (Norma 43) parser & cent-exact balance auditor, SEPA Creditor ID (AT-02) validator/generator, ISO 20022 pain.001 (Cuaderno 34.14) & pain.008 (Cuaderno 19.14 CORE/B2B) XML generators, XXE-hardened camt.053 parser, and deterministic bank-to-invoice reconciliation.",
    "x-logo": {
      "url": "https://treasury-api.specgrid-api.workers.dev/assets/jlj-lab-logo-dark.svg",
      "altText": "JLJ Lab — JLJ Treasury API"
    },
    "x-apisguru-categories": [
      "financial",
      "payment"
    ],
    "contact": {
      "name": "JLJ Lab",
      "url": "https://treasury-api.specgrid-api.workers.dev"
    },
    "license": {
      "name": "MIT SDK / SaaS API (Zero Payload Retention)",
      "url": "https://treasury-api.specgrid-api.workers.dev/terms/"
    }
  },
  "externalDocs": {
    "description": "Official MIT SDKs (TypeScript, Python, PHP 8+), n8n/Make/Postman templates & MCP Server",
    "url": "https://github.com/jlj-lab-s/jlj-treasury-sdk"
  },
  "servers": [
    {
      "url": "https://treasury-api.specgrid-api.workers.dev",
      "description": "JLJ Treasury Production Edge (Cloudflare Workers)"
    }
  ],
  "components": {
    "securitySchemes": {
      "PolarBearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "JLJ Lab Polar.sh license key (`Authorization: Bearer JLJ-...`)."
      },
      "SandboxDemoHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-JLJ-Sandbox",
        "description": "Set to `demo` for rate-limited unauthenticated sandbox evaluation."
      }
    }
  },
  "security": [
    {
      "PolarBearerAuth": []
    },
    {
      "SandboxDemoHeader": []
    }
  ],
  "paths": {
    "/api/v1/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Service health and supported European banking standards",
        "security": [],
        "responses": {
          "200": {
            "description": "Healthy service metadata",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "service": "jlj-treasury-api",
                  "brand": "JLJ Lab",
                  "version": "1.1.0",
                  "zeroRetention": true
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/norma43/parse": {
      "post": {
        "operationId": "parseNorma43",
        "summary": "Parse AEB Cuaderno 43 (Norma 43) statement and audit mathematical balance",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content"
                ],
                "properties": {
                  "content": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "content": "112100041802000513322611012611302000000001000009782JLJ LAB DEMO SL              "
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Parsed Norma 43 accounts, normalized movements, and cent-exact audit"
          }
        }
      }
    },
    "/api/v1/sepa/creditor-id": {
      "post": {
        "operationId": "sepaCreditorId",
        "summary": "Validate or generate SEPA Direct Debit Creditor Identifier (AT-02 / ISO 7064 Mod 97-10)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "validate",
                      "generate"
                    ]
                  },
                  "creditorId": {
                    "type": "string"
                  },
                  "countryCode": {
                    "type": "string"
                  },
                  "nationalId": {
                    "type": "string"
                  },
                  "businessCode": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "mode": "generate",
                "countryCode": "ES",
                "nationalId": "B85905495",
                "businessCode": "000"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation or generation result",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "valid": true,
                  "normalized": "ES85000B85905495",
                  "checkDigits": "85"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sepa/pain001": {
      "post": {
        "operationId": "generatePain001",
        "summary": "Generate ISO 20022 SEPA Credit Transfer XML (pain.001.001.03 / .09 — Cuaderno 34.14)",
        "responses": {
          "200": {
            "description": "Validated ISO 20022 pain.001 XML batch"
          }
        }
      }
    },
    "/api/v1/sepa/pain008": {
      "post": {
        "operationId": "generatePain008",
        "summary": "Generate ISO 20022 SEPA Direct Debit XML (pain.008.001.02 / .08 — Cuaderno 19.14 CORE/B2B)",
        "responses": {
          "200": {
            "description": "Validated ISO 20022 pain.008 XML batch"
          }
        }
      }
    },
    "/api/v1/camt053/parse": {
      "post": {
        "operationId": "parseCamt053",
        "summary": "Parse ISO 20022 camt.053 XML bank statement (XXE-hardened)",
        "responses": {
          "200": {
            "description": "Normalized BankMovement array and statement balances"
          }
        }
      }
    },
    "/api/v1/reconcile": {
      "post": {
        "operationId": "reconcileInvoices",
        "summary": "Deterministic bank movement to open invoice reconciliation matcher",
        "responses": {
          "200": {
            "description": "Matched pairs with confidence scores and unmatched lists"
          }
        }
      }
    }
  }
}