{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.calendly.com/schemas/calendly/invitee.json",
  "title": "Calendly Invitee",
  "description": "An invitee is a person who has booked or been booked for a scheduled event in Calendly, including their contact information, booking details, custom question answers, and tracking parameters.",
  "type": "object",
  "required": ["uri", "email", "name", "status", "event"],
  "properties": {
    "uri": {
      "type": "string",
      "format": "uri",
      "description": "The canonical URI of the invitee resource."
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "The email address of the invitee."
    },
    "first_name": {
      "type": "string",
      "description": "The first name of the invitee."
    },
    "last_name": {
      "type": "string",
      "description": "The last name of the invitee."
    },
    "name": {
      "type": "string",
      "description": "The full name of the invitee."
    },
    "status": {
      "type": "string",
      "enum": ["active", "canceled"],
      "description": "The current status of the invitee."
    },
    "timezone": {
      "type": "string",
      "description": "The IANA timezone of the invitee (e.g., America/New_York)."
    },
    "event": {
      "type": "string",
      "format": "uri",
      "description": "The URI of the associated scheduled event."
    },
    "text_reminder_number": {
      "type": ["string", "null"],
      "description": "The phone number for text reminders, if provided."
    },
    "rescheduled": {
      "type": "boolean",
      "description": "Whether this invitee was rescheduled from a previous event."
    },
    "old_invitee": {
      "type": ["string", "null"],
      "format": "uri",
      "description": "The URI of the previous invitee if this was a rescheduled booking."
    },
    "new_invitee": {
      "type": ["string", "null"],
      "format": "uri",
      "description": "The URI of the new invitee if this booking was rescheduled to a new one."
    },
    "cancel_url": {
      "type": "string",
      "format": "uri",
      "description": "The URL for the invitee to cancel the event."
    },
    "reschedule_url": {
      "type": "string",
      "format": "uri",
      "description": "The URL for the invitee to reschedule the event."
    },
    "routing_form_submission": {
      "type": ["string", "null"],
      "format": "uri",
      "description": "The URI of the routing form submission that led to this booking, if applicable."
    },
    "cancellation": {
      "$ref": "#/$defs/Cancellation"
    },
    "payment": {
      "$ref": "#/$defs/Payment"
    },
    "questions_and_answers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/QuestionAndAnswer"
      },
      "description": "The invitee's answers to custom questions on the event type booking page."
    },
    "tracking": {
      "$ref": "#/$defs/Tracking"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "The timestamp when the invitee was created."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "The timestamp when the invitee was last updated."
    }
  },
  "$defs": {
    "Cancellation": {
      "type": "object",
      "description": "Information about the cancellation of the invitee's booking.",
      "properties": {
        "canceled_by": {
          "type": "string",
          "description": "The name or identifier of the person who canceled."
        },
        "reason": {
          "type": "string",
          "maxLength": 10000,
          "description": "The reason provided for the cancellation."
        },
        "canceler_type": {
          "type": "string",
          "enum": ["host", "invitee"],
          "description": "Whether the host or the invitee canceled."
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp when the cancellation occurred."
        }
      }
    },
    "Payment": {
      "type": "object",
      "description": "Payment information if the event type requires payment.",
      "properties": {
        "external_id": {
          "type": "string",
          "description": "The external payment processor transaction ID."
        },
        "provider": {
          "type": "string",
          "enum": ["stripe", "paypal"],
          "description": "The payment provider used."
        },
        "amount": {
          "type": "number",
          "minimum": 0,
          "description": "The payment amount."
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$",
          "description": "The three-letter ISO 4217 currency code."
        },
        "terms": {
          "type": "string",
          "description": "The payment terms displayed to the invitee."
        },
        "successful": {
          "type": "boolean",
          "description": "Whether the payment was successfully processed."
        }
      }
    },
    "QuestionAndAnswer": {
      "type": "object",
      "description": "A custom question and the invitee's answer from the booking page.",
      "properties": {
        "question": {
          "type": "string",
          "description": "The text of the custom question."
        },
        "answer": {
          "type": "string",
          "description": "The invitee's answer to the question."
        },
        "position": {
          "type": "integer",
          "minimum": 0,
          "description": "The display position of the question on the booking page."
        }
      }
    },
    "Tracking": {
      "type": "object",
      "description": "UTM and tracking parameters captured at booking time for attribution.",
      "properties": {
        "utm_campaign": {
          "type": ["string", "null"],
          "description": "The UTM campaign parameter."
        },
        "utm_source": {
          "type": ["string", "null"],
          "description": "The UTM source parameter."
        },
        "utm_medium": {
          "type": ["string", "null"],
          "description": "The UTM medium parameter."
        },
        "utm_content": {
          "type": ["string", "null"],
          "description": "The UTM content parameter."
        },
        "utm_term": {
          "type": ["string", "null"],
          "description": "The UTM term parameter."
        },
        "salesforce_uuid": {
          "type": ["string", "null"],
          "description": "The Salesforce UUID for CRM attribution."
        }
      }
    }
  }
}
