{
  "swagger": "2.0",
  "info": {
    "title": "Zetaleap Office & E-Invoice",
    "description": "14 zero-server Zetaleap Cloud operations replacing Encodian, Plumsail & Cloudmersive: populate corporate Excel (.xlsx) & PowerPoint (.pptx) templates with {{Tag}} & {{#items}} row loops, inspect broken XML tags, read/write raw .xlsx/.docx, parse UBL-TR & PEPPOL E-Invoice XML, pack/unpack .ZIP, parse .eml emails, and collect EN/TR/DE external approvals.",
    "version": "1.0.0",
    "contact": {
      "name": "Zetaleap Support Team",
      "url": "https://zetaleap.com/#contact",
      "email": "support_team@zetaleap.com"
    }
  },
  "x-ms-connector-metadata": [
    {
      "propertyName": "Website",
      "propertyValue": "https://zetaleap.com"
    },
    {
      "propertyName": "Privacy policy",
      "propertyValue": "https://zetaleap.com/privacy"
    },
    {
      "propertyName": "Categories",
      "propertyValue": "Productivity;Finance"
    }
  ],
  "host": "zetaleap.com",
  "basePath": "/",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {
    "api_key": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
      "description": "Enter your Zetaleap Personal Access Token prefixed with Bearer (example: Bearer zl_your_api_token). Generate tokens free at https://zetaleap.com/profile."
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "paths": {
    "/api/automation/office-template": {
      "post": {
        "summary": "Populate Excel (.xlsx) or PowerPoint (.pptx) Template & Inspect Tags",
        "description": "Populates corporate OpenXML .xlsx workbooks ({{Scalar}} + {{#items}}...{{/items}} dynamic row loops with formula preservation) and .pptx slide decks, or inspects broken XML split tags.",
        "operationId": "PopulateOrInspectOfficeTemplate",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "populate_xlsx",
                    "populate_pptx",
                    "inspect"
                  ],
                  "default": "populate_xlsx",
                  "x-ms-summary": "Template Mode"
                },
                "fileBase64": {
                  "type": "string",
                  "x-ms-summary": "Template .xlsx/.pptx/.docx Base64"
                },
                "fileName": {
                  "type": "string",
                  "default": "populated-quote.xlsx",
                  "x-ms-summary": "Output File Name"
                },
                "data": {
                  "type": "object",
                  "x-ms-summary": "Scalar {{Tags}} & Loop Arrays JSON"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Populated outputBase64 + Data URI or Template Tag Doctor diagnostics"
          }
        }
      }
    },
    "/api/automation/xlsx-to-json": {
      "post": {
        "summary": "Read Excel (.xlsx) Without Table to JSON",
        "description": "Extracts rows from any OpenXML .xlsx file into JSON objects without requiring an Excel Table or hitting the 256-row limit.",
        "operationId": "ParseExcelToJson",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "xlsxBase64"
              ],
              "properties": {
                "xlsxBase64": {
                  "type": "string",
                  "x-ms-summary": "Excel .xlsx File Content (Base64)"
                },
                "sheetName": {
                  "type": "string",
                  "x-ms-summary": "Worksheet Name (Optional)"
                },
                "hasHeaderRow": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "First Row Has Headers"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Parsed worksheet JSON rows and headers"
          }
        }
      }
    },
    "/api/automation/json-to-xlsx": {
      "post": {
        "summary": "Generate Styled Excel (.xlsx) from JSON Rows",
        "description": "Builds a genuine OpenXML .xlsx workbook with styled header row and auto-sized columns from a JSON array.",
        "operationId": "BuildExcelFromJson",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "rows"
              ],
              "properties": {
                "fileName": {
                  "type": "string",
                  "default": "export.xlsx",
                  "x-ms-summary": "Output Filename (.xlsx)"
                },
                "sheetName": {
                  "type": "string",
                  "default": "Data",
                  "x-ms-summary": "Worksheet Tab Name"
                },
                "rows": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  },
                  "x-ms-summary": "JSON Rows Array"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Base64 .xlsx workbook and Data URI"
          }
        }
      }
    },
    "/api/automation/einvoice-xml": {
      "post": {
        "summary": "Parse E-Invoice XML (UBL-TR & PEPPOL) to JSON + HTML",
        "description": "Parses Turkish GİB UBL-TR 2.1 and European PEPPOL BIS 3.0 XML invoices into structured JSON and printable HTML.",
        "operationId": "ParseEInvoiceXml",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "xml": {
                  "type": "string",
                  "x-ms-summary": "Raw UBL-TR / PEPPOL XML String"
                },
                "xmlBase64": {
                  "type": "string",
                  "x-ms-summary": "Or Base64 XML Attachment"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Structured invoice JSON and inline HTML preview"
          }
        }
      }
    },
    "/api/automation/zip-archive": {
      "post": {
        "summary": "Pack or Unpack .ZIP Archive in Memory",
        "description": "Compresses multiple files into a .ZIP bundle or extracts .ZIP entries in memory with ZIP-bomb protection.",
        "operationId": "ManageZipArchive",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "pack",
                    "unpack"
                  ],
                  "default": "pack",
                  "x-ms-summary": "Mode (pack / unpack)"
                },
                "archiveName": {
                  "type": "string",
                  "default": "bundle.zip",
                  "x-ms-summary": "Output Archive Name"
                },
                "zipBase64": {
                  "type": "string",
                  "x-ms-summary": "Input .ZIP Base64 (when unpacking)"
                },
                "files": {
                  "type": "array",
                  "x-ms-summary": "Files to Pack",
                  "items": {
                    "type": "object",
                    "properties": {
                      "fileName": {
                        "type": "string"
                      },
                      "text": {
                        "type": "string"
                      },
                      "contentBase64": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Packed .ZIP Base64 or extracted files array"
          }
        }
      }
    },
    "/api/automation/magic-link": {
      "post": {
        "summary": "Create External Approval or Self-Destructing Secret Link",
        "description": "Creates a bot-safe external guest approval link or AES-256-GCM one-time secret link without requiring Microsoft 365 guest licenses.",
        "operationId": "CreateExternalMagicLink",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "approval",
                    "secret"
                  ],
                  "default": "approval"
                },
                "title": {
                  "type": "string",
                  "x-ms-summary": "Portal Heading / Subject"
                },
                "summary": {
                  "type": "string",
                  "x-ms-summary": "Description / Instructions"
                },
                "requesterName": {
                  "type": "string",
                  "x-ms-summary": "Requester Name"
                },
                "secretText": {
                  "type": "string",
                  "x-ms-summary": "One-Time Secret (when mode=secret)"
                },
                "webhookUrl": {
                  "type": "string",
                  "x-ms-summary": "HTTPS Callback URL on Decision"
                },
                "expiresInHours": {
                  "type": "integer",
                  "default": 48
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated /m/:token share URL and polling endpoint"
          }
        }
      }
    },
    "/api/automation/magic-link/{token}": {
      "get": {
        "summary": "Get External Approval or Secret Link Status",
        "description": "Polls the current status (pending, approved, rejected, burned, expired) of a magic link without burning it.",
        "operationId": "GetMagicLinkStatus",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "type": "string",
            "x-ms-summary": "Magic Link Token (ml_...)"
          }
        ],
        "responses": {
          "200": {
            "description": "Current link state and decision metadata"
          }
        }
      }
    },
    "/api/automation/trust-validate": {
      "post": {
        "summary": "Validate Email MX/SPF/DMARC, Burner Mail & VKN/TCKN",
        "description": "Checks live DNS-over-HTTPS MX/SPF/DMARC records, blocks disposable emails, and verifies Turkish VKN/TCKN checksums.",
        "operationId": "ValidateEmailDomainAndTaxId",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "x-ms-summary": "Email Address"
                },
                "domain": {
                  "type": "string",
                  "x-ms-summary": "Domain Name"
                },
                "taxId": {
                  "type": "string",
                  "x-ms-summary": "10-Digit VKN or 11-Digit TCKN"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deliverability score, DNS security, and tax ID checksum result"
          }
        }
      }
    },
    "/api/automation/chart-svg": {
      "post": {
        "summary": "Render Executive Chart Card SVG (Bar, Donut, Gauge)",
        "description": "Generates crisp vector Bar, Donut, or KPI Gauge SVG cards and Outlook HTML <img> tags.",
        "operationId": "RenderExecutiveChartSvg",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "chartType": {
                  "type": "string",
                  "enum": [
                    "bar",
                    "donut",
                    "gauge"
                  ],
                  "default": "bar"
                },
                "theme": {
                  "type": "string",
                  "enum": [
                    "light",
                    "dark"
                  ],
                  "default": "light"
                },
                "title": {
                  "type": "string",
                  "x-ms-summary": "Chart Title"
                },
                "subtitle": {
                  "type": "string",
                  "x-ms-summary": "Chart Subtitle"
                },
                "labels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "x-ms-summary": "Category Labels"
                },
                "values": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  },
                  "x-ms-summary": "Numeric Values"
                },
                "unit": {
                  "type": "string",
                  "x-ms-summary": "Unit ($, %, EUR)"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rendered SVG, Base64 Data URI, and Outlook HTML <img> tag"
          }
        }
      }
    },
    "/api/automation/docx-extract": {
      "post": {
        "summary": "Extract Plain Text, Tables, Headings & Metadata from Word (.docx)",
        "description": "Reads any raw OpenXML Word (.docx) file in memory and extracts paragraphs, headings, structured JSON table rows, and core document properties.",
        "operationId": "ExtractDocxContent",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "docxBase64"
              ],
              "properties": {
                "docxBase64": {
                  "type": "string",
                  "x-ms-summary": "Word (.docx) File Base64"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Extracted fullText, tables[], headings[], and metadata"
          }
        }
      }
    },
    "/api/automation/html-extract": {
      "post": {
        "summary": "Clean Email HTML, Strip Replies/Signatures & Convert Tables to JSON",
        "description": "Strips Outlook/Gmail quoted reply chains and signatures, extracts clean plain text, links, and parses every HTML <table> into typed JSON arrays.",
        "operationId": "CleanHtmlAndExtractTables",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "html"
              ],
              "properties": {
                "html": {
                  "type": "string",
                  "x-ms-summary": "Raw HTML Body"
                },
                "stripQuotedThread": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "Strip Quoted Reply Thread"
                },
                "stripSignature": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "Strip Email Signature"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "latestReplyOnlyText, cleanText, links[], and tables[]"
          }
        }
      }
    },
    "/api/automation/eml-parse": {
      "post": {
        "summary": "Parse Outlook / RFC-5322 (.eml) Email & Extract Attachments",
        "description": "Decodes RFC-2047 UTF-8 headers, Quoted-Printable/Base64 bodies, and recursive multipart MIME attachments into structured JSON.",
        "operationId": "ParseEmlEmail",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "eml": {
                  "type": "string",
                  "x-ms-summary": "Raw RFC-5322 .eml MIME String"
                },
                "emlBase64": {
                  "type": "string",
                  "x-ms-summary": "Or Base64 .eml File Content"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Parsed headers, textBody, htmlBody, and attachments[]"
          }
        }
      }
    },
    "/api/automation/xml-json-query": {
      "post": {
        "summary": "Convert XML <-> JSON & Evaluate Filter/Wildcard Query",
        "description": "Converts arbitrary XML to JSON or JSON to XML and evaluates dot/wildcard/filter queries (e.g. Batch.Order[?status==Approved].Amount) with sum/count/min/max.",
        "operationId": "ConvertAndQueryXmlJson",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "xml_to_json",
                    "json_to_xml",
                    "query_json"
                  ],
                  "default": "xml_to_json"
                },
                "xml": {
                  "type": "string",
                  "x-ms-summary": "XML String (when xml_to_json)"
                },
                "json": {
                  "type": "object",
                  "x-ms-summary": "JSON Object (when json_to_xml or query_json)"
                },
                "rootName": {
                  "type": "string",
                  "default": "Root"
                },
                "query": {
                  "type": "string",
                  "x-ms-summary": "Dot / Filter Query (e.g. Batch.Order[?status==Approved].Amount)"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Converted JSON/XML and queryResult aggregations"
          }
        }
      }
    },
    "/api/automation/text-redline": {
      "post": {
        "summary": "Compare Contract Clauses & Generate Track-Changes Redline HTML",
        "description": "Computes word-level redline diff between original and revised text, returning similarity % and inline <del>/<ins> HTML for Outlook & Teams.",
        "operationId": "CompareTextRedline",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "originalText",
                "revisedText"
              ],
              "properties": {
                "title": {
                  "type": "string",
                  "x-ms-summary": "Document / Clause Title"
                },
                "originalText": {
                  "type": "string",
                  "x-ms-summary": "Original Text (v1)"
                },
                "revisedText": {
                  "type": "string",
                  "x-ms-summary": "Revised Text (v2)"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "similarityPercent, changes[], and inline redlineHtml"
          }
        }
      }
    }
  }
}