{
  "openapi": "3.1.0",
  "info": {
    "title": "walpio API",
    "version": "1",
    "summary": "Send WhatsApp messages from your own number, follow what happens to them, and manage templates, text rules, consent and callbacks.",
    "description": "Every path starts with /v1 (Meta's versioned send path aside). Authenticate with `Authorization: Bearer wp_live_…` — an API key from the dashboard. Every error is `{ \"error\": { \"code\", \"message\", \"retryable\", …, \"request_id\" } }`: build on `code` and `retryable`, never on `message`. /v1 only grows: ignore fields you do not know. The reference — with every example run against walpio on each change — is walpio.com/docs.",
    "contact": {
      "name": "walpio",
      "email": "hello@walpio.com",
      "url": "https://walpio.com"
    }
  },
  "servers": [
    {
      "url": "https://api.walpio.com"
    }
  ],
  "externalDocs": {
    "description": "The API reference",
    "url": "https://walpio.com/docs"
  },
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Messages"
    },
    {
      "name": "Batches"
    },
    {
      "name": "Media"
    },
    {
      "name": "Numbers"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Text rules"
    },
    {
      "name": "Contacts"
    },
    {
      "name": "Callbacks"
    },
    {
      "name": "Verification"
    },
    {
      "name": "Sandbox"
    },
    {
      "name": "Reference"
    }
  ],
  "paths": {
    "/v1/messages": {
      "post": {
        "operationId": "sendMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Send a message",
        "description": "A text (sent as written inside the customer's 24-hour window, through a text rule's template outside it), an approved template by name, or — inside the window — media, an interactive message, a location, contact cards or a reaction. `Idempotency-Key` makes it safe to retry; `?dry_run=true` answers what it would do and sends nothing. Needs the `messages:send` scope (send messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#send-a-message"
        },
        "x-walpio-scope": "messages:send",
        "parameters": [
          {
            "name": "dry_run",
            "in": "query",
            "description": "true: answer what the send would do, and send, store and count nothing.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessage"
              },
              "example": {
                "to": "+971501234567",
                "type": "template",
                "template": {
                  "name": "order_update",
                  "language": "en",
                  "params": [
                    "#42"
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meta accepted it (`walpio.status`: accepted or held), or this replays an earlier answer. With `?dry_run=true`: what the send would do.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Walpio-Monthly-Limit": {
                "$ref": "#/components/headers/Walpio-Monthly-Limit"
              },
              "Walpio-Monthly-Remaining": {
                "$ref": "#/components/headers/Walpio-Monthly-Remaining"
              },
              "Server-Timing": {
                "$ref": "#/components/headers/Server-Timing"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SendAnswer"
                    },
                    {
                      "$ref": "#/components/schemas/DryRunAnswer"
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Queued for a retry, still on its way to Meta, or its answer was lost — `messages[0].id` is walpio's id.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Walpio-Monthly-Limit": {
                "$ref": "#/components/headers/Walpio-Monthly-Limit"
              },
              "Walpio-Monthly-Remaining": {
                "$ref": "#/components/headers/Walpio-Monthly-Remaining"
              },
              "Server-Timing": {
                "$ref": "#/components/headers/Server-Timing"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listMessages",
        "tags": [
          "Messages"
        ],
        "summary": "List messages",
        "description": "The workspace's messages, sent and received, newest first, a page at a time behind `next_cursor`. 60 pages a minute per workspace. Needs the `messages:read` scope (read messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#list-messages"
        },
        "x-walpio-scope": "messages:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "One or more of sending, queued, accepted, held, unknown, sent, delivered, read, failed, received, separated by commas.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "description": "in (received) or out (sent).",
            "schema": {
              "type": "string",
              "enum": [
                "in",
                "out"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "One of the workspace's numbers (phone_number_id or walpio's id).",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "A customer: a number or a business-scoped user id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client_reference",
            "in": "query",
            "description": "Your biz_opaque_callback_data.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "An ISO 8601 time (2026-09-25T10:00:00Z) or milliseconds since 1970.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "An ISO 8601 time or milliseconds since 1970; after since.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Messages per page: 1–100 (50 when not given).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "The previous page's next_cursor, exactly as it came.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of messages.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageList"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/{phone_number_id}/messages": {
      "post": {
        "operationId": "sendMessageFromNumber",
        "tags": [
          "Messages"
        ],
        "summary": "Send a message on Meta's path (base …/v1)",
        "description": "Meta's Cloud API path with the base https://api.walpio.com/v1: the send, from the number in the path. Everything else is POST /v1/messages. Needs the `messages:send` scope (send messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#moving-from-the-cloud-api"
        },
        "x-walpio-scope": "messages:send",
        "parameters": [
          {
            "name": "phone_number_id",
            "in": "path",
            "required": true,
            "description": "The sending number's phone_number_id (digits).",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "dry_run",
            "in": "query",
            "description": "As for POST /v1/messages.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessage"
              },
              "example": {
                "messaging_product": "whatsapp",
                "recipient_type": "individual",
                "to": "971501234567",
                "type": "text",
                "text": {
                  "body": "Your order #42 is on the way."
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meta accepted it (`walpio.status`: accepted or held), or this replays an earlier answer. With `?dry_run=true`: what the send would do.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Walpio-Monthly-Limit": {
                "$ref": "#/components/headers/Walpio-Monthly-Limit"
              },
              "Walpio-Monthly-Remaining": {
                "$ref": "#/components/headers/Walpio-Monthly-Remaining"
              },
              "Server-Timing": {
                "$ref": "#/components/headers/Server-Timing"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SendAnswer"
                    },
                    {
                      "$ref": "#/components/schemas/DryRunAnswer"
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Queued for a retry, still on its way to Meta, or its answer was lost — `messages[0].id` is walpio's id.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Walpio-Monthly-Limit": {
                "$ref": "#/components/headers/Walpio-Monthly-Limit"
              },
              "Walpio-Monthly-Remaining": {
                "$ref": "#/components/headers/Walpio-Monthly-Remaining"
              },
              "Server-Timing": {
                "$ref": "#/components/headers/Server-Timing"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/{version}/{phone_number_id}/messages": {
      "post": {
        "operationId": "sendMessageOnMetaPath",
        "tags": [
          "Messages"
        ],
        "summary": "Send a message on Meta's versioned path",
        "description": "Meta's Cloud API path with the base https://api.walpio.com and any version (v25.0 …): the send, from the number in the path. Needs the `messages:send` scope (send messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#moving-from-the-cloud-api"
        },
        "x-walpio-scope": "messages:send",
        "parameters": [
          {
            "name": "version",
            "in": "path",
            "required": true,
            "description": "Meta's Graph API version, such as v25.0 (any).",
            "schema": {
              "type": "string",
              "pattern": "^v[0-9]+[.][0-9]+$"
            }
          },
          {
            "name": "phone_number_id",
            "in": "path",
            "required": true,
            "description": "The sending number's phone_number_id (digits).",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "dry_run",
            "in": "query",
            "description": "As for POST /v1/messages.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessage"
              },
              "example": {
                "messaging_product": "whatsapp",
                "recipient_type": "individual",
                "to": "971501234567",
                "type": "text",
                "text": {
                  "body": "Your order #42 is on the way."
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meta accepted it (`walpio.status`: accepted or held), or this replays an earlier answer. With `?dry_run=true`: what the send would do.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Walpio-Monthly-Limit": {
                "$ref": "#/components/headers/Walpio-Monthly-Limit"
              },
              "Walpio-Monthly-Remaining": {
                "$ref": "#/components/headers/Walpio-Monthly-Remaining"
              },
              "Server-Timing": {
                "$ref": "#/components/headers/Server-Timing"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SendAnswer"
                    },
                    {
                      "$ref": "#/components/schemas/DryRunAnswer"
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Queued for a retry, still on its way to Meta, or its answer was lost — `messages[0].id` is walpio's id.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Walpio-Monthly-Limit": {
                "$ref": "#/components/headers/Walpio-Monthly-Limit"
              },
              "Walpio-Monthly-Remaining": {
                "$ref": "#/components/headers/Walpio-Monthly-Remaining"
              },
              "Server-Timing": {
                "$ref": "#/components/headers/Server-Timing"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/messages/batch": {
      "post": {
        "operationId": "createBatch",
        "tags": [
          "Batches"
        ],
        "summary": "Send a batch",
        "description": "One approved template to up to 1,000 customers, each with its own values, key and reference, sent through the queue. `template.language: \"auto\"` sends each item in its customer's own language when the template is approved in it, else in the workspace's default language, else in the template's first approved one. Checked whole: one bad item and nothing is stored. Needs the `messages:send` scope (send messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#send-a-batch"
        },
        "x-walpio-scope": "messages:send",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Batch"
              },
              "example": {
                "template": {
                  "name": "order_update",
                  "language": "en"
                },
                "items": [
                  {
                    "to": "+971501234567",
                    "params": [
                      "#50"
                    ],
                    "biz_opaque_callback_data": "order-50"
                  },
                  {
                    "to": "+971509876543",
                    "params": [
                      "#51"
                    ],
                    "idempotency_key": "order-51-ready"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The same batch again (its Idempotency-Key, or the same request within 10 minutes): its answer, `replayed: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchAnswer"
                }
              }
            }
          },
          "202": {
            "description": "The batch is stored and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/messages/batch/{id}": {
      "get": {
        "operationId": "getBatch",
        "tags": [
          "Batches"
        ],
        "summary": "A batch's progress and results",
        "description": "The batch, and each item's result in the order sent, a page at a time. Counts with the message lists: 60 a minute per workspace. Needs the `messages:read` scope (read messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#send-a-batch"
        },
        "x-walpio-scope": "messages:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The id (walpio's; for a message, walpio's id or Meta's wamid).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only the items in this state.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "sent",
                "failed",
                "skipped"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Items per page: 1–1,000 (100 when not given).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "The previous page's next_cursor, exactly as it came.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The batch and a page of its items.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchResults"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/messages/{id}": {
      "get": {
        "operationId": "getMessage",
        "tags": [
          "Messages"
        ],
        "summary": "A message and its status",
        "description": "Any message of the workspace, by walpio's id or Meta's wamid, with its status timeline. Needs the `messages:read` scope (read messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#message-status"
        },
        "x-walpio-scope": "messages:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The id (walpio's; for a message, walpio's id or Meta's wamid).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/messages/{id}/read": {
      "post": {
        "operationId": "markRead",
        "tags": [
          "Messages"
        ],
        "summary": "Mark a customer's message read (and show \"typing…\")",
        "description": "WhatsApp's read receipt for a message the customer sent (and every earlier one); with typing: true, \"typing…\" until the business answers or 25 seconds pass. Needs the `messages:send` scope (send messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#read-receipts-and-the-typing-indicator"
        },
        "x-walpio-scope": "messages:send",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The id (walpio's; for a message, walpio's id or Meta's wamid).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadReceipt"
              },
              "example": {
                "typing": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meta took it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReadAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/media": {
      "post": {
        "operationId": "uploadMedia",
        "tags": [
          "Media"
        ],
        "summary": "Upload a file",
        "description": "Meta's own multipart form: the file is checked against Meta's types and limits and passed to Meta; walpio keeps nothing. The answer's id is valid 30 days, on that number only. Needs the `messages:send` scope (send messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#upload-a-file"
        },
        "x-walpio-scope": "messages:send",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/MediaUpload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meta's media id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaUploadAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/media/{id}": {
      "get": {
        "operationId": "getMedia",
        "tags": [
          "Media"
        ],
        "summary": "A customer's photo, video, voice message or document",
        "description": "The file a customer sent, by its media id, streamed from Meta (kept 7 days by Meta); walpio keeps nothing. Needs the `messages:read` scope (read messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#fetch-a-customers-media"
        },
        "x-walpio-scope": "messages:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The id (walpio's; for a message, walpio's id or Meta's wamid).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "The number: its phone_number_id or walpio's number id. Without it, the oldest active number.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The file itself, as an attachment.",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/octet-stream"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/numbers": {
      "get": {
        "operationId": "listNumbers",
        "tags": [
          "Numbers"
        ],
        "summary": "The workspace's numbers",
        "description": "Each connected number, its health and what Meta says about it. Needs the `numbers:read` scope (list the numbers).",
        "externalDocs": {
          "url": "https://walpio.com/docs#numbers"
        },
        "x-walpio-scope": "numbers:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The numbers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Numbers"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/templates": {
      "get": {
        "operationId": "listTemplates",
        "tags": [
          "Templates"
        ],
        "summary": "List templates",
        "description": "Every template of every number, sorted by name — or one number's with ?from=. Needs the `templates:read` scope (list templates).",
        "externalDocs": {
          "url": "https://walpio.com/docs#list-templates"
        },
        "x-walpio-scope": "templates:read",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "The number: its phone_number_id or walpio's number id. Without it, the oldest active number.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The templates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Templates"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createTemplate",
        "tags": [
          "Templates"
        ],
        "summary": "Create a template",
        "description": "Checked against Meta's published rules first, then created at Meta and submitted for review; approval arrives as a template.status callback. Needs the `templates:write` scope (create or delete templates).",
        "externalDocs": {
          "url": "https://walpio.com/docs#create-a-template"
        },
        "x-walpio-scope": "templates:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateDraft"
              },
              "example": {
                "name": "delivery_window",
                "language": "en",
                "category": "UTILITY",
                "components": [
                  {
                    "type": "BODY",
                    "text": "Hi {{1}}, your technician arrives between {{2}} today. Reply here to change it.",
                    "example": {
                      "body_text": [
                        [
                          "Aisha",
                          "2 and 4 pm"
                        ]
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created at Meta, normally pending review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateCreated"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/templates/media": {
      "post": {
        "operationId": "uploadTemplateSample",
        "tags": [
          "Templates"
        ],
        "summary": "Upload a media header's sample",
        "description": "For a template whose header is a document, an image or a video: the sample goes to Meta through its Resumable Upload API on the number's app; walpio keeps nothing. Put the answer's handle in the header's example.header_handle when you create the template. At most 10 a minute per workspace. Needs the `templates:write` scope (create or delete templates).",
        "externalDocs": {
          "url": "https://walpio.com/docs#a-media-headers-sample"
        },
        "x-walpio-scope": "templates:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TemplateSampleUpload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meta's handle for the sample, the header it fits, its type and its size.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateSampleAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/templates/{name}": {
      "delete": {
        "operationId": "deleteTemplate",
        "tags": [
          "Templates"
        ],
        "summary": "Delete a template",
        "description": "Every language at Meta, or one with ?language= (once walpio has read it from Meta). A template belongs to the WhatsApp Business Account: it goes for every number of that account. Needs the `templates:write` scope (create or delete templates).",
        "externalDocs": {
          "url": "https://walpio.com/docs#delete-a-template"
        },
        "x-walpio-scope": "templates:write",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "The template's name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "language",
            "in": "query",
            "description": "One language only, e.g. en.",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 16
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "The number: its phone_number_id or walpio's number id. Without it, the oldest active number.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted at Meta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateDeleted"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/text-rules": {
      "get": {
        "operationId": "listTextRules",
        "tags": [
          "Text rules"
        ],
        "summary": "List text rules",
        "description": "Every rule, sorted by name, and what the workspace does with a text no rule matches. Needs the `text-rules:read` scope (list or test text rules).",
        "externalDocs": {
          "url": "https://walpio.com/docs#list-rules"
        },
        "x-walpio-scope": "text-rules:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The rules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TextRules"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createTextRule",
        "tags": [
          "Text rules"
        ],
        "summary": "Create a text rule",
        "description": "A wording you send, with {{placeholders}} for the parts that change, and the approved template to send instead outside the window. Checked against the template before it is saved. Needs the `text-rules:write` scope (create or delete text rules).",
        "externalDocs": {
          "url": "https://walpio.com/docs#create-a-rule"
        },
        "x-walpio-scope": "text-rules:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TextRule"
              },
              "example": {
                "name": "Invoice issued",
                "pattern": "Your invoice {{number}} for AED {{amount}} is due on {{due}}.",
                "templateName": "invoice_issued",
                "templateLanguage": "en",
                "params": [
                  "number",
                  "amount",
                  "due"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The rule as saved, with what to know about it (warnings).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TextRuleAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/text-rules/{id}": {
      "delete": {
        "operationId": "deleteTextRule",
        "tags": [
          "Text rules"
        ],
        "summary": "Delete a text rule",
        "description": "The rule is gone; a text it took is refused (or goes through the fallback) from then on. Needs the `text-rules:write` scope (create or delete text rules).",
        "externalDocs": {
          "url": "https://walpio.com/docs#delete-a-rule"
        },
        "x-walpio-scope": "text-rules:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The id (walpio's; for a message, walpio's id or Meta's wamid).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted rule's id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TextRuleDeleted"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/text-rules/test": {
      "post": {
        "operationId": "testText",
        "tags": [
          "Text rules"
        ],
        "summary": "Test a text against the rules",
        "description": "Which rule a text would use and the values it would send — or the closest rule and where the text departs from it. Sends nothing. Needs the `text-rules:read` scope (list or test text rules).",
        "externalDocs": {
          "url": "https://walpio.com/docs#test-a-text"
        },
        "x-walpio-scope": "text-rules:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TextRuleTest"
              },
              "example": {
                "text": "Your invoice INV-2041 for AED 1,250.00 is due on 30 September."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The match, or the closest rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TextRuleTestAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/contacts/consent": {
      "post": {
        "operationId": "recordConsent",
        "tags": [
          "Contacts"
        ],
        "summary": "Record a customer's opt-in or opt-out",
        "description": "From your own systems, on every number and every identifier the customer is known by. Undoing a STOP the customer texted needs evidence. Needs the `contacts:write` scope (record opt-ins and opt-outs).",
        "externalDocs": {
          "url": "https://walpio.com/docs#record-an-opt-in-or-an-opt-out"
        },
        "x-walpio-scope": "contacts:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Consent"
              },
              "example": {
                "to": "+971501234567",
                "optedIn": true,
                "source": "signup form",
                "evidence": "web form v3, WhatsApp updates box ticked"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/contacts/{to}": {
      "patch": {
        "operationId": "setContactLanguage",
        "tags": [
          "Contacts"
        ],
        "summary": "Set a customer's language",
        "description": "The language `\"language\": \"auto\"` sends their templates in; null forgets it (walpio infers it again from their texts). Needs the `contacts:write` scope (record opt-ins and opt-outs).",
        "externalDocs": {
          "url": "https://walpio.com/docs#a-customers-language"
        },
        "x-walpio-scope": "contacts:write",
        "parameters": [
          {
            "name": "to",
            "in": "path",
            "required": true,
            "description": "The customer: a number in international form, or a business-scoped user id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactLanguage"
              },
              "example": {
                "language": "ar"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactLanguageAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "getContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Read a contact",
        "description": "The customer under every identifier walpio has linked: consent, language, the 24-hour window, the ad they came from. Needs the `contacts:read` scope (read contacts).",
        "externalDocs": {
          "url": "https://walpio.com/docs#read-a-contact"
        },
        "x-walpio-scope": "contacts:read",
        "parameters": [
          {
            "name": "to",
            "in": "path",
            "required": true,
            "description": "The customer: a number in international form, or a business-scoped user id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "getWebhook",
        "tags": [
          "Callbacks"
        ],
        "summary": "The callback URL and its events",
        "description": "Where walpio posts its callbacks, and which events and statuses they carry. The URL and the secret are set in the dashboard. Needs the `webhooks:read` scope (read the callback settings and deliveries).",
        "externalDocs": {
          "url": "https://walpio.com/docs#choosing-the-events"
        },
        "x-walpio-scope": "webhooks:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "The callbacks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/webhooks/events": {
      "put": {
        "operationId": "chooseWebhookEvents",
        "tags": [
          "Callbacks"
        ],
        "summary": "Choose the events",
        "description": "The events the callbacks carry (message.status, message.inbound, template.status, number.health, number.quality), and for message.status the statuses (left out: every status). Needs the `webhooks:write` scope (choose callback events or redeliver callbacks).",
        "externalDocs": {
          "url": "https://walpio.com/docs#choosing-the-events"
        },
        "x-walpio-scope": "webhooks:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallbackEvents"
              },
              "example": {
                "events": [
                  "message.status",
                  "message.inbound"
                ],
                "message_statuses": [
                  "failed"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new setting.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/webhooks/deliveries": {
      "get": {
        "operationId": "listDeliveries",
        "tags": [
          "Callbacks"
        ],
        "summary": "List callback deliveries",
        "description": "Each callback of the last 30 days, newest first, with what walpio sent and what your server answered. 60 pages a minute per workspace. Needs the `webhooks:read` scope (read the callback settings and deliveries).",
        "externalDocs": {
          "url": "https://walpio.com/docs#deliveries-and-redelivery"
        },
        "x-walpio-scope": "webhooks:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Only the deliveries in this state.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "delivered",
                "failed"
              ]
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "An ISO 8601 time, such as 2026-10-01T00:00:00Z.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "An ISO 8601 time.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Deliveries per page: 1–100 (50 when not given).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "The previous page's next_cursor, exactly as it came.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of deliveries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deliveries"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/webhooks/deliveries/{id}/redeliver": {
      "post": {
        "operationId": "redeliver",
        "tags": [
          "Callbacks"
        ],
        "summary": "Send a failed callback again",
        "description": "The same id and body, a new signature, to the callback URL set now. 1,000 a day per workspace. Needs the `webhooks:write` scope (choose callback events or redeliver callbacks).",
        "externalDocs": {
          "url": "https://walpio.com/docs#deliveries-and-redelivery"
        },
        "x-walpio-scope": "webhooks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The id (walpio's; for a message, walpio's id or Meta's wamid).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "responses": {
          "202": {
            "description": "On its way.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Redelivery"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/verify/start": {
      "post": {
        "operationId": "startVerification",
        "tags": [
          "Verification"
        ],
        "summary": "Send a one-time code",
        "description": "A 6-digit code through the number's approved authentication template; walpio keeps only a keyed hash of it. Needs the `verifications:write` scope (send and check one-time verification codes).",
        "externalDocs": {
          "url": "https://walpio.com/docs#verify-a-customer-one-time-codes"
        },
        "x-walpio-scope": "verifications:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyStart"
              },
              "example": {
                "to": "971509876543"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent (or handed to your SMS fallback).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyStartAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/verify/check": {
      "post": {
        "operationId": "checkVerification",
        "tags": [
          "Verification"
        ],
        "summary": "Check a one-time code",
        "description": "The code the customer typed (Arabic-Indic digits, spaces and dashes are fine); 5 wrong codes end it, and so does the customer’s 20th wrong code in 24 hours. Needs the `verifications:write` scope (send and check one-time verification codes).",
        "externalDocs": {
          "url": "https://walpio.com/docs#verify-a-customer-one-time-codes"
        },
        "x-walpio-scope": "verifications:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyCheck"
              },
              "example": {
                "to": "971509876543",
                "code": "123456"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Whether it was right, and the tries left.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyCheckAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/sandbox/inbound": {
      "post": {
        "operationId": "sandboxCustomerReplies",
        "tags": [
          "Sandbox"
        ],
        "summary": "The sandbox's customer replies",
        "description": "A test key only (`wp_test_…`): a text from `from` to the sandbox's simulated number, as a customer's message would arrive — its callback, its contact, and the 24-hour window opened. A live key is refused (403 `sandbox_only`). Needs the `messages:send` scope (send messages).",
        "externalDocs": {
          "url": "https://walpio.com/docs#the-sandbox-test-keys"
        },
        "x-walpio-scope": "messages:send",
        "parameters": [
          {
            "$ref": "#/components/parameters/ErrorFormat"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SandboxInbound"
              },
              "example": {
                "from": "+971501234567",
                "text": "Hi, when does the technician arrive?"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The customer's message, and the window it opened.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxInboundAnswer"
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/openapi.json": {
      "get": {
        "operationId": "getOpenApi",
        "tags": [
          "Reference"
        ],
        "summary": "This description",
        "description": "The client API as OpenAPI 3.1 — no key needed. Also at walpio.com/docs, with a Postman collection made from it. No API key needed.",
        "externalDocs": {
          "url": "https://walpio.com/docs#openapi-and-postman"
        },
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "The OpenAPI 3.1 description.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged since the ETag you sent (If-None-Match)."
          }
        }
      }
    }
  },
  "webhooks": {
    "message.status": {
      "post": {
        "operationId": "callbackMessageStatus",
        "tags": [
          "Callbacks"
        ],
        "summary": "message.status",
        "description": "Meta reported a status of a message you sent, walpio settled one as failed itself, or \"Send a test\". Sent unless you leave it out. walpio POSTs it to your callback URL (dashboard: Settings → Callbacks). Check walpio-signature over the raw body with your whole secret (whsec_…), and de-duplicate by the body's id. Answer any 2xx within 10 seconds; anything else is retried — 8 attempts in all — and then marked failed. A redelivery, and the dashboard's \"Send a test\", are attempted once.",
        "externalDocs": {
          "url": "https://walpio.com/docs#event-catalogue"
        },
        "security": [],
        "parameters": [
          {
            "name": "walpio-event",
            "in": "header",
            "required": true,
            "description": "The event: message.status.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-delivery",
            "in": "header",
            "required": true,
            "description": "The delivery's id — the same as the body's id, on every attempt and redelivery.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature",
            "in": "header",
            "required": true,
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\", keyed with your whole secret>. Reject a t more than 5 minutes old.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature-previous",
            "in": "header",
            "required": false,
            "description": "The same, with the secret you replaced — only for 24 hours after a rotation.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageStatusEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received: walpio does not send this delivery again."
          }
        }
      }
    },
    "message.inbound": {
      "post": {
        "operationId": "callbackMessageInbound",
        "tags": [
          "Callbacks"
        ],
        "summary": "message.inbound",
        "description": "A customer wrote to one of your numbers. Sent unless you leave it out. walpio POSTs it to your callback URL (dashboard: Settings → Callbacks). Check walpio-signature over the raw body with your whole secret (whsec_…), and de-duplicate by the body's id. Answer any 2xx within 10 seconds; anything else is retried — 8 attempts in all — and then marked failed. A redelivery, and the dashboard's \"Send a test\", are attempted once.",
        "externalDocs": {
          "url": "https://walpio.com/docs#event-catalogue"
        },
        "security": [],
        "parameters": [
          {
            "name": "walpio-event",
            "in": "header",
            "required": true,
            "description": "The event: message.inbound.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-delivery",
            "in": "header",
            "required": true,
            "description": "The delivery's id — the same as the body's id, on every attempt and redelivery.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature",
            "in": "header",
            "required": true,
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\", keyed with your whole secret>. Reject a t more than 5 minutes old.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature-previous",
            "in": "header",
            "required": false,
            "description": "The same, with the secret you replaced — only for 24 hours after a rotation.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageInboundEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received: walpio does not send this delivery again."
          }
        }
      }
    },
    "template.status": {
      "post": {
        "operationId": "callbackTemplateStatus",
        "tags": [
          "Callbacks"
        ],
        "summary": "template.status",
        "description": "Meta changed one of your templates' status, quality or category. Sent unless you leave it out. walpio POSTs it to your callback URL (dashboard: Settings → Callbacks). Check walpio-signature over the raw body with your whole secret (whsec_…), and de-duplicate by the body's id. Answer any 2xx within 10 seconds; anything else is retried — 8 attempts in all — and then marked failed. A redelivery, and the dashboard's \"Send a test\", are attempted once.",
        "externalDocs": {
          "url": "https://walpio.com/docs#event-catalogue"
        },
        "security": [],
        "parameters": [
          {
            "name": "walpio-event",
            "in": "header",
            "required": true,
            "description": "The event: template.status.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-delivery",
            "in": "header",
            "required": true,
            "description": "The delivery's id — the same as the body's id, on every attempt and redelivery.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature",
            "in": "header",
            "required": true,
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\", keyed with your whole secret>. Reject a t more than 5 minutes old.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature-previous",
            "in": "header",
            "required": false,
            "description": "The same, with the secret you replaced — only for 24 hours after a rotation.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateStatusEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received: walpio does not send this delivery again."
          }
        }
      }
    },
    "number.health": {
      "post": {
        "operationId": "callbackNumberHealth",
        "tags": [
          "Callbacks"
        ],
        "summary": "number.health",
        "description": "One of your numbers' health changed: whether it can send, Meta's Health Status for it, or a restriction or warning Meta reported (a warning does not stop sending). Sent only if you choose it. walpio POSTs it to your callback URL (dashboard: Settings → Callbacks). Check walpio-signature over the raw body with your whole secret (whsec_…), and de-duplicate by the body's id. Answer any 2xx within 10 seconds; anything else is retried — 8 attempts in all — and then marked failed. A redelivery, and the dashboard's \"Send a test\", are attempted once.",
        "externalDocs": {
          "url": "https://walpio.com/docs#event-catalogue"
        },
        "security": [],
        "parameters": [
          {
            "name": "walpio-event",
            "in": "header",
            "required": true,
            "description": "The event: number.health.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-delivery",
            "in": "header",
            "required": true,
            "description": "The delivery's id — the same as the body's id, on every attempt and redelivery.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature",
            "in": "header",
            "required": true,
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\", keyed with your whole secret>. Reject a t more than 5 minutes old.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature-previous",
            "in": "header",
            "required": false,
            "description": "The same, with the secret you replaced — only for 24 hours after a rotation.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NumberHealthEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received: walpio does not send this delivery again."
          }
        }
      }
    },
    "number.quality": {
      "post": {
        "operationId": "callbackNumberQuality",
        "tags": [
          "Callbacks"
        ],
        "summary": "number.quality",
        "description": "A number's quality rating or messaging limit changed. Sent only if you choose it. walpio POSTs it to your callback URL (dashboard: Settings → Callbacks). Check walpio-signature over the raw body with your whole secret (whsec_…), and de-duplicate by the body's id. Answer any 2xx within 10 seconds; anything else is retried — 8 attempts in all — and then marked failed. A redelivery, and the dashboard's \"Send a test\", are attempted once.",
        "externalDocs": {
          "url": "https://walpio.com/docs#event-catalogue"
        },
        "security": [],
        "parameters": [
          {
            "name": "walpio-event",
            "in": "header",
            "required": true,
            "description": "The event: number.quality.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-delivery",
            "in": "header",
            "required": true,
            "description": "The delivery's id — the same as the body's id, on every attempt and redelivery.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature",
            "in": "header",
            "required": true,
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\", keyed with your whole secret>. Reject a t more than 5 minutes old.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "walpio-signature-previous",
            "in": "header",
            "required": false,
            "description": "The same, with the secret you replaced — only for 24 hours after a rotation.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NumberQualityEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received: walpio does not send this delivery again."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "wp_live_…",
        "description": "An API key from the dashboard (API keys), with the scopes its routes need."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "description": "1–200 characters. The same key again answers the first request's result, and never sends twice.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "ErrorFormat": {
        "name": "Walpio-Error-Format",
        "in": "header",
        "description": "meta: every error in the shape Meta's Graph API answers (walpio's code and retryable stay in error.walpio).",
        "schema": {
          "type": "string",
          "enum": [
            "meta"
          ]
        }
      }
    },
    "headers": {
      "RateLimit-Limit": {
        "description": "The workspace's sends per rolling minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Sends left now, this one counted.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until a slot frees.",
        "schema": {
          "type": "integer"
        }
      },
      "Walpio-Monthly-Limit": {
        "description": "The workspace's monthly allowance, when it has one.",
        "schema": {
          "type": "integer"
        }
      },
      "Walpio-Monthly-Remaining": {
        "description": "What is left of it this month (UTC).",
        "schema": {
          "type": "integer"
        }
      },
      "Server-Timing": {
        "description": "walpio;dur=<ms> for walpio's own work, meta;dur=<ms> for the wait for Meta.",
        "schema": {
          "type": "string"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before repeating the request unchanged.",
        "schema": {
          "type": "integer"
        }
      },
      "X-Request-Id": {
        "description": "The id of this request; quote it when you ask walpio about it.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Refused, or something failed: `code` says what, `retryable` whether repeating it can work.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          },
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "$ref": "#/components/schemas/MetaError"
                }
              ]
            }
          }
        }
      }
    },
    "schemas": {
      "SendMessage": {
        "type": "object",
        "properties": {
          "messaging_product": {
            "type": "string",
            "const": "whatsapp"
          },
          "recipient_type": {
            "type": "string",
            "const": "individual"
          },
          "to": {
            "type": "string",
            "minLength": 5,
            "maxLength": 160
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "template",
              "image",
              "document",
              "video",
              "audio",
              "sticker",
              "interactive",
              "location",
              "contacts",
              "reaction"
            ],
            "default": "text"
          },
          "text": {
            "type": "object",
            "properties": {
              "body": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4096
              },
              "preview_url": {
                "type": "boolean"
              }
            },
            "required": [
              "body"
            ]
          },
          "template": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "language": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 16
                      }
                    },
                    "required": [
                      "code"
                    ]
                  },
                  {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 16
                  }
                ]
              },
              "components": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": {}
                },
                "maxItems": 20
              },
              "params": {
                "description": "The template's values: the body's in order ([\"Ali\", \"WO-42\"] for {{1}} {{2}}), or by name ({ \"name\": \"Ali\" }) — or { body, header, buttons } for a template whose header or buttons take a value.",
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 1024
                    },
                    "maxItems": 50
                  },
                  {
                    "type": "object",
                    "properties": {
                      "body": {
                        "anyOf": [
                          {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 1024
                            },
                            "maxItems": 50
                          },
                          {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 1024
                            }
                          }
                        ]
                      },
                      "header": {
                        "description": "A text header's value as a string, or an object by its type: text, location, or a media header (image, video, document) by id or link.",
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1024
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "text"
                              },
                              "text": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                              },
                              "parameter_name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 512
                              }
                            },
                            "required": [
                              "type",
                              "text"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "latitude": {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d{1,3}(\\.\\d+)?$",
                                    "description": "decimal degrees"
                                  }
                                ]
                              },
                              "longitude": {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d{1,3}(\\.\\d+)?$",
                                    "description": "decimal degrees"
                                  }
                                ]
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1
                              },
                              "address": {
                                "type": "string",
                                "minLength": 1
                              },
                              "type": {
                                "type": "string",
                                "const": "location"
                              }
                            },
                            "required": [
                              "latitude",
                              "longitude",
                              "type"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "image",
                                  "video",
                                  "document"
                                ]
                              },
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              },
                              "filename": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 240
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "buttons": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "index": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string",
                                  "pattern": "^\\d+$",
                                  "description": "a button’s index is a number, from 0"
                                }
                              ]
                            },
                            "sub_type": {
                              "type": "string",
                              "enum": [
                                "url",
                                "copy_code",
                                "quick_reply"
                              ]
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            },
                            "parameter_name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 512
                            }
                          },
                          "required": [
                            "index",
                            "sub_type",
                            "value"
                          ],
                          "additionalProperties": false
                        },
                        "minItems": 1,
                        "maxItems": 10
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 1024
                    }
                  }
                ]
              }
            },
            "required": [
              "name",
              "language"
            ]
          },
          "image": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^\\d{1,32}$",
                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
              },
              "link": {
                "type": "string",
                "maxLength": 2048,
                "description": "a link is an http or https URL"
              },
              "caption": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024
              }
            },
            "additionalProperties": false
          },
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^\\d{1,32}$",
                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
              },
              "link": {
                "type": "string",
                "maxLength": 2048,
                "description": "a link is an http or https URL"
              },
              "caption": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "maxLength": 240
              }
            },
            "additionalProperties": false
          },
          "video": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^\\d{1,32}$",
                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
              },
              "link": {
                "type": "string",
                "maxLength": 2048,
                "description": "a link is an http or https URL"
              },
              "caption": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024
              }
            },
            "additionalProperties": false
          },
          "audio": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^\\d{1,32}$",
                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
              },
              "link": {
                "type": "string",
                "maxLength": 2048,
                "description": "a link is an http or https URL"
              },
              "voice": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          "sticker": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^\\d{1,32}$",
                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
              },
              "link": {
                "type": "string",
                "maxLength": 2048,
                "description": "a link is an http or https URL"
              }
            },
            "additionalProperties": false
          },
          "interactive": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "button"
                  },
                  "header": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          }
                        },
                        "required": [
                          "type",
                          "text"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "image"
                          },
                          "image": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "image"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "video"
                          },
                          "video": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "video"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "document"
                          },
                          "document": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "document"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "body": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1024
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "footer": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "action": {
                    "type": "object",
                    "properties": {
                      "buttons": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "reply"
                            },
                            "reply": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 256
                                },
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 20
                                }
                              },
                              "required": [
                                "id",
                                "title"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "reply"
                          ],
                          "additionalProperties": false
                        },
                        "minItems": 1,
                        "maxItems": 3
                      }
                    },
                    "required": [
                      "buttons"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "body",
                  "action"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "list"
                  },
                  "header": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "body": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4096
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "footer": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "action": {
                    "type": "object",
                    "properties": {
                      "button": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "sections": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 24
                            },
                            "rows": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  },
                                  "title": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 24
                                  },
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 72
                                  }
                                },
                                "required": [
                                  "id",
                                  "title"
                                ],
                                "additionalProperties": false
                              },
                              "minItems": 1
                            }
                          },
                          "required": [
                            "title",
                            "rows"
                          ],
                          "additionalProperties": false
                        },
                        "minItems": 1,
                        "maxItems": 10
                      }
                    },
                    "required": [
                      "button",
                      "sections"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "body",
                  "action"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "cta_url"
                  },
                  "header": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          }
                        },
                        "required": [
                          "type",
                          "text"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "image"
                          },
                          "image": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "image"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "video"
                          },
                          "video": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "video"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "document"
                          },
                          "document": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "document"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "body": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1024
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "footer": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "action": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "const": "cta_url"
                      },
                      "parameters": {
                        "type": "object",
                        "properties": {
                          "display_text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "description": "a link is an http or https URL"
                          }
                        },
                        "required": [
                          "display_text",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "name",
                      "parameters"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "body",
                  "action"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "location_request_message"
                  },
                  "body": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1024
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "action": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "const": "send_location"
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "body",
                  "action"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "flow"
                  },
                  "header": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          }
                        },
                        "required": [
                          "type",
                          "text"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "image"
                          },
                          "image": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "image"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "video"
                          },
                          "video": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "video"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "document"
                          },
                          "document": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^\\d{1,32}$",
                                "description": "a media id is the digits Meta gave (POST /v1/media answers one)"
                              },
                              "link": {
                                "type": "string",
                                "maxLength": 2048,
                                "description": "a link is an http or https URL"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "type",
                          "document"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "body": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "footer": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "action": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "const": "flow"
                      },
                      "parameters": {
                        "type": "object",
                        "properties": {
                          "flow_message_version": {
                            "type": "string",
                            "const": "3"
                          },
                          "flow_token": {
                            "type": "string",
                            "minLength": 1
                          },
                          "flow_id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "flow_name": {
                            "type": "string",
                            "minLength": 1
                          },
                          "flow_cta": {
                            "type": "string",
                            "minLength": 1
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "published"
                            ]
                          },
                          "flow_action": {
                            "type": "string",
                            "enum": [
                              "navigate",
                              "data_exchange"
                            ]
                          },
                          "flow_action_payload": {
                            "type": "object",
                            "properties": {
                              "screen": {
                                "type": "string",
                                "minLength": 1
                              },
                              "data": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "string"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "screen"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "flow_message_version",
                          "flow_cta"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "name",
                      "parameters"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "body",
                  "action"
                ],
                "additionalProperties": false
              }
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "latitude": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "pattern": "^-?\\d{1,3}(\\.\\d+)?$",
                    "description": "decimal degrees"
                  }
                ]
              },
              "longitude": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string",
                    "pattern": "^-?\\d{1,3}(\\.\\d+)?$",
                    "description": "decimal degrees"
                  }
                ]
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "address": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "latitude",
              "longitude"
            ],
            "additionalProperties": false
          },
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "object",
                  "properties": {
                    "formatted_name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "first_name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "last_name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "middle_name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "suffix": {
                      "type": "string",
                      "minLength": 1
                    },
                    "prefix": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "formatted_name"
                  ],
                  "additionalProperties": false
                },
                "addresses": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "street": {
                        "type": "string",
                        "minLength": 1
                      },
                      "city": {
                        "type": "string",
                        "minLength": 1
                      },
                      "state": {
                        "type": "string",
                        "minLength": 1
                      },
                      "zip": {
                        "type": "string",
                        "minLength": 1
                      },
                      "country": {
                        "type": "string",
                        "minLength": 1
                      },
                      "country_code": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "additionalProperties": false
                  },
                  "minItems": 1
                },
                "birthday": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "description": "YYYY-MM-DD"
                },
                "emails": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "email": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "email"
                    ],
                    "additionalProperties": false
                  },
                  "minItems": 1
                },
                "org": {
                  "type": "object",
                  "properties": {
                    "company": {
                      "type": "string",
                      "minLength": 1
                    },
                    "department": {
                      "type": "string",
                      "minLength": 1
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "additionalProperties": false
                },
                "phones": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "phone": {
                        "type": "string",
                        "minLength": 1
                      },
                      "wa_id": {
                        "type": "string",
                        "pattern": "^\\d{5,15}$",
                        "description": "the contact's WhatsApp id: digits"
                      },
                      "type": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "phone"
                    ],
                    "additionalProperties": false
                  },
                  "minItems": 1
                },
                "urls": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "additionalProperties": false
                  },
                  "minItems": 1
                }
              },
              "required": [
                "name"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 257
          },
          "reaction": {
            "type": "object",
            "properties": {
              "message_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "emoji": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              }
            },
            "required": [
              "message_id",
              "emoji"
            ],
            "additionalProperties": false
          },
          "from": {
            "type": "string",
            "maxLength": 64
          },
          "biz_opaque_callback_data": {
            "type": "string",
            "maxLength": 512
          },
          "context": {
            "type": "object",
            "properties": {
              "message_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "required": [
              "message_id"
            ]
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2592000
          }
        },
        "required": [
          "to"
        ],
        "additionalProperties": true
      },
      "Batch": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "maxLength": 64
          },
          "template": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "language": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 16
                      }
                    },
                    "required": [
                      "code"
                    ]
                  },
                  {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 16
                  }
                ]
              }
            },
            "required": [
              "name",
              "language"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "to": {
                  "type": "string",
                  "minLength": 5,
                  "maxLength": 160
                },
                "params": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "maxLength": 1024
                      },
                      "maxItems": 50
                    },
                    {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string",
                        "maxLength": 1024
                      }
                    }
                  ]
                },
                "components": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "maxItems": 20
                },
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "biz_opaque_callback_data": {
                  "type": "string",
                  "maxLength": 512
                }
              },
              "required": [
                "to"
              ]
            },
            "minItems": 1,
            "maxItems": 1000
          }
        },
        "required": [
          "template",
          "items"
        ]
      },
      "ReadReceipt": {
        "type": "object",
        "properties": {
          "typing": {
            "type": "boolean"
          }
        }
      },
      "TemplateDraft": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "maxLength": 64
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "language": {
            "type": "string",
            "minLength": 2,
            "maxLength": 16
          },
          "category": {
            "type": "string",
            "enum": [
              "UTILITY",
              "MARKETING",
              "AUTHENTICATION"
            ]
          },
          "parameter_format": {
            "type": "string",
            "enum": [
              "POSITIONAL",
              "NAMED"
            ]
          },
          "components": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            },
            "minItems": 1,
            "maxItems": 10
          },
          "library_template_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "library_template_button_inputs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "URL",
                    "PHONE_NUMBER"
                  ]
                },
                "url": {
                  "type": "object",
                  "properties": {
                    "base_url": {
                      "type": "string",
                      "format": "uri",
                      "maxLength": 2000
                    },
                    "url_suffix_example": {
                      "type": "string",
                      "maxLength": 2000
                    }
                  },
                  "required": [
                    "base_url"
                  ],
                  "additionalProperties": false
                },
                "phone_number": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 20
                }
              },
              "required": [
                "type"
              ],
              "additionalProperties": false
            },
            "maxItems": 10
          },
          "message_send_ttl_seconds": {
            "type": "integer",
            "minimum": -1,
            "maximum": 2592000
          }
        },
        "required": [
          "name",
          "language",
          "category"
        ]
      },
      "TextRule": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "pattern": {
            "type": "string",
            "minLength": 3,
            "maxLength": 2000
          },
          "templateName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "templateLanguage": {
            "type": "string",
            "minLength": 2,
            "maxLength": 16
          },
          "params": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "maxItems": 20
              },
              {
                "type": "object",
                "additionalProperties": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                }
              }
            ]
          },
          "header": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "placeholder": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "placeholder"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "image",
                          "video",
                          "document"
                        ]
                      },
                      "placeholder": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "filename": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    },
                    "required": [
                      "type",
                      "placeholder"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "image",
                          "video",
                          "document"
                        ]
                      },
                      "link": {
                        "type": "string",
                        "maxLength": 2048,
                        "description": "a link is an http or https URL"
                      },
                      "id": {
                        "type": "string",
                        "pattern": "^\\d{1,32}$",
                        "description": "a media id is the digits Meta gave"
                      },
                      "filename": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 240
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "latitude": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "pattern": "^-?\\d{1,3}(\\.\\d+)?$",
                            "description": "decimal degrees"
                          }
                        ]
                      },
                      "longitude": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string",
                            "pattern": "^-?\\d{1,3}(\\.\\d+)?$",
                            "description": "decimal degrees"
                          }
                        ]
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "address": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "const": "location"
                      }
                    },
                    "required": [
                      "latitude",
                      "longitude",
                      "type"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "buttons": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9
                },
                "sub_type": {
                  "type": "string",
                  "enum": [
                    "url",
                    "copy_code"
                  ]
                },
                "placeholder": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                }
              },
              "required": [
                "index",
                "sub_type",
                "placeholder"
              ],
              "additionalProperties": false
            },
            "maxItems": 10
          },
          "pairedWith": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 64
          },
          "waAccountId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "pattern",
          "templateName",
          "templateLanguage",
          "params"
        ]
      },
      "TextRuleTest": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "waAccountId": {
            "type": "string",
            "maxLength": 64
          }
        },
        "required": [
          "text"
        ]
      },
      "Consent": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "minLength": 5,
            "maxLength": 160
          },
          "optedIn": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120
          },
          "evidence": {
            "type": "string",
            "maxLength": 300
          },
          "from": {
            "type": "string",
            "maxLength": 64
          }
        },
        "required": [
          "to",
          "optedIn",
          "source"
        ]
      },
      "ContactLanguage": {
        "type": "object",
        "properties": {
          "language": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 16,
            "pattern": "^[a-z]{2,3}(_[A-Za-z]{2,4})?$",
            "description": "a language code such as ar, en or en_US"
          },
          "from": {
            "type": "string",
            "maxLength": 64
          }
        },
        "required": [
          "language"
        ],
        "additionalProperties": false
      },
      "CallbackEvents": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "message.status",
                "message.inbound",
                "template.status",
                "number.health",
                "number.quality"
              ]
            },
            "minItems": 1,
            "maxItems": 20
          },
          "message_statuses": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "sent",
                "delivered",
                "read",
                "failed"
              ]
            },
            "minItems": 1,
            "maxItems": 8
          }
        },
        "required": [
          "events"
        ],
        "additionalProperties": false
      },
      "VerifyStart": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "minLength": 5,
            "maxLength": 160
          },
          "template": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "language": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 16
                      },
                      {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 16
                          }
                        },
                        "required": [
                          "code"
                        ]
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            ]
          },
          "from": {
            "type": "string",
            "maxLength": 64
          },
          "expires_in": {
            "type": "integer",
            "minimum": 60,
            "maximum": 900
          },
          "sms_fallback_url": {
            "type": "string",
            "minLength": 8,
            "maxLength": 2000
          }
        },
        "required": [
          "to"
        ]
      },
      "VerifyCheck": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "minLength": 5,
            "maxLength": 160
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          }
        },
        "required": [
          "to",
          "code"
        ]
      },
      "SandboxInbound": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 5,
            "maxLength": 40
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "name": {
            "type": "string",
            "maxLength": 80
          }
        },
        "required": [
          "from",
          "text"
        ]
      },
      "SendAnswer": {
        "type": "object",
        "properties": {
          "messaging_product": {
            "type": "string",
            "const": "whatsapp"
          },
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "input": {
                  "type": "string"
                },
                "wa_id": {
                  "type": "string"
                },
                "user_id": {
                  "type": "string"
                }
              }
            }
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                }
              },
              "required": [
                "id"
              ]
            }
          },
          "walpio": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "via": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "sending",
                  "queued",
                  "accepted",
                  "held",
                  "unknown",
                  "sent",
                  "delivered",
                  "read",
                  "failed",
                  "received"
                ]
              },
              "template": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "language": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "language"
                ]
              },
              "deduplicated": {
                "type": "boolean",
                "const": true
              },
              "transformations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "rule": {
                "type": "string"
              },
              "category": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "free_entry_point_until": {
                "type": "string",
                "format": "date-time"
              },
              "endpoint": {
                "type": "string",
                "const": "marketing_messages"
              },
              "test": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "id",
              "via",
              "status"
            ]
          }
        },
        "required": [
          "messaging_product",
          "messages",
          "walpio"
        ]
      },
      "DryRunAnswer": {
        "type": "object",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "const": true
          },
          "would": {
            "type": "string",
            "enum": [
              "send",
              "replay",
              "refuse"
            ]
          },
          "via": {
            "type": [
              "string",
              "null"
            ]
          },
          "route": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "to": {
            "type": [
              "string",
              "null"
            ]
          },
          "window": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "open": {
                "type": "boolean"
              },
              "plain_text_until": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            },
            "required": [
              "open",
              "plain_text_until"
            ]
          },
          "rule": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "template": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "language": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "language",
              "category",
              "status"
            ]
          },
          "params": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "transformations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "payload": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {}
          },
          "retry_of": {
            "type": [
              "string",
              "null"
            ]
          },
          "replay": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "message_id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "message_id",
              "status"
            ]
          },
          "refusal": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "http_status": {
                "type": "integer"
              }
            },
            "required": [
              "code",
              "message",
              "retryable",
              "http_status"
            ]
          }
        },
        "required": [
          "dry_run",
          "would",
          "via",
          "route",
          "from",
          "to",
          "window",
          "rule",
          "template",
          "params",
          "transformations",
          "payload",
          "retry_of",
          "replay",
          "refusal"
        ]
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "wa_message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "in",
              "out"
            ]
          },
          "to": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string"
          },
          "template": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "language": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "language"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "sending",
              "queued",
              "accepted",
              "held",
              "unknown",
              "sent",
              "delivered",
              "read",
              "failed",
              "received"
            ]
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          },
          "pricing": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "category": {
                "type": "string"
              },
              "billable": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "type": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "category",
              "billable",
              "type"
            ]
          },
          "client_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "inbound": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {}
          },
          "endpoint": {
            "type": "string",
            "const": "marketing_messages"
          },
          "direct_send": {
            "type": "boolean",
            "const": true
          },
          "text": {
            "type": "string"
          },
          "text_kept_until": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "detail": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "status",
                "detail",
                "at"
              ]
            }
          }
        },
        "required": [
          "id",
          "wa_message_id",
          "direction",
          "type",
          "template",
          "status",
          "error",
          "pricing",
          "client_reference",
          "inbound",
          "created_at",
          "updated_at",
          "events"
        ]
      },
      "MessageAnswer": {
        "type": "object",
        "properties": {
          "message": {
            "$ref": "#/components/schemas/Message"
          }
        },
        "required": [
          "message"
        ]
      },
      "MessageList": {
        "type": "object",
        "properties": {
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Message"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "messages",
          "next_cursor"
        ]
      },
      "ReadAnswer": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "success"
        ]
      },
      "MediaUploadAnswer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "BatchView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string"
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "template": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "language": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "language"
            ]
          },
          "total": {
            "type": "integer"
          },
          "pending": {
            "type": "integer"
          },
          "sent": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "skipped": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "status",
          "from",
          "template",
          "total",
          "pending",
          "sent",
          "failed",
          "skipped",
          "created_at",
          "finished_at"
        ]
      },
      "BatchAnswer": {
        "type": "object",
        "properties": {
          "batch": {
            "$ref": "#/components/schemas/BatchView"
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "batch",
          "replayed"
        ]
      },
      "BatchResults": {
        "type": "object",
        "properties": {
          "batch": {
            "$ref": "#/components/schemas/BatchView"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "to": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "sent",
                    "failed",
                    "skipped"
                  ]
                },
                "message_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "message_status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "code": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ]
                },
                "idempotency_key": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "client_reference": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "index",
                "to",
                "status",
                "message_id",
                "message_status",
                "error",
                "idempotency_key",
                "client_reference"
              ]
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "batch",
          "items",
          "next_cursor"
        ]
      },
      "Numbers": {
        "type": "object",
        "properties": {
          "numbers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "phone_number_id": {
                  "type": "string"
                },
                "waba_id": {
                  "type": "string"
                },
                "display_phone": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "verified_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "label": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "health": {
                  "type": "string"
                },
                "health_error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quality_rating": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "messaging_limit_tier": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "name_status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "marketing_messages": {
                  "type": "boolean"
                },
                "last_checked_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "phone_number_id",
                "waba_id",
                "display_phone",
                "verified_name",
                "label",
                "status",
                "health",
                "health_error",
                "quality_rating",
                "messaging_limit_tier",
                "name_status",
                "marketing_messages",
                "last_checked_at"
              ]
            }
          }
        },
        "required": [
          "numbers"
        ]
      },
      "Templates": {
        "type": "object",
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "language": {
                  "type": "string"
                },
                "category": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "rejected_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quality_score": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "parameter_format": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "is_fallback": {
                  "type": "boolean"
                },
                "phone_number_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "components": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "updated_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "name",
                "language",
                "category",
                "status",
                "rejected_reason",
                "quality_score",
                "parameter_format",
                "is_fallback",
                "phone_number_id",
                "components",
                "updated_at"
              ]
            }
          }
        },
        "required": [
          "templates"
        ]
      },
      "TemplateCreated": {
        "type": "object",
        "properties": {
          "template": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "language": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "language",
              "status",
              "category"
            ]
          }
        },
        "required": [
          "template"
        ]
      },
      "TemplateDeleted": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "language": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "language"
            ]
          }
        },
        "required": [
          "deleted"
        ]
      },
      "TemplateSampleAnswer": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string"
          },
          "format": {
            "type": "string",
            "enum": [
              "IMAGE",
              "VIDEO",
              "DOCUMENT"
            ]
          },
          "type": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          }
        },
        "required": [
          "handle",
          "format",
          "type",
          "size"
        ]
      },
      "TextRuleRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "pattern": {
            "type": "string"
          },
          "placeholders": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "templateName": {
            "type": "string"
          },
          "templateLanguage": {
            "type": "string"
          },
          "params": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "header": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {}
          },
          "buttons": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "pairId": {
            "type": [
              "string",
              "null"
            ]
          },
          "waAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "matchCount": {
            "type": "integer"
          },
          "lastMatchedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "name",
          "pattern",
          "placeholders",
          "templateName",
          "templateLanguage",
          "params",
          "header",
          "buttons",
          "pairId",
          "waAccountId",
          "enabled",
          "matchCount",
          "lastMatchedAt",
          "createdAt",
          "updatedAt",
          "warnings"
        ]
      },
      "TextRuleAnswer": {
        "type": "object",
        "properties": {
          "rule": {
            "$ref": "#/components/schemas/TextRuleRecord"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "rule",
          "warnings"
        ]
      },
      "TextRules": {
        "type": "object",
        "properties": {
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TextRuleRecord"
            }
          },
          "unmatched_text_mode": {
            "type": "string",
            "enum": [
              "reject",
              "fallback"
            ]
          }
        },
        "required": [
          "rules",
          "unmatched_text_mode"
        ]
      },
      "TextRuleDeleted": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "string"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "deleted",
          "warnings"
        ]
      },
      "TextRuleTestAnswer": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "matched": {
                "type": "boolean",
                "const": true
              },
              "rule": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ]
              },
              "template": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "language": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "language"
                ]
              },
              "values": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "params": {
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                ]
              },
              "header": {
                "type": "object",
                "additionalProperties": {}
              },
              "buttons": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "matched",
              "rule",
              "template",
              "values",
              "params"
            ]
          },
          {
            "type": "object",
            "properties": {
              "matched": {
                "type": "boolean",
                "const": false
              },
              "closest": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "rule": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ]
                  },
                  "template": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "language": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "language"
                    ]
                  },
                  "reason": {
                    "type": "string"
                  },
                  "expected": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "found": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "at": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "rule",
                  "template",
                  "reason",
                  "expected",
                  "found",
                  "at",
                  "message"
                ]
              }
            },
            "required": [
              "matched",
              "closest"
            ]
          }
        ]
      },
      "ConsentAnswer": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string"
          },
          "opted_in": {
            "type": "boolean"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "to",
          "opted_in",
          "recorded_at"
        ]
      },
      "ContactLanguageAnswer": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string"
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "language_source": {
            "anyOf": [
              {
                "type": "string",
                "const": "api"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "to",
          "language",
          "language_source"
        ]
      },
      "Contact": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "language_source": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "api",
                  "dashboard",
                  "inferred"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "opted_out": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "at",
              "source"
            ]
          },
          "opted_in": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "at",
              "source"
            ]
          },
          "marketing_opted_out": {
            "type": "boolean"
          },
          "window_open_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "plain_text_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "referral": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "string"
            }
          },
          "free_entry_point_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "to",
          "name",
          "language",
          "language_source",
          "opted_out",
          "opted_in",
          "marketing_opted_out",
          "window_open_until",
          "plain_text_until",
          "referral",
          "free_entry_point_until"
        ]
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "webhook": {
            "type": "object",
            "properties": {
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "events": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "message_statuses": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "url",
              "events",
              "message_statuses"
            ]
          }
        },
        "required": [
          "webhook"
        ]
      },
      "Deliveries": {
        "type": "object",
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "event": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "delivered",
                    "failed"
                  ]
                },
                "attempts": {
                  "type": "integer"
                },
                "last_status_code": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "last_error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "delivered_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "redelivered_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "redeliveries": {
                  "type": "integer"
                },
                "payload": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "additionalProperties": {}
                }
              },
              "required": [
                "id",
                "event",
                "status",
                "attempts",
                "last_status_code",
                "last_error",
                "created_at",
                "delivered_at",
                "redelivered_at",
                "redeliveries",
                "payload"
              ]
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "deliveries",
          "next_cursor"
        ]
      },
      "Redelivery": {
        "type": "object",
        "properties": {
          "delivery": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "event": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "const": "pending"
              },
              "content_removed": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "event",
              "status",
              "content_removed"
            ]
          }
        },
        "required": [
          "delivery"
        ]
      },
      "VerifyStartAnswer": {
        "type": "object",
        "properties": {
          "verification": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "to": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "channel": {
                "type": "string",
                "enum": [
                  "whatsapp",
                  "sms"
                ]
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "template": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "language": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "language"
                ]
              },
              "message": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "status": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "status"
                ]
              },
              "whatsapp_error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "meta_code": {
                    "type": "integer"
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "id",
              "to",
              "status",
              "channel",
              "expires_at",
              "template"
            ]
          }
        },
        "required": [
          "verification"
        ]
      },
      "VerifyCheckAnswer": {
        "type": "object",
        "properties": {
          "verification": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "to": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "channel": {
                "type": "string",
                "enum": [
                  "whatsapp",
                  "sms"
                ]
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "template": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "language": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "language"
                ]
              },
              "valid": {
                "type": "boolean"
              },
              "attempts_left": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "to",
              "status",
              "channel",
              "expires_at",
              "template",
              "valid",
              "attempts_left"
            ]
          }
        },
        "required": [
          "verification"
        ]
      },
      "SandboxInboundAnswer": {
        "type": "object",
        "properties": {
          "inbound": {
            "type": "object",
            "properties": {
              "wa_message_id": {
                "type": "string"
              },
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              },
              "text": {
                "type": "string"
              },
              "window_open_until": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "wa_message_id",
              "from",
              "to",
              "text",
              "window_open_until"
            ]
          }
        },
        "required": [
          "inbound"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "message_id": {
                "type": "string"
              },
              "meta_code": {
                "type": "integer"
              },
              "required_scope": {
                "type": "string"
              },
              "verification_id": {
                "type": "string"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "index": {
                      "type": "integer"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "index",
                    "code",
                    "message"
                  ]
                }
              },
              "request_id": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "retryable",
              "request_id"
            ]
          },
          "batch": {
            "$ref": "#/components/schemas/BatchView"
          }
        },
        "required": [
          "error"
        ]
      },
      "MetaError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "OAuthException"
              },
              "code": {
                "type": "integer"
              },
              "error_subcode": {
                "type": "integer"
              },
              "error_data": {
                "type": "object",
                "properties": {
                  "messaging_product": {
                    "type": "string",
                    "const": "whatsapp"
                  },
                  "details": {
                    "type": "string"
                  }
                },
                "required": [
                  "messaging_product",
                  "details"
                ]
              },
              "fbtrace_id": {
                "type": "string"
              },
              "walpio": {
                "type": "object",
                "additionalProperties": {}
              },
              "request_id": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "type",
              "code",
              "error_data",
              "fbtrace_id",
              "walpio",
              "request_id"
            ]
          },
          "batch": {
            "$ref": "#/components/schemas/BatchView"
          }
        },
        "required": [
          "error"
        ]
      },
      "MediaUpload": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "description": "The file, with its type: one of audio/aac, audio/amr, audio/mpeg, audio/mp4, audio/ogg, text/plain, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/pdf, image/jpeg, image/png, image/webp, video/3gpp, video/mp4; at most 16 MB (less for some types — Meta's limits)."
          },
          "messaging_product": {
            "type": "string",
            "const": "whatsapp"
          },
          "type": {
            "type": "string",
            "description": "The file's type, when the file part does not carry it."
          },
          "from": {
            "type": "string",
            "maxLength": 64,
            "description": "The number the file is for (a media id works only on the number it was uploaded to)."
          }
        },
        "required": [
          "file"
        ]
      },
      "TemplateSampleUpload": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "description": "The sample, with its type: image/jpeg (IMAGE, at most 5 MB), image/png (IMAGE, at most 5 MB), video/mp4 (VIDEO, at most 16 MB), application/pdf (DOCUMENT, at most 16 MB). Its first bytes must be that type's."
          },
          "type": {
            "type": "string",
            "description": "The file's type. Given, it is the type walpio checks and Meta is told, whatever the file part says."
          },
          "from": {
            "type": "string",
            "maxLength": 64,
            "description": "The number whose account gets the template (phone_number_id or walpio's number id); without it, the oldest active number."
          }
        },
        "required": [
          "file"
        ]
      },
      "MessageStatusEvent": {
        "type": "object",
        "required": [
          "id",
          "event",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The delivery's id: the same on every attempt and redelivery — de-duplicate by it."
          },
          "event": {
            "const": "message.status"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "required": [
              "message_id",
              "wa_message_id",
              "to",
              "status",
              "timestamp"
            ],
            "properties": {
              "message_id": {
                "type": "string",
                "description": "walpio's id of the message (the send's walpio.id); \"test\" in a test."
              },
              "wa_message_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Meta's wamid; null when Meta never accepted the message."
              },
              "to": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "description": "sent, delivered, read or failed — as Meta (or walpio) reported it."
              },
              "message_status": {
                "type": "string",
                "description": "The message's status in walpio after this event."
              },
              "sequence": {
                "type": "integer",
                "description": "Grows along one message's life: keep the highest per message_id."
              },
              "timestamp": {
                "type": "string",
                "format": "date-time"
              },
              "client_reference": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ],
                    "description": "Meta's code, or walpio's own (walpio:…)."
                  },
                  "message": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "source": {
                    "const": "walpio",
                    "description": "Only when walpio settled the message itself."
                  }
                }
              },
              "pricing": {
                "type": "object",
                "required": [
                  "category",
                  "billable",
                  "type",
                  "pricing_model"
                ],
                "properties": {
                  "category": {
                    "type": "string"
                  },
                  "billable": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "type": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "pricing_model": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "test": {
                "const": true,
                "description": "On \"Send a test\", and on every status of a message a test key sent (the sandbox)."
              }
            }
          }
        }
      },
      "MessageInboundEvent": {
        "type": "object",
        "required": [
          "id",
          "event",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "const": "message.inbound"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "required": [
              "wa_message_id",
              "from",
              "phone",
              "user_id",
              "phone_number_id",
              "to",
              "type",
              "context_wa_message_id",
              "timestamp"
            ],
            "properties": {
              "wa_message_id": {
                "type": "string"
              },
              "from": {
                "type": "string",
                "description": "The customer: phone digits, or their business-scoped user id."
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "user_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "username": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Content: not in a redelivery."
              },
              "system": {
                "type": "object",
                "required": [
                  "type",
                  "newWaId",
                  "previousUserId",
                  "newUserId"
                ],
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "newWaId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "previousUserId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "newUserId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "phone_number_id": {
                "type": "string"
              },
              "to": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              },
              "text": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Content: not in a redelivery."
              },
              "text_kept_until": {
                "type": "string",
                "format": "date-time",
                "description": "Only while the workspace keeps its customers' full texts, for a message with the customer's own words: until when walpio keeps them (readable as text on the message's record)."
              },
              "profile_name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Content: not in a redelivery."
              },
              "context_wa_message_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "object",
                "description": "Meta's own message object, as Meta sent it (its media url left out). Content: not in a redelivery."
              },
              "referral": {
                "type": "object",
                "description": "The Click-to-WhatsApp ad (or Facebook Page button) the customer wrote from: Meta's referral object, as Meta sent it — a video ad has video_url and thumbnail_url in place of image_url; ctwa_clid is left out for a WhatsApp Status ad. Content: not in a redelivery.",
                "properties": {
                  "source_url": {
                    "type": "string"
                  },
                  "source_id": {
                    "type": "string"
                  },
                  "source_type": {
                    "type": "string"
                  },
                  "body": {
                    "type": "string"
                  },
                  "headline": {
                    "type": "string"
                  },
                  "media_type": {
                    "type": "string"
                  },
                  "image_url": {
                    "type": "string"
                  },
                  "ctwa_clid": {
                    "type": "string"
                  },
                  "welcome_message": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "timestamp": {
                "type": "string",
                "format": "date-time"
              },
              "opt": {
                "enum": [
                  "opted_out",
                  "opted_in",
                  "marketing_opted_out"
                ]
              },
              "content_removed": {
                "const": true,
                "description": "Only on a redelivery: walpio no longer has the content fields."
              },
              "test": {
                "const": true,
                "description": "Only when the customer wrote to the sandbox (POST /v1/sandbox/inbound, or the dashboard's sandbox)."
              }
            }
          }
        }
      },
      "TemplateStatusEvent": {
        "type": "object",
        "required": [
          "id",
          "event",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "const": "template.status"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "required": [
              "waba_id",
              "name",
              "language",
              "kind",
              "reason"
            ],
            "properties": {
              "waba_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "language": {
                "type": "string"
              },
              "kind": {
                "enum": [
                  "status",
                  "quality",
                  "category"
                ]
              },
              "status": {
                "type": "string",
                "description": "kind status: Meta's event in lower case."
              },
              "quality_score": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "kind quality."
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "kind category."
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "event_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "NumberHealthEvent": {
        "type": "object",
        "required": [
          "id",
          "event",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "const": "number.health"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "required": [
              "phone_number_id",
              "waba_id",
              "display_phone",
              "health",
              "problem",
              "meta_health",
              "meta_health_detail",
              "restriction",
              "restriction_until",
              "warning",
              "warning_until",
              "previous"
            ],
            "properties": {
              "phone_number_id": {
                "type": "string"
              },
              "waba_id": {
                "type": "string"
              },
              "display_phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "health": {
                "enum": [
                  "ok",
                  "error",
                  "unknown"
                ]
              },
              "problem": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "meta_health": {
                "enum": [
                  "AVAILABLE",
                  "LIMITED",
                  "BLOCKED",
                  null
                ]
              },
              "meta_health_detail": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "restriction": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "restriction_until": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "warning": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "warning_until": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "previous": {
                "type": [
                  "object",
                  "null"
                ],
                "required": [
                  "health",
                  "problem",
                  "meta_health",
                  "restriction",
                  "warning"
                ],
                "properties": {
                  "health": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "problem": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "meta_health": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "restriction": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "warning": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "NumberQualityEvent": {
        "type": "object",
        "required": [
          "id",
          "event",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "const": "number.quality"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "required": [
              "phone_number_id",
              "waba_id",
              "display_phone",
              "quality_rating",
              "messaging_limit_tier",
              "previous"
            ],
            "properties": {
              "phone_number_id": {
                "type": "string"
              },
              "waba_id": {
                "type": "string"
              },
              "display_phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "quality_rating": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "messaging_limit_tier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "previous": {
                "type": [
                  "object",
                  "null"
                ],
                "required": [
                  "quality_rating",
                  "messaging_limit_tier"
                ],
                "properties": {
                  "quality_rating": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "messaging_limit_tier": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
