{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zeeg-me/json-schema/zeeg-me-ai-agent-call-detail-schema.json",
  "title": "AiAgentCallDetail",
  "description": "One call with its analysis and its transcript. Apart from `id`, `status`, `callSummaryTitle`, `transcriptUnavailableReason` and `createdAt`, the fields are those of the `ai_agent.call_completed` webhook payload, described there in full.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/zeeg-me-api-openapi.yml#/components/schemas/AiAgentCallDetail",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The call id, the `conversationId` of the `ai_agent.call_completed` webhook."
    },
    "status": {
      "type": "string",
      "enum": [
        "initiated",
        "done"
      ]
    },
    "callSummaryTitle": {
      "type": [
        "string",
        "null"
      ]
    },
    "agentId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "agentName": {
      "type": [
        "string",
        "null"
      ]
    },
    "direction": {
      "type": "string",
      "enum": [
        "inbound",
        "outbound"
      ]
    },
    "callOutcome": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "answered",
        "voicemail",
        "not_answered",
        "busy",
        "unknown"
      ]
    },
    "isCall": {
      "type": "boolean"
    },
    "startedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "endedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "durationSeconds": {
      "type": "integer"
    },
    "contactPhoneNumber": {
      "type": [
        "string",
        "null"
      ]
    },
    "contactName": {
      "type": [
        "string",
        "null"
      ]
    },
    "contactEmail": {
      "type": [
        "string",
        "null"
      ]
    },
    "agentPhoneNumber": {
      "type": [
        "string",
        "null"
      ]
    },
    "agentLanguage": {
      "type": [
        "string",
        "null"
      ]
    },
    "conversationLanguage": {
      "type": [
        "string",
        "null"
      ]
    },
    "transcript": {
      "type": "array",
      "description": "Ordered spoken turns, read live from the voice provider. Empty when `transcriptUnavailableReason` is set.",
      "items": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "`agent` for the voice agent, `user` for the person on the other end of the call."
          },
          "message": {
            "type": "string"
          },
          "timeInCallSeconds": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      }
    },
    "conversationAnalysis": {
      "type": "object",
      "properties": {
        "transcriptSummary": {
          "type": [
            "string",
            "null"
          ]
        },
        "collectedData": {
          "type": "object",
          "description": "Map of collected field key to its `{ value, type }`, as in the webhook payload.",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "value": {
                "description": "The value the agent collected, typed according to `type`."
              },
              "type": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    },
    "systemNotes": {
      "type": "array",
      "description": "Notes Zeeg adds about the call, as in the webhook payload. Empty when there is nothing to note. Ignore a `code` you do not recognize.",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "actions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "routeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "calledAt": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "booking": {
      "type": [
        "object",
        "null"
      ],
      "description": "The scheduled event booked during the call; `null` if none.",
      "allOf": [
        {
          "$ref": "#/$defs/ScheduledEvent"
        }
      ]
    },
    "crmPersonId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "outboundCall": {
      "type": [
        "object",
        "null"
      ],
      "description": "What you sent to the outbound-call API when you started this call.",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "fullName": {
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ]
        },
        "additionalData": {
          "type": [
            "string",
            "null"
          ]
        },
        "scheduledTime": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "transcriptUnavailableReason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "privacy_settings"
      ],
      "description": "`privacy_settings` when the call ran while the agent had transcript storage switched off, so no transcript exists. `null` otherwise."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "When Zeeg first recorded the call."
    }
  },
  "$defs": {
    "EventRescheduling": {
      "type": "object",
      "description": "Links one half of a reschedule to the other. Embedded as `rescheduling` (on the new booking) and `nextRescheduling` (on the superseded booking) inside an invitee.",
      "properties": {
        "oldStartAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "ISO 8601 UTC start time the previous booking held before the reschedule."
        },
        "newStartAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "ISO 8601 UTC start time the new booking was moved to."
        },
        "rescheduledAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 UTC timestamp when the reschedule was performed."
        },
        "previousEventUuid": {
          "type": [
            "string",
            "null"
          ],
          "description": "uuid of the superseded booking (zg-XXX format). Use it directly as the `uuid` path parameter of `GET /scheduled-events/{uuid}` to fetch that booking."
        },
        "previousInviteeUuid": {
          "type": [
            "string",
            "null"
          ],
          "description": "uuid of the invitee on the superseded booking. No public endpoint accepts an invitee uuid as a path parameter."
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Reason given for the reschedule, if any."
        },
        "rescheduledBy": {
          "type": [
            "string",
            "null"
          ],
          "description": "Who performed the reschedule (e.g. `host`, `invitee`)."
        },
        "reschedulerFullName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Full name of the person who performed the reschedule, when known."
        }
      }
    },
    "ScheduledEvent": {
      "type": "object",
      "required": [
        "uri",
        "uuid",
        "title",
        "type",
        "startTime",
        "endTime",
        "duration",
        "status",
        "eventTypeUri",
        "maxActiveInvitees",
        "activeInviteesCount",
        "invitees",
        "teamName",
        "createdAt"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri",
          "description": "Public API URI of the scheduled event resource."
        },
        "uuid": {
          "type": "string",
          "description": "Zeeg event identifier (zg-XXX format)"
        },
        "title": {
          "type": "string",
          "description": "Title of the scheduled event."
        },
        "type": {
          "type": "string",
          "description": "Event type kind (e.g. `ONE_ON_ONE`, `GROUP`, `ROUND_ROBIN`)."
        },
        "startTime": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 UTC start time of the booked event."
        },
        "endTime": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 UTC end time of the booked event."
        },
        "duration": {
          "type": "integer",
          "description": "Event duration in minutes."
        },
        "status": {
          "type": "string",
          "description": "Booking status (e.g. `confirmed`, `cancelled`)."
        },
        "eventTypeUri": {
          "type": "string",
          "format": "uri",
          "description": "Public API URI of the event type this booking was made against."
        },
        "location": {
          "type": [
            "object",
            "null"
          ],
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "description": "Location type (e.g. `google_meet`, `zoom`, `phone`, `in_person`)."
            },
            "joinUrl": {
              "type": [
                "string",
                "null"
              ],
              "format": "uri",
              "description": "Join URL for the meeting, when applicable."
            }
          },
          "description": "Meeting location for the booking."
        },
        "maxActiveInvitees": {
          "type": "integer",
          "description": "Maximum number of active invitees the event allows."
        },
        "activeInviteesCount": {
          "type": "integer",
          "description": "Current number of active (non-cancelled) invitees."
        },
        "invitees": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScheduledInvitee"
          },
          "description": "Invitees booked on the scheduled event."
        },
        "guests": {
          "type": "array",
          "description": "Email addresses of additional guests added across all invitees. An empty array when none were added.",
          "items": {
            "type": "string"
          }
        },
        "hosts": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "object",
            "required": [
              "firstName",
              "email",
              "slug",
              "url"
            ],
            "properties": {
              "firstName": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Host's first name."
              },
              "lastName": {
                "type": "string",
                "description": "Host's last name. Empty string when not set."
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "email",
                "description": "Host's email address."
              },
              "slug": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Host's public profile slug."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "Host's public profile URL."
              },
              "avatarUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri",
                "description": "URL of the host's avatar image, if set."
              }
            }
          },
          "description": "Hosts assigned to the scheduled event."
        },
        "teamName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the team that owns the scheduling page the booking was made on, or `null` for a personal scheduling page. The key is always present. This is the same value the `invitee.scheduled` webhook sends as `teamName` for the same booking."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 UTC timestamp when the booking was created."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 UTC timestamp when the booking was last updated."
        },
        "currentTime": {
          "type": "string",
          "format": "date-time",
          "description": "Current server time"
        }
      },
      "description": "A scheduled event resource. This is the single canonical shape returned by all scheduled-event endpoints and embedded in the AI agent call webhook payload."
    },
    "ScheduledInvitee": {
      "type": "object",
      "required": [
        "fullName",
        "email",
        "timeZone",
        "scheduledAt",
        "noShow"
      ],
      "properties": {
        "uuid": {
          "type": "string",
          "description": "Zeeg attendee identifier (zg-XXX format)"
        },
        "salutation": {
          "type": [
            "string",
            "null"
          ],
          "description": "Salutation for the invitee, if collected."
        },
        "fullName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Full name of the invitee."
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email",
          "description": "Email address of the invitee."
        },
        "guests": {
          "type": "array",
          "description": "Email addresses of additional guests the invitee added. An empty array when the invitee added none.",
          "items": {
            "type": "string"
          }
        },
        "timeZone": {
          "type": [
            "string",
            "null"
          ],
          "description": "IANA time zone of the invitee."
        },
        "cancellation": {
          "type": "object",
          "properties": {
            "cancelledAt": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time",
              "description": "ISO 8601 UTC timestamp when the invitee was cancelled."
            },
            "cancelledBy": {
              "type": [
                "string",
                "null"
              ],
              "description": "Identifier of who cancelled the booking."
            },
            "cancellerType": {
              "type": [
                "string",
                "null"
              ],
              "description": "Type of canceller (e.g. host, invitee)."
            },
            "cancellationReason": {
              "type": [
                "string",
                "null"
              ],
              "description": "Reason given for the cancellation."
            }
          },
          "description": "Cancellation details. All fields are `null` when the invitee is not cancelled."
        },
        "payment": {
          "type": [
            "object",
            "null"
          ],
          "description": "Payment details for the booking, or `null` when no payment applies.",
          "properties": {
            "gateway": {
              "type": "string",
              "description": "Payment provider, e.g. `stripe` or `paypal`."
            },
            "price": {
              "type": "number"
            },
            "currency": {
              "type": "string"
            },
            "transactionId": {
              "type": [
                "string",
                "null"
              ]
            },
            "createdAt": {
              "type": "string",
              "format": "date-time"
            },
            "status": {
              "type": "string",
              "enum": [
                "pending",
                "success"
              ],
              "description": "`pending` until the transaction completes."
            }
          }
        },
        "noShow": {
          "type": "boolean",
          "description": "Whether the invitee has been marked as a no-show. Always present."
        },
        "noShowAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "ISO 8601 UTC timestamp when the invitee was marked as a no-show, or `null` when they were not."
        },
        "scheduledAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "ISO 8601 UTC timestamp when the invitee booked."
        },
        "utm": {
          "type": "object",
          "required": [
            "utm_campaign",
            "utm_source",
            "utm_medium",
            "utm_term",
            "utm_content"
          ],
          "properties": {
            "utm_campaign": {
              "type": [
                "string",
                "null"
              ]
            },
            "utm_source": {
              "type": [
                "string",
                "null"
              ]
            },
            "utm_medium": {
              "type": [
                "string",
                "null"
              ]
            },
            "utm_content": {
              "type": [
                "string",
                "null"
              ]
            },
            "utm_term": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "description": "UTM tracking parameters captured at booking time. Always holds these five keys, in `snake_case`; a key holds `null` when the booking did not carry a value for it."
        },
        "adAttribution": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "gclid": {
              "type": [
                "string",
                "null"
              ],
              "description": "Google Ads click ID."
            },
            "gbraid": {
              "type": [
                "string",
                "null"
              ],
              "description": "Google click ID for iOS app-to-web clicks. Mutually exclusive with `gclid` per click."
            },
            "wbraid": {
              "type": [
                "string",
                "null"
              ],
              "description": "Google click ID for web-to-app clicks. Mutually exclusive with `gclid` per click."
            },
            "fbclid": {
              "type": [
                "string",
                "null"
              ],
              "description": "Meta click ID."
            },
            "fbp": {
              "type": [
                "string",
                "null"
              ],
              "description": "Meta browser ID cookie (`_fbp`) captured at booking time."
            },
            "fbc": {
              "type": [
                "string",
                "null"
              ],
              "description": "Meta click cookie (`_fbc`) captured at booking time."
            },
            "landingUrl": {
              "type": [
                "string",
                "null"
              ],
              "description": "Full URL of the host page the booking widget was embedded on."
            }
          },
          "description": "Ad-click identifiers captured at booking time, keyed by provider. Only the keys that were actually captured are present; `null` when none were captured."
        },
        "customQueryParams": {
          "type": "object",
          "description": "Custom query parameters captured at booking time, keyed by the `c__`-prefixed parameter name. An empty object when the booking captured none."
        },
        "questions": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              },
              "answer_type": {
                "type": "string"
              },
              "question": {
                "type": "string"
              }
            }
          },
          "description": "Booking questions answered by the invitee."
        },
        "agentBookingReference": {
          "type": [
            "string",
            "null"
          ],
          "description": "Reference code for bookings made via the AI agent; `null` otherwise."
        },
        "cancelUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Public URL the invitee uses to cancel this booking. `null` once the booking is cancelled."
        },
        "rescheduleUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Public URL the invitee uses to reschedule this booking. `null` once the booking is cancelled."
        },
        "rescheduled": {
          "type": "boolean",
          "description": "True once this booking has been superseded by a reschedule. A rescheduled booking reports `status: cancelled` for backward compatibility; `rescheduled` and `nextRescheduling` are how a caller tells a reschedule apart from an actual cancellation."
        },
        "rescheduling": {
          "allOf": [
            {
              "$ref": "#/$defs/EventRescheduling"
            }
          ],
          "nullable": true,
          "description": "Present when this booking is the *result* of a reschedule. `null` when this booking was not itself created by rescheduling an earlier one."
        },
        "nextRescheduling": {
          "allOf": [
            {
              "$ref": "#/$defs/EventRescheduling"
            }
          ],
          "nullable": true,
          "description": "Present when this booking has been superseded by a later reschedule. `null` when the booking has not been rescheduled."
        }
      },
      "description": "One invitee of a scheduled event. The scheduled event embeds it in `invitees`, and the invitee endpoints return it as `resource`."
    }
  }
}