{
  "openapi": "3.0.0",
  "info": {
    "title": "Invoice & Quote Generator API",
    "version": "1.0.0",
    "description": "Generate professional invoices and quotes with full calculation engine. Supports 8 invoice templates (standard, freelance, agency, retainer, milestone, proforma, recurring, crypto), 6 quote templates, 14 currencies (including USDC/USDT), line-item discounts, document-level discounts, tax (VAT/GST/Sales/SST), shipping, late fees, and formatted Markdown output. Returns structured JSON plus ready-to-use formatted text. Fully self-contained — no external API required."
  },
  "servers": [
    {
      "url": "https://invoice-quote-generator.vercel.app"
    }
  ],
  "paths": {
    "/": {
      "get": {
        "summary": "List all endpoints",
        "operationId": "listEndpoints",
        "responses": {
          "200": {
            "description": "Endpoint list"
          }
        }
      }
    },
    "/invoice/generate": {
      "post": {
        "summary": "Generate an invoice",
        "operationId": "generateInvoice",
        "description": "Generate a complete invoice with line items, tax, discounts, and formatted output.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items"
                ],
                "properties": {
                  "template": {
                    "type": "string"
                  },
                  "invoice_number": {
                    "type": "string"
                  },
                  "issue_date": {
                    "type": "string"
                  },
                  "payment_terms": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "from": {
                    "type": "object"
                  },
                  "to": {
                    "type": "object"
                  },
                  "items": {
                    "type": "array"
                  },
                  "tax_rate": {
                    "type": "number"
                  },
                  "tax_type": {
                    "type": "string"
                  },
                  "discount_percent": {
                    "type": "number"
                  },
                  "discount_amount": {
                    "type": "number"
                  },
                  "shipping": {
                    "type": "number"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "payment_instructions": {
                    "type": "string"
                  },
                  "bank_details": {
                    "type": "object"
                  },
                  "wallet_address": {
                    "type": "string"
                  },
                  "project_name": {
                    "type": "string"
                  },
                  "late_fee_percent": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated invoice"
          }
        }
      }
    },
    "/quote/generate": {
      "post": {
        "summary": "Generate a quote/proposal",
        "operationId": "generateQuote",
        "description": "Generate a complete quote with line items, validity, scope, deliverables, and formatted output.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items"
                ],
                "properties": {
                  "template": {
                    "type": "string"
                  },
                  "quote_number": {
                    "type": "string"
                  },
                  "issue_date": {
                    "type": "string"
                  },
                  "validity_days": {
                    "type": "integer"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "from": {
                    "type": "object"
                  },
                  "to": {
                    "type": "object"
                  },
                  "items": {
                    "type": "array"
                  },
                  "tax_rate": {
                    "type": "number"
                  },
                  "discount_percent": {
                    "type": "number"
                  },
                  "project_name": {
                    "type": "string"
                  },
                  "scope_of_work": {
                    "type": "string"
                  },
                  "deliverables": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "exclusions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated quote"
          }
        }
      }
    },
    "/calculate": {
      "post": {
        "summary": "Calculate invoice totals from line items",
        "operationId": "calculateTotals",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items"
                ],
                "properties": {
                  "items": {
                    "type": "array"
                  },
                  "tax_rate": {
                    "type": "number"
                  },
                  "tax_type": {
                    "type": "string"
                  },
                  "discount_percent": {
                    "type": "number"
                  },
                  "discount_amount": {
                    "type": "number"
                  },
                  "shipping": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculated totals"
          }
        }
      }
    },
    "/convert": {
      "post": {
        "summary": "Convert an invoice to a quote or vice versa",
        "operationId": "convertDocument",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "document",
                  "to_type"
                ],
                "properties": {
                  "document": {
                    "type": "object"
                  },
                  "to_type": {
                    "type": "string",
                    "enum": [
                      "invoice",
                      "quote"
                    ]
                  },
                  "validity_days": {
                    "type": "integer"
                  },
                  "payment_terms": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Converted document"
          }
        }
      }
    },
    "/number/generate": {
      "post": {
        "summary": "Generate a document number",
        "operationId": "generateNumber",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prefix": {
                    "type": "string"
                  },
                  "seed": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated number"
          }
        }
      }
    },
    "/currencies": {
      "get": {
        "summary": "List supported currencies",
        "operationId": "listCurrencies",
        "responses": {
          "200": {
            "description": "Currency list"
          }
        }
      }
    },
    "/templates": {
      "get": {
        "summary": "List invoice & quote templates",
        "operationId": "listTemplates",
        "responses": {
          "200": {
            "description": "Template list"
          }
        }
      }
    },
    "/payment-terms": {
      "get": {
        "summary": "List payment terms",
        "operationId": "listPaymentTerms",
        "responses": {
          "200": {
            "description": "Payment terms"
          }
        }
      }
    },
    "/openapi": {
      "get": {
        "summary": "OpenAPI specification",
        "operationId": "getOpenApiSpec",
        "responses": {
          "200": {
            "description": "OpenAPI 3.0 JSON"
          }
        }
      }
    }
  }
}