{
  "openapi": "3.1.0",
  "info": {
    "title": "Book a call with Joe Hill",
    "description": "Open times and booking for a free 15-minute fit call, by video, with Joe Hill, an AI partner in Portland, Tennessee who works with owners and teams anywhere. All times are Central unless a time zone is given.",
    "version": "1.0.0",
    "contact": { "name": "Joe Hill", "email": "joe@joehill.net", "url": "https://joehill.net/" }
  },
  "servers": [{ "url": "https://joehill.net" }],
  "paths": {
    "/api/slots": {
      "get": {
        "operationId": "getOpenTimes",
        "summary": "See Joe's open call times",
        "description": "Lists open times for a free 15-minute fit call with Joe Hill. With no date, the next open times by day. With a date, every open time that day. Each answer has today, today's date in Central time, for working out a day like Friday. Pass a time's start value to bookCall.",
        "x-openai-isConsequential": false,
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "One day as YYYY-MM-DD, worked out from the today value in an earlier answer. Returns every open time on that day.",
            "schema": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }
          },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "description": "First day of a run of days, as YYYY-MM-DD. Use it with end, for a request like early next week.",
            "schema": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "description": "Last day of a run of days, as YYYY-MM-DD. Use it with start.",
            "schema": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }
          }
        ],
        "responses": {
          "200": {
            "description": "The open times, grouped by day. An empty days list means nothing is open on the days asked for; note says why.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OpenTimes" } } }
          },
          "502": {
            "description": "The calendar did not answer. Offer the fallbacks: (615) 802-5915 or joe@joehill.net.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Failed" } } }
          },
          "503": {
            "description": "Booking is not available right now. Offer the fallbacks: (615) 802-5915 or joe@joehill.net.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Failed" } } }
          }
        }
      }
    },
    "/api/book": {
      "post": {
        "operationId": "bookCall",
        "summary": "Book a free call with Joe",
        "description": "Books a free 15-minute fit call with Joe Hill, by video, at a start value from getOpenTimes. Read the day, time and every detail back to the person and get a clear yes before calling this. The calendar invite goes to the email given. It is booked only if the answer has ok true.",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Booking" } } }
        },
        "responses": {
          "200": {
            "description": "Booked. The invite is on its way to the email given.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Booked" } } }
          },
          "400": {
            "description": "One detail is missing or can't be used. error names the field (name, email, phone, industry, size, role, topic, note or start), or is form when the request itself can't be read. Ask the person for that one detail again, then retry.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Failed" } } }
          },
          "403": {
            "description": "error is origin: this request was not accepted from here. Give the person the booking link https://joehill.net/?book= followed by the start value.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Failed" } } }
          },
          "409": {
            "description": "error is taken: someone else just took that time. Nothing was booked. Call getOpenTimes again and offer other times.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Failed" } } }
          },
          "429": {
            "description": "error is slow: too many tries in one minute. Nothing was booked. Wait a minute and try once more, or give the booking link.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Failed" } } }
          },
          "502": {
            "description": "error is unavailable: the calendar did not answer, so treat the call as not booked. Joe is sent the details so he can follow up. Offer the fallbacks: (615) 802-5915 or joe@joehill.net.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Failed" } } }
          },
          "503": {
            "description": "error is unavailable: booking is not available right now. Nothing was booked. Offer the fallbacks: (615) 802-5915 or joe@joehill.net.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Failed" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "OpenTimes": {
        "type": "object",
        "required": ["timeZone", "today", "days"],
        "properties": {
          "timeZone": { "type": "string", "description": "The time zone of every label: America/Chicago (Central)." },
          "today": { "type": "string", "description": "Today's date in Central time, as YYYY-MM-DD. Work out a day like Friday from this, never from your own idea of the date." },
          "from": { "type": "string", "description": "First day covered, when a date or a run of days was asked for." },
          "to": { "type": "string", "description": "Last day covered, when a date or a run of days was asked for." },
          "note": { "type": "string", "description": "Present when the days asked for have nothing open or the date could not be read. Tell the person what it says." },
          "days": {
            "type": "array",
            "description": "Days with open times, soonest first.",
            "items": {
              "type": "object",
              "required": ["date", "label", "slots"],
              "properties": {
                "date": { "type": "string", "description": "The day as YYYY-MM-DD." },
                "label": { "type": "string", "description": "The day in short form, such as Mon, 11/16." },
                "slots": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": ["start", "label"],
                    "properties": {
                      "start": { "type": "string", "description": "The exact value to pass to bookCall as start, such as 2026-11-16T08:00:00.000-06:00. Never change it or make one up." },
                      "label": { "type": "string", "description": "The time in Central time, such as 8:00 AM." }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Booking": {
        "type": "object",
        "additionalProperties": false,
        "required": ["start", "name", "email", "phone"],
        "properties": {
          "start": { "type": "string", "description": "The start value of an open time from getOpenTimes, exactly as given." },
          "name": { "type": "string", "maxLength": 100, "description": "The person's full name." },
          "email": { "type": "string", "maxLength": 200, "description": "Where the calendar invite goes. Check the spelling with the person." },
          "phone": { "type": "string", "maxLength": 40, "description": "Phone number with area code. Outside the US or Canada, start with + and the country code." },
          "industry": { "type": "string", "maxLength": 100, "description": "Optional. What the business does, in the person's words." },
          "size": {
            "type": "string",
            "enum": ["Just me", "2 to 10", "11 to 50", "51 to 200", "201 to 500", "More than 500"],
            "description": "Optional. How many people work there. Pick the choice that fits what the person said."
          },
          "role": { "type": "string", "maxLength": 100, "description": "Optional. The person's role at the business, such as owner or office manager." },
          "topic": {
            "type": "string",
            "enum": ["Team training", "Automation", "Integration", "Find the starting point"],
            "description": "Optional. What the call is mostly about. Leave it out if the person has no preference."
          },
          "note": { "type": "string", "maxLength": 1000, "description": "Optional. What they want to fix or build, in a sentence or two." },
          "timeZone": { "type": "string", "maxLength": 59, "description": "Optional. The person's IANA time zone for the invite, such as America/New_York. Leave it out for Central." }
        }
      },
      "Booked": {
        "type": "object",
        "required": ["ok", "start"],
        "properties": {
          "ok": { "type": "boolean", "description": "True when the call is booked." },
          "start": { "type": "string", "description": "When the booked call starts." },
          "uid": { "type": "string", "description": "The booking's reference." }
        }
      },
      "Failed": {
        "type": "object",
        "required": ["ok", "error"],
        "properties": {
          "ok": { "type": "boolean", "description": "False: nothing was booked." },
          "error": { "type": "string", "description": "Why: a field name, form, taken, slow, origin, method or unavailable." }
        }
      }
    }
  }
}
