{
  "openapi": "3.0.1",
  "info": {
    "title": "WhatsApp Template Validator - Pre-submit Checker",
    "description": "Validate WhatsApp Business templates before submitting to Meta. Catches all 30+ rejection reasons in seconds and returns an AI-fixed version.",
    "version": "0.1",
    "x-build-id": "x0i5X1IVgeU4x9fpi"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fabien1106~whatsapp-template-validator/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fabien1106-whatsapp-template-validator",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/fabien1106~whatsapp-template-validator/runs": {
      "post": {
        "operationId": "runs-sync-fabien1106-whatsapp-template-validator",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/fabien1106~whatsapp-template-validator/run-sync": {
      "post": {
        "operationId": "run-sync-fabien1106-whatsapp-template-validator",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "templates"
        ],
        "properties": {
          "templates": {
            "title": "Templates to validate",
            "type": "array",
            "description": "Array of WhatsApp template objects following Meta's structure",
            "items": {
              "type": "object",
              "required": [
                "name",
                "language",
                "category",
                "components"
              ],
              "properties": {
                "name": {
                  "title": "Template name",
                  "type": "string",
                  "description": "Lowercase, snake_case, max 512 chars",
                  "pattern": "^[a-z0-9_]{1,512}$"
                },
                "language": {
                  "title": "Language",
                  "type": "string",
                  "description": "BCP-47 code (e.g. en_US, fr, pt_BR, ro)"
                },
                "category": {
                  "title": "Category",
                  "type": "string",
                  "description": "Submitted Meta category for the template",
                  "enum": [
                    "MARKETING",
                    "UTILITY",
                    "AUTHENTICATION"
                  ]
                },
                "components": {
                  "title": "Components",
                  "type": "array",
                  "description": "Header / Body / Footer / Buttons blocks",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "title": "Component type",
                        "type": "string",
                        "description": "Block type",
                        "enum": [
                          "HEADER",
                          "BODY",
                          "FOOTER",
                          "BUTTONS"
                        ]
                      },
                      "format": {
                        "title": "Format",
                        "type": "string",
                        "description": "Text or media format (HEADER only)",
                        "enum": [
                          "TEXT",
                          "IMAGE",
                          "VIDEO",
                          "DOCUMENT",
                          "LOCATION"
                        ]
                      },
                      "text": {
                        "title": "Text",
                        "type": "string",
                        "description": "Static body / header / footer text with {{n}} placeholders"
                      },
                      "example": {
                        "title": "Example",
                        "type": "object",
                        "description": "Sample values for each variable, e.g. { body_text: [[\"Marie\", \"#48291\"]] }"
                      },
                      "buttons": {
                        "title": "Buttons",
                        "type": "array",
                        "description": "Quick reply or CTA buttons",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "title": "Button type",
                              "type": "string",
                              "description": "Button kind",
                              "enum": [
                                "QUICK_REPLY",
                                "URL",
                                "PHONE_NUMBER",
                                "COPY_CODE"
                              ]
                            },
                            "text": {
                              "title": "Label",
                              "type": "string",
                              "description": "Visible button label (≤25 chars)"
                            },
                            "url": {
                              "title": "URL",
                              "type": "string",
                              "description": "Destination URL (URL buttons only)"
                            },
                            "phone_number": {
                              "title": "Phone number",
                              "type": "string",
                              "description": "E.164 phone number (PHONE_NUMBER buttons only)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "businessVertical": {
            "title": "Business vertical",
            "enum": [
              "ecommerce",
              "logistics",
              "finance",
              "healthcare",
              "education",
              "travel",
              "food_delivery",
              "real_estate",
              "saas",
              "other"
            ],
            "type": "string",
            "description": "Used for industry-specific checks (restricted industries, common phrasing pitfalls)",
            "default": "other"
          },
          "targetCountries": {
            "title": "Destination markets (ISO-2 codes)",
            "type": "array",
            "description": "Used to flag locale-specific issues (EU GDPR opt-out, India DLT-like rules, LGPD Brazil...)",
            "items": {
              "type": "string"
            }
          },
          "businessDomains": {
            "title": "Verified business domains (whitelist for URL buttons)",
            "type": "array",
            "description": "If provided, button URLs not matching these domains will be flagged",
            "items": {
              "type": "string"
            }
          },
          "allowedThirdPartyBrands": {
            "title": "Allowed third-party brand mentions",
            "type": "array",
            "description": "Brands that may legitimately appear in your templates (e.g. partners). Defaults to empty.",
            "items": {
              "type": "string"
            }
          },
          "autoFix": {
            "title": "Generate AI-fixed version on failure",
            "type": "boolean",
            "description": "If a template fails validation, return a corrected rewrite (charged separately as ai_fix_generation event)",
            "default": true
          },
          "strictMode": {
            "title": "Strict mode",
            "type": "boolean",
            "description": "Treats warnings as errors. Recommended for production submission pipelines.",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}