{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elocuenti-com/json-schema/elocuenti-com-public-message-body-schema.json",
  "title": "PublicMessageBody",
  "description": "Request body for POST /api/v1/messages.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elocuenti-com-messages-api-openapi.yml#/components/schemas/PublicMessageBody",
  "type": "object",
  "properties": {
    "to": {
      "type": "string",
      "minLength": 1,
      "title": "To"
    },
    "type": {
      "type": "string",
      "enum": [
        "template",
        "text"
      ],
      "title": "Type"
    },
    "template": {
      "anyOf": [
        {
          "$ref": "#/$defs/MessageTemplate"
        },
        {
          "type": "null"
        }
      ]
    },
    "text": {
      "anyOf": [
        {
          "$ref": "#/$defs/MessageText"
        },
        {
          "type": "null"
        }
      ]
    },
    "idempotency_key": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "title": "Idempotency Key"
    },
    "reference": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Reference"
    },
    "from": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional: the business WhatsApp number to send from, in E.164 (`+573001234567`); without it, the business default. A number that is not one of your active numbers answers 422 `from_number_not_available`. `from` is part of the request: the same `idempotency_key` with another `from` answers 409 `idempotency_conflict`, so use a new key when you change the number.",
      "title": "From"
    }
  },
  "required": [
    "to",
    "type",
    "idempotency_key"
  ],
  "additionalProperties": false,
  "$defs": {
    "MessageTemplate": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "title": "Name"
        },
        "language": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Language"
        },
        "params": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            {
              "type": "null"
            }
          ],
          "title": "Params"
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false,
      "description": "The `template` block of a `type: \"template\"` send.",
      "title": "MessageTemplate"
    },
    "MessageText": {
      "type": "object",
      "properties": {
        "body": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096,
          "title": "Body"
        }
      },
      "required": [
        "body"
      ],
      "additionalProperties": false,
      "description": "The `text` block of a `type: \"text\"` send.",
      "title": "MessageText"
    }
  }
}