{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pingwa-dev/json-schema/pingwa-dev-ask-in-schema.json",
  "title": "AskIn",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pingwa-dev-openapi.json#/components/schemas/AskIn",
  "properties": {
    "text": {
      "type": "string",
      "maxLength": 1024,
      "minLength": 1,
      "title": "Text"
    },
    "buttons": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Buttons"
    },
    "timeout": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Timeout"
    },
    "to": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "To",
      "description": "Who gets it: \"me\" (default: the sending number's own phone), \"team\" (that number plus every active member) or a list of up to 25 member ids / names / \"me\". A send to the team or to members answers 202 {group_id, recipients: [{member_id, name, message_id, billing_class, status}], skipped}: no top-level `message_id` (use each recipient's own `message_id`). On /v1/ask the answer also has a top-level `message_id` (the first recipient's `message_id`; any message id of the group works with GET /v1/messages/{id}/reply)."
    },
    "timeout_ok": {
      "type": "boolean",
      "title": "Timeout Ok",
      "description": "Default false: no answer within `timeout` is 408 ask_timeout. True: it is 200 {\"message_id\", \"answered\": false, \"reply\": null} (a team ask also has group_id, recipients, skipped; mode \"all\" has answers, pending, unreachable) for callers that treat a 4xx as a failed step. The question was sent and stays open; read the answer with GET /v1/messages/{message_id}/reply?wait=<s>.",
      "default": false
    },
    "mode": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "first",
            "all"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Mode"
    },
    "escalate": {
      "anyOf": [
        {
          "items": {
            "properties": {
              "to": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "\"me\" or \"team\""
                  },
                  {
                    "items": {
                      "type": "string"
                    },
                    "type": "array",
                    "description": "member ids or names, and/or \"me\""
                  }
                ]
              },
              "after_s": {
                "type": "integer",
                "maximum": 21600.0,
                "minimum": 60.0,
                "description": "seconds after the original send; each step at least 60 s after the previous one"
              }
            },
            "additionalProperties": false,
            "type": "object",
            "required": [
              "to",
              "after_s"
            ]
          },
          "type": "array",
          "maxItems": 3,
          "minItems": 1
        },
        {
          "type": "string",
          "description": "a policy name (POST /v1/team/policies)"
        },
        {
          "type": "null"
        }
      ],
      "title": "Escalate",
      "description": "teams-04: escalate while nobody answers: steps [{\"to\", \"after_s\"}] (1-3) or a policy name. Responses add `escalation` [{step, state, due_at, reason}]; state: pending | sent | cancelled | stopped."
    }
  },
  "type": "object",
  "required": [
    "text"
  ]
}