{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://base44.com/webhooks/schemas/builder.turn_ended.v1.json",
  "title": "builder.turn_ended.v1",
  "description": "The `data` object of `builder.turn_ended.v1`. The builder finished responding to a message.",
  "additionalProperties": false,
  "properties": {
    "app_id": {
      "description": "The app the event is about.",
      "type": "string"
    },
    "workspace_id": {
      "description": "The workspace the app belongs to.",
      "type": "string"
    },
    "owner_id": {
      "description": "Opaque platform id of the app's current owner.",
      "type": "string"
    },
    "message_id": {
      "description": "The message that started the turn: the id returned when you sent it, and the app's `status.turn_id` while the turn runs.",
      "type": "string"
    },
    "conversation_id": {
      "description": "The conversation the message belongs to.",
      "type": "string"
    },
    "started_at": {
      "description": "When the builder started working on the message (UTC).",
      "format": "date-time",
      "type": "string"
    },
    "continues_message_id": {
      "description": "Set when this turn continues one that was interrupted: the `message_id` of that turn. Follow it back to add up the time the whole response took.",
      "type": "string"
    },
    "status": {
      "description": "How the turn ended. `finished`: the builder replied and has nothing pending. `waiting_for_user_input`: the builder stopped to ask something, such as a clarifying question or a plan to approve, and continues when the next message answers it. `failed`: the turn hit an error. `cancelled`: the turn was stopped before it ended. `interrupted`: the builder was interrupted, for example by a restart, and continues the work in a new turn whose `continues_message_id` is this message.",
      "enum": [
        "finished",
        "waiting_for_user_input",
        "failed",
        "cancelled",
        "interrupted"
      ],
      "type": "string"
    },
    "ended_at": {
      "description": "When the turn ended (UTC).",
      "format": "date-time",
      "type": "string"
    }
  },
  "required": [
    "app_id",
    "workspace_id",
    "owner_id",
    "message_id",
    "started_at",
    "status",
    "ended_at"
  ],
  "type": "object",
  "examples": [
    {
      "app_id": "68b0c1d2e3f4a5b6c7d8e9f0",
      "workspace_id": "68a1b2c3d4e5f6a7b8c9d0e1",
      "owner_id": "6899aabbccddeeff00112233",
      "message_id": "68d3e4f5a6b7c8d9e0f1a2b3",
      "conversation_id": "68c2d3e4f5a6b7c8d9e0f1a2",
      "started_at": "2026-09-01T10:15:30.123Z",
      "status": "finished",
      "ended_at": "2026-09-01T10:19:02.456Z"
    }
  ]
}
