{
  "swagger": "2.0",
  "info": {
    "title": "Zetaleap Power Toolkit",
    "description": "Essential missing actions for Microsoft Power Automate Cloud Flows: RegEx extraction, CSV-to-JSON, Word .docx XML template merge, QR & Code-128 SVG, ISO IBAN/VAT check, Outlook .ics invite, HMAC-SHA256, Adaptive Cards, Null-safe Schema, and PII masking.",
    "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;IT Operations"
    }
  ],
  "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/pp/regex": {
      "post": {
        "operationId": "RegexMatchExtract",
        "summary": "Match extract or replace text with Regular Expressions",
        "description": "Executes bounded Regular Expression matching, named group extraction, or replacement in Power Automate.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "text",
                "pattern"
              ],
              "properties": {
                "text": {
                  "type": "string",
                  "x-ms-summary": "Source Text"
                },
                "pattern": {
                  "type": "string",
                  "x-ms-summary": "RegEx Pattern"
                },
                "flags": {
                  "type": "string",
                  "default": "gi",
                  "x-ms-summary": "RegEx Flags"
                },
                "mode": {
                  "type": "string",
                  "enum": [
                    "extract",
                    "replace",
                    "split"
                  ],
                  "default": "extract",
                  "x-ms-summary": "Mode"
                },
                "replacement": {
                  "type": "string",
                  "x-ms-summary": "Replacement Text"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Regex evaluation result",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "isMatch": {
                  "type": "boolean",
                  "x-ms-summary": "Is Match"
                },
                "matchCount": {
                  "type": "integer",
                  "x-ms-summary": "Match Count"
                },
                "firstMatch": {
                  "type": "string",
                  "x-ms-summary": "First Match"
                },
                "matches": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "x-ms-summary": "All Matches"
                },
                "replacedText": {
                  "type": "string",
                  "x-ms-summary": "Replaced Text"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/csv-to-json": {
      "post": {
        "operationId": "ParseCsvToJson",
        "summary": "Parse CSV string into typed JSON array",
        "description": "Parses comma, semicolon, tab, or pipe CSV content into structured JSON rows ready for Apply to each.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "csv"
              ],
              "properties": {
                "csv": {
                  "type": "string",
                  "x-ms-summary": "Raw CSV Content"
                },
                "delimiter": {
                  "type": "string",
                  "default": "auto",
                  "x-ms-summary": "Delimiter (auto , ; |)"
                },
                "normalizeHeaders": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "Normalize Headers"
                },
                "autoType": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "Auto Cast Numbers and Booleans"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Parsed CSV rows",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "delimiterUsed": {
                  "type": "string",
                  "x-ms-summary": "Detected Delimiter"
                },
                "rowCount": {
                  "type": "integer",
                  "x-ms-summary": "Row Count"
                },
                "headers": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "x-ms-summary": "Column Headers"
                },
                "rows": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  },
                  "x-ms-summary": "Parsed JSON Rows"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/adaptive-card": {
      "post": {
        "operationId": "BuildTeamsAdaptiveCard",
        "summary": "Build Microsoft Teams Adaptive Card v1.5 JSON",
        "description": "Generates a valid Microsoft Teams Adaptive Card v1.5 JSON payload for approvals, KPIs, and alerts.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "title",
                "summary"
              ],
              "properties": {
                "template": {
                  "type": "string",
                  "enum": [
                    "approval",
                    "kpi",
                    "incident",
                    "copilot"
                  ],
                  "default": "approval",
                  "x-ms-summary": "Card Template"
                },
                "title": {
                  "type": "string",
                  "x-ms-summary": "Card Title"
                },
                "summary": {
                  "type": "string",
                  "x-ms-summary": "Summary Body"
                },
                "metricValue": {
                  "type": "string",
                  "x-ms-summary": "Highlight Metric"
                },
                "metricDelta": {
                  "type": "string",
                  "x-ms-summary": "Metric Delta"
                },
                "primaryActionTitle": {
                  "type": "string",
                  "x-ms-summary": "Action Button Label"
                },
                "primaryActionUrl": {
                  "type": "string",
                  "x-ms-summary": "Action Button URL"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated Adaptive Card payload",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "schemaVersion": {
                  "type": "string",
                  "x-ms-summary": "Adaptive Card Version"
                },
                "cardJsonString": {
                  "type": "string",
                  "x-ms-summary": "Adaptive Card JSON String"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/json-schema": {
      "post": {
        "operationId": "GenerateParseJsonSchema",
        "summary": "Generate null-safe Parse JSON schema from sample payload",
        "description": "Infers a crash-proof nullable JSON schema from any sample payload for Power Automate Parse JSON.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "sample"
              ],
              "properties": {
                "sample": {
                  "type": "object",
                  "x-ms-summary": "Sample JSON Object"
                },
                "nullSafe": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "Allow Null Values"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated Parse JSON schema",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "schemaString": {
                  "type": "string",
                  "x-ms-summary": "Parse JSON Schema String"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/mask-pii": {
      "post": {
        "operationId": "MaskSensitivePii",
        "summary": "Redact emails IBANs cards and phones before AI prompts",
        "description": "Masks sensitive PII tokens in unstructured text prior to Copilot Studio or OpenAI prompts.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "text"
              ],
              "properties": {
                "text": {
                  "type": "string",
                  "x-ms-summary": "Input Text"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Redacted text result",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "maskedText": {
                  "type": "string",
                  "x-ms-summary": "Masked Safe Text"
                },
                "redactionCount": {
                  "type": "integer",
                  "x-ms-summary": "Redaction Count"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/business-days": {
      "post": {
        "operationId": "CalculateBusinessDays",
        "summary": "Calculate SLA business days excluding weekends and holidays",
        "description": "Adds business days or calculates working day difference using regional holiday calendars.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "startDate"
              ],
              "properties": {
                "startDate": {
                  "type": "string",
                  "x-ms-summary": "Start Date (YYYY-MM-DD)"
                },
                "daysToAdd": {
                  "type": "integer",
                  "default": 5,
                  "x-ms-summary": "Business Days to Add"
                },
                "country": {
                  "type": "string",
                  "default": "US",
                  "x-ms-summary": "Holiday Country (US UK EU DE TR)"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SLA calculation response",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "resultDate": {
                  "type": "string",
                  "x-ms-summary": "Target Business Date"
                },
                "businessDays": {
                  "type": "integer",
                  "x-ms-summary": "Business Days"
                },
                "weekendDaysSkipped": {
                  "type": "integer",
                  "x-ms-summary": "Weekends Skipped"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/qr-barcode": {
      "post": {
        "operationId": "GenerateQrOrBarcode",
        "summary": "Generate ISO QR Code or Code-128 Barcode as SVG and Data URI",
        "description": "Generates scannable ISO/IEC 18004 QR Code or Code-128B linear barcode SVG and Base64 Data URI for Power Apps, SharePoint, and Outlook.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "value"
              ],
              "properties": {
                "format": {
                  "type": "string",
                  "enum": [
                    "qr",
                    "code128"
                  ],
                  "default": "qr",
                  "x-ms-summary": "Code Format (qr or code128)"
                },
                "value": {
                  "type": "string",
                  "x-ms-summary": "Encoded Value or URL"
                },
                "label": {
                  "type": "string",
                  "x-ms-summary": "Optional Human-Readable Caption"
                },
                "size": {
                  "type": "integer",
                  "default": 240,
                  "x-ms-summary": "Size in Pixels"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated SVG and Data URI",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "svg": {
                  "type": "string",
                  "x-ms-summary": "Raw SVG Markup"
                },
                "dataUri": {
                  "type": "string",
                  "x-ms-summary": "Power Apps Image Data URI"
                },
                "htmlImgTag": {
                  "type": "string",
                  "x-ms-summary": "Outlook HTML Image Tag"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/iban-vat": {
      "post": {
        "operationId": "ValidateIbanAndVat",
        "summary": "Validate ISO 13616 IBAN checksum and EU UK TR VAT format",
        "description": "Validates international IBAN length and MOD-97 checksum across 70+ countries plus EU, UK, Swiss, and Turkish VAT syntax.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "iban": {
                  "type": "string",
                  "x-ms-summary": "IBAN Account Number"
                },
                "vatNumber": {
                  "type": "string",
                  "x-ms-summary": "EU UK or TR VAT Number"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "IBAN and VAT validation details",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "iban": {
                  "type": "object",
                  "x-ms-summary": "IBAN Validation Result"
                },
                "vat": {
                  "type": "object",
                  "x-ms-summary": "VAT Validation Result"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/ics-calendar": {
      "post": {
        "operationId": "GenerateOutlookIcsInvite",
        "summary": "Generate RFC-5545 Outlook ICS calendar invite attachment",
        "description": "Builds a standard .ics calendar event file and Base64 payload ready for Office 365 Outlook email attachments.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "title",
                "startUtc"
              ],
              "properties": {
                "title": {
                  "type": "string",
                  "x-ms-summary": "Meeting Title"
                },
                "startUtc": {
                  "type": "string",
                  "x-ms-summary": "Start Time ISO UTC"
                },
                "durationMinutes": {
                  "type": "integer",
                  "default": 60,
                  "x-ms-summary": "Duration Minutes"
                },
                "location": {
                  "type": "string",
                  "x-ms-summary": "Location or Teams Link"
                },
                "description": {
                  "type": "string",
                  "x-ms-summary": "Agenda Description"
                },
                "organizerEmail": {
                  "type": "string",
                  "x-ms-summary": "Organizer Email"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated ICS payload",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "fileName": {
                  "type": "string",
                  "x-ms-summary": "Attachment File Name"
                },
                "icsText": {
                  "type": "string",
                  "x-ms-summary": "Raw ICS Content"
                },
                "icsBase64": {
                  "type": "string",
                  "x-ms-summary": "Base64 Content for Outlook"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/hmac": {
      "post": {
        "operationId": "ComputeWebhookHmac",
        "summary": "Sign payload or verify webhook HMAC-SHA256 signature",
        "description": "Computes HMAC-SHA256 or SHA-512 hex and Base64 digests and performs constant-time webhook signature verification.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "payload",
                "secret"
              ],
              "properties": {
                "payload": {
                  "type": "string",
                  "x-ms-summary": "Raw Request Body"
                },
                "secret": {
                  "type": "string",
                  "x-ms-summary": "Webhook Signing Secret"
                },
                "algorithm": {
                  "type": "string",
                  "enum": [
                    "SHA-256",
                    "SHA-512"
                  ],
                  "default": "SHA-256",
                  "x-ms-summary": "Hash Algorithm"
                },
                "providedSignature": {
                  "type": "string",
                  "x-ms-summary": "Incoming Header Signature to Verify"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "HMAC digest and verification result",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "signatureHex": {
                  "type": "string",
                  "x-ms-summary": "Hex Signature"
                },
                "signatureBase64": {
                  "type": "string",
                  "x-ms-summary": "Base64 Signature"
                },
                "verified": {
                  "type": "boolean",
                  "x-ms-summary": "Signature Verified"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/template-merge": {
      "post": {
        "operationId": "MergeDocumentTemplate",
        "summary": "Merge Word docx Base64 or Mustache template with JSON values",
        "description": "Replaces {{Key}} placeholders inside Microsoft Word .docx Base64 files in memory or renders Mustache templates with repeating loops.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "values"
              ],
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "mustache",
                    "docx"
                  ],
                  "default": "mustache",
                  "x-ms-summary": "Merge Mode (mustache or docx)"
                },
                "template": {
                  "type": "string",
                  "x-ms-summary": "Mustache Text or HTML Template"
                },
                "docxBase64": {
                  "type": "string",
                  "x-ms-summary": "Word .docx Base64 Content"
                },
                "values": {
                  "type": "object",
                  "x-ms-summary": "JSON Key-Value Data"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Merged document output",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "replacementsCount": {
                  "type": "integer",
                  "x-ms-summary": "Replacements Count"
                },
                "renderedText": {
                  "type": "string",
                  "x-ms-summary": "Merged Text or HTML"
                },
                "docxBase64": {
                  "type": "string",
                  "x-ms-summary": "Merged Word .docx Base64"
                }
              }
            }
          }
        }
      }
    }
  }
}