{
  "openapi": "3.1.0",
  "info": {
    "title": "showhatch events API",
    "version": "1.0.0",
    "description": "Search upcoming events on showhatch storefronts (independent artists, DJs, promoters) and create ticket or VIP table checkouts. Checkouts are Stripe-hosted on the organizer's own account; the buyer pays there. No authentication. The same tools are available over MCP at https://showhatch.com/mcp.",
    "contact": { "email": "hello@showhatch.com", "url": "https://showhatch.com/agents" }
  },
  "servers": [{ "url": "https://showhatch.com" }],
  "paths": {
    "/api/v1/events": {
      "get": {
        "operationId": "searchEvents",
        "summary": "Search upcoming events",
        "parameters": [
          { "name": "q", "in": "query", "schema": { "type": "string" }, "description": "Keywords: artist, genre, venue, event name." },
          { "name": "city", "in": "query", "schema": { "type": "string" } },
          { "name": "from", "in": "query", "schema": { "type": "string", "format": "date" } },
          { "name": "to", "in": "query", "schema": { "type": "string", "format": "date" }, "description": "Inclusive." },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 } }
        ],
        "responses": {
          "200": {
            "description": "Matching events, soonest first.",
            "content": { "application/json": { "schema": {
              "type": "object",
              "properties": {
                "ok": { "type": "boolean" },
                "count": { "type": "integer" },
                "events": { "type": "array", "items": { "$ref": "#/components/schemas/EventSummary" } }
              }
            } } }
          }
        }
      }
    },
    "/api/v1/events/{organizer}/{event}": {
      "get": {
        "operationId": "getEvent",
        "summary": "Event details with ticket and table options",
        "parameters": [
          { "name": "organizer", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "event", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Event details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EventDetail" } } } },
          "404": { "description": "No such upcoming event." }
        }
      }
    },
    "/api/v1/checkout": {
      "post": {
        "operationId": "createCheckout",
        "summary": "Create a Stripe checkout for tickets or a VIP table deposit",
        "description": "Confirm the item and price with the person first. Returns a Stripe-hosted link that expires in 30 minutes. Nothing is charged until the buyer pays.",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": {
            "type": "object",
            "required": ["event_id", "customer_name", "customer_email", "customer_phone"],
            "properties": {
              "event_id": { "type": "string", "description": "organizer/event, from searchEvents." },
              "ticket_type_id": { "type": "string", "description": "Use this or table_type_id." },
              "quantity": { "type": "integer", "minimum": 1, "maximum": 12, "default": 1 },
              "table_type_id": { "type": "string" },
              "party_size": { "type": "integer", "minimum": 1, "maximum": 80 },
              "customer_name": { "type": "string" },
              "customer_email": { "type": "string", "format": "email" },
              "customer_phone": { "type": "string" },
              "attendees": {
                "type": "array",
                "description": "Required when the order admits more than one person: one entry per admission, including the buyer.",
                "items": { "type": "object", "required": ["name", "email"], "properties": { "name": { "type": "string" }, "email": { "type": "string" } } }
              },
              "discount_code": { "type": "string" },
              "notes": { "type": "string" },
              "source": { "type": "string", "description": "Your agent's name, e.g. muse." }
            }
          } } }
        },
        "responses": {
          "200": {
            "description": "Checkout created.",
            "content": { "application/json": { "schema": {
              "type": "object",
              "properties": {
                "ok": { "type": "boolean" },
                "checkout_url": { "type": "string", "format": "uri" },
                "event": { "type": "string" },
                "item": { "type": "string" },
                "expires_in_minutes": { "type": "integer" },
                "instructions": { "type": "string" }
              }
            } } }
          },
          "400": { "description": "Missing or invalid fields." },
          "409": { "description": "Sold out, not purchasable, or rejected by the storefront." }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "EventSummary": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "title": { "type": "string" },
          "organizer": { "type": "string" },
          "city": { "type": "string" },
          "starts_at": { "type": "string", "format": "date-time" },
          "doors_at": { "type": "string", "format": "date-time" },
          "timezone": { "type": "string" },
          "venue": { "type": "string" },
          "address": { "type": "string" },
          "age_restriction": { "type": "string" },
          "from_price": { "type": ["string", "null"] },
          "sold_out": { "type": "boolean" },
          "has_tables": { "type": "boolean" },
          "url": { "type": "string", "format": "uri" },
          "image_url": { "type": ["string", "null"] },
          "purchasable": { "type": "boolean" }
        }
      },
      "EventDetail": {
        "allOf": [
          { "$ref": "#/components/schemas/EventSummary" },
          {
            "type": "object",
            "properties": {
              "refund_policy": { "type": "string" },
              "dress_code": { "type": "string" },
              "ticket_types": { "type": "array", "items": { "type": "object", "properties": {
                "id": { "type": "string" }, "name": { "type": "string" }, "price": { "type": "string" },
                "price_cents": { "type": "integer" }, "admits": { "type": "integer" },
                "remaining": { "type": ["integer", "null"] }, "sold_out": { "type": "boolean" } } } },
              "table_types": { "type": "array", "items": { "type": "object", "properties": {
                "id": { "type": "string" }, "name": { "type": "string" }, "capacity": { "type": "integer" },
                "minimum_spend": { "type": "string" }, "deposit_due_now": { "type": "string" },
                "remaining": { "type": "integer" } } } }
            }
          }
        ]
      }
    }
  }
}
