{
 "openapi": "3.1.0",
 "info": {
  "title": "Andrey Sudnik - booking API",
  "version": "1.0",
  "description": "Book a video call with Andrey Sudnik without a browser. Flow: GET /api/slots for free start times (UTC), then POST /api/book with the chosen start. Working hours Mon-Fri 09:00-16:00 Asia/Bangkok (UTC+7); minimum notice 12 hours; horizon 21 days. A calendar invitation with the Zoom link is emailed to the guest. If something is unclear, write to a@sudnik.pro or Telegram @Sudnik."
 },
 "servers": [
  {
   "url": "https://cal.sudnik.pro"
  }
 ],
 "paths": {
  "/api/slots": {
   "get": {
    "operationId": "listSlots",
    "summary": "Free start times for a meeting of the given length",
    "parameters": [
     {
      "name": "dur",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "enum": [
        15,
        30,
        60,
        90
       ],
       "default": 30
      },
      "description": "Meeting length in minutes"
     }
    ],
    "responses": {
     "200": {
      "description": "Start times, ISO 8601 UTC, 15-minute grid, ascending",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "dur": {
           "type": "integer"
          },
          "slots": {
           "type": "array",
           "items": {
            "type": "string",
            "format": "date-time"
           }
          }
         }
        },
        "example": {
         "dur": 30,
         "slots": [
          "2026-11-04T02:00:00Z",
          "2026-11-04T02:15:00Z"
         ]
        }
       }
      }
     },
     "400": {
      "description": "Unsupported duration"
     },
     "503": {
      "description": "Calendar temporarily unavailable, retry in a minute"
     }
    }
   }
  },
  "/api/book": {
   "post": {
    "operationId": "bookMeeting",
    "summary": "Book one of the free slots",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "dur",
         "start",
         "name",
         "email"
        ],
        "properties": {
         "dur": {
          "type": "integer",
          "enum": [
           15,
           30,
           60,
           90
          ]
         },
         "start": {
          "type": "string",
          "format": "date-time",
          "description": "A value taken from /api/slots for the same dur"
         },
         "name": {
          "type": "string",
          "maxLength": 120,
          "description": "Guest name"
         },
         "email": {
          "type": "string",
          "description": "Guest email; up to 5 comma-separated addresses get the invitation"
         },
         "topic": {
          "type": "string",
          "maxLength": 1000,
          "description": "What to discuss - a sentence or two helps Andrey prepare"
         },
         "tz": {
          "type": "string",
          "description": "Guest IANA time zone, e.g. Europe/Berlin (informational)"
         }
        }
       },
       "example": {
        "dur": 30,
        "start": "2026-11-04T03:00:00Z",
        "name": "Ada Lovelace",
        "email": "ada@example.com",
        "topic": "Agents for our sales team",
        "tz": "Europe/London"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Booked (also returned for an exact repeat of the same booking, with repeat=true)",
      "content": {
       "application/json": {
        "example": {
         "ok": true,
         "start": "2026-11-04T03:00:00Z",
         "end": "2026-11-04T03:30:00Z"
        }
       }
      }
     },
     "400": {
      "description": "Invalid field; body {\"error\": \"duration|name|email|start\"}"
     },
     "409": {
      "description": "Slot just taken; fetch /api/slots again and choose another"
     },
     "429": {
      "description": "Rate limit: 5 bookings per hour per IP"
     },
     "503": {
      "description": "Calendar temporarily unavailable"
     }
    }
   }
  }
 }
}