{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/izap-ai/json-schema/izap-ai-whats-app-template-out-schema.json",
  "title": "WhatsAppTemplateOut",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/izap-ai-openapi.json#/components/schemas/WhatsAppTemplateOut",
  "properties": {
    "body_text": {
      "maxLength": 1024,
      "minLength": 1,
      "title": "Body Text",
      "type": "string"
    },
    "business_id": {
      "format": "uuid",
      "title": "Business Id",
      "type": "string"
    },
    "buttons": {
      "items": {
        "$ref": "#/$defs/TemplateButtonOut"
      },
      "title": "Buttons",
      "type": "array"
    },
    "call_permission_request": {
      "default": false,
      "description": "Add Meta's call permission request component (marketing/utility only, no buttons).",
      "title": "Call Permission Request",
      "type": "boolean"
    },
    "category": {
      "$ref": "#/$defs/TemplateCategory",
      "default": "utility"
    },
    "created": {
      "format": "date-time",
      "title": "Created",
      "type": "string"
    },
    "display_name": {
      "anyOf": [
        {
          "maxLength": 512,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Display Name"
    },
    "example_variables": {
      "items": {
        "type": "string"
      },
      "title": "Example Variables",
      "type": "array"
    },
    "footer_text": {
      "anyOf": [
        {
          "maxLength": 60,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Footer Text"
    },
    "header_format": {
      "$ref": "#/$defs/TemplateHeaderFormat",
      "default": "none"
    },
    "header_media_document_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Header Media Document Id"
    },
    "header_text": {
      "anyOf": [
        {
          "maxLength": 60,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Header Text"
    },
    "id": {
      "format": "uuid",
      "title": "Id",
      "type": "string"
    },
    "language": {
      "default": "pt_BR",
      "maxLength": 10,
      "title": "Language",
      "type": "string"
    },
    "last_synced_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Synced At"
    },
    "modified": {
      "format": "date-time",
      "title": "Modified",
      "type": "string"
    },
    "name": {
      "maxLength": 512,
      "minLength": 1,
      "pattern": "^[a-z0-9_]+$",
      "title": "Name",
      "type": "string"
    },
    "provider_template_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Provider Template Id"
    },
    "quality_score": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Quality Score"
    },
    "rejection_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Rejection Reason"
    },
    "status": {
      "$ref": "#/$defs/TemplateStatus"
    },
    "waba_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Waba Id"
    }
  },
  "required": [
    "name",
    "body_text",
    "id",
    "business_id",
    "status",
    "created",
    "modified"
  ],
  "type": "object",
  "$defs": {
    "TemplateButtonOut": {
      "description": "Stored/returned button. Label length is uncapped so synced templates can be listed.",
      "properties": {
        "flow_action": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Flow Action"
        },
        "flow_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Flow Id"
        },
        "navigate_screen": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Navigate Screen"
        },
        "phone_number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Phone Number"
        },
        "text": {
          "default": "",
          "title": "Text",
          "type": "string"
        },
        "type": {
          "description": "QUICK_REPLY | URL | PHONE_NUMBER | VOICE_CALL | FLOW | REQUEST_CONTACT_INFO | ORDER_DETAILS | COPY_CODE | OTP",
          "title": "Type",
          "type": "string"
        },
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Url"
        }
      },
      "required": [
        "type"
      ],
      "title": "TemplateButtonOut",
      "type": "object"
    },
    "TemplateCategory": {
      "description": "WhatsApp/Meta template category. Drives approval rules and pricing.",
      "enum": [
        "marketing",
        "utility",
        "authentication"
      ],
      "title": "TemplateCategory",
      "type": "string"
    },
    "TemplateHeaderFormat": {
      "enum": [
        "none",
        "text",
        "image",
        "video",
        "document"
      ],
      "title": "TemplateHeaderFormat",
      "type": "string"
    },
    "TemplateStatus": {
      "description": "Lifecycle/approval status of a template.\n\nDRAFT is local-only (not yet submitted to Meta). The remaining values mirror\nthe statuses returned by the WhatsApp Cloud API.",
      "enum": [
        "draft",
        "pending",
        "approved",
        "rejected",
        "paused",
        "disabled"
      ],
      "title": "TemplateStatus",
      "type": "string"
    }
  }
}