{
  "openapi": "3.1.0",
  "info": {
    "title": "Profit and Loss Statement Calculator Public Calculator API",
    "version": "1.0.0",
    "description": "Free deterministic Profit & Loss (P&L) income statement calculator returning Gross Profit, EBITDA, Operating Income, Estimated Tax, Net Income, and percentage margins.",
    "contact": {
      "url": "https://profitandlossstatementtemplate.com/"
    }
  },
  "servers": [
    {
      "url": "https://profitandlossstatementtemplate.com"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "get": {
        "operationId": "calculate_pnl_get",
        "summary": "Compute Gross Profit, EBITDA, Net Income, and margins from revenue, COGS, OpEx, and tax rate.",
        "parameters": [
          {
            "name": "revenue",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "default": 60000
            }
          },
          {
            "name": "cogs",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "default": 12000
            }
          },
          {
            "name": "opex",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "default": 28000
            }
          },
          {
            "name": "taxRate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "default": 0.25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deterministic JSON calculation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "calculate_pnl",
        "summary": "Compute Gross Profit, EBITDA, Net Income, and margins from revenue, COGS, OpEx, and tax rate.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "revenue": {
                    "type": "number",
                    "description": "Total revenue for the period in USD"
                  },
                  "cogs": {
                    "type": "number",
                    "description": "Cost of goods sold in USD"
                  },
                  "opex": {
                    "type": "number",
                    "description": "Operating expenses in USD"
                  },
                  "depreciation": {
                    "type": "number",
                    "description": "Depreciation and amortization in USD"
                  },
                  "interest": {
                    "type": "number",
                    "description": "Interest expense in USD"
                  },
                  "taxRate": {
                    "type": "number",
                    "description": "Decimal tax rate between 0 and 1 (e.g. 0.21)"
                  }
                },
                "required": [
                  "revenue"
                ]
              },
              "example": {
                "revenue": 60000,
                "cogs": 12000,
                "opex": 28000,
                "taxRate": 0.25
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic JSON calculation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mcp": {
      "post": {
        "operationId": "calculate_pnl_mcp",
        "summary": "Calculate Profit & Loss Statement stateless MCP JSON-RPC 2.0 endpoint",
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response"
          }
        }
      }
    }
  }
}
