{
  "openapi": "3.1.0",
  "info": {
    "title": "Croutons booking API",
    "version": "1.0.0",
    "description": "Read sessions, prices and open times; book a free diagnosis call; send a message. No API key. Agent bookings are confirmed by the attendee via email.",
    "contact": {
      "email": "hi@croutons.ai",
      "url": "https://croutons.ai/agents"
    },
    "termsOfService": "https://croutons.ai/terms"
  },
  "servers": [
    {
      "url": "https://croutons.ai"
    }
  ],
  "paths": {
    "/api/sessions": {
      "get": {
        "operationId": "listSessions",
        "summary": "Sessions, prices, engagements and booking rules",
        "responses": {
          "200": {
            "description": "Catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          }
        }
      }
    },
    "/api/availability": {
      "get": {
        "operationId": "getAvailability",
        "summary": "Open start times for a session",
        "parameters": [
          {
            "name": "session",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ai-layer-diagnosis",
                "ai-visibility-diagnosis",
                "evidence-brief-review",
                "ai-rollout-risk-review"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Open slots",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Availability"
                }
              }
            }
          }
        }
      }
    },
    "/api/book": {
      "post": {
        "operationId": "bookSession",
        "summary": "Book a session",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Booked (confirmed) or held (pending email confirmation)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "409": {
            "description": "Slot no longer open"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/api/contact": {
      "post": {
        "operationId": "sendMessage",
        "summary": "Send a message to the team",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "message"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "company": {
                    "type": "string"
                  },
                  "topic": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 5000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Catalog": {
        "type": "object",
        "properties": {
          "sessions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "engagements": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "booking": {
            "type": "object"
          }
        }
      },
      "Availability": {
        "type": "object",
        "properties": {
          "session": {
            "type": "string"
          },
          "timeZone": {
            "type": "string",
            "description": "Business time zone used for date keys"
          },
          "durationMinutes": {
            "type": "integer"
          },
          "slots": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "BookingRequest": {
        "type": "object",
        "required": [
          "session",
          "start",
          "name",
          "email"
        ],
        "properties": {
          "session": {
            "type": "string",
            "enum": [
              "ai-layer-diagnosis",
              "ai-visibility-diagnosis",
              "evidence-brief-review",
              "ai-rollout-risk-review"
            ]
          },
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "company": {
            "type": "string"
          },
          "notes": {
            "type": "string",
            "maxLength": 2000
          },
          "timeZone": {
            "type": "string"
          },
          "turnstileToken": {
            "type": "string",
            "description": "Only from the website form; omit for agents"
          }
        }
      },
      "BookingResult": {
        "type": "object",
        "properties": {
          "booking": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "session": {
                "type": "string"
              },
              "start": {
                "type": "string",
                "format": "date-time"
              },
              "end": {
                "type": "string",
                "format": "date-time"
              },
              "status": {
                "type": "string",
                "enum": [
                  "confirmed",
                  "pending"
                ]
              }
            }
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}