{
  "openapi": "3.1.0",
  "info": {
    "title": "Stello Organization Events API",
    "version": "0.1.0-beta",
    "description": "BETA — Read-only organization event access. Staff enablement and secret server-side keys required. Unknown or duplicate query parameters are rejected. All fields are explicitly serialized. No attendee information or access tokens are exposed."
  },
  "servers": [
    {
      "url": "https://api.stello.no/v1",
      "description": "Proposed production URL; endpoints not live."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/events": {
      "get": {
        "operationId": "listEvents",
        "tags": ["Events"],
        "summary": "List organization events",
        "description": "Default: published and ends_at > as_of. Use status=all&time=all for every allowed event. Filters never expand key permissions. Cursor fixes event-time reference, not data state. Parent keys with Include sub-organizations enabled also retrieve events from active direct sub-organizations with staff-enabled API access, merged into the same sorted pagination.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Comma-separated statuses or all. Defaults to published. Archived events are excluded from the API.",
            "schema": {
              "type": "string",
              "default": "published",
              "pattern": "^(all|(draft|scheduled|published|unlisted|canceled|ended)(,(draft|scheduled|published|unlisted|canceled|ended))*)$"
            }
          },
          {
            "name": "time",
            "in": "query",
            "required": false,
            "description": "Evaluated against first-page as_of independently of status.",
            "schema": {
              "type": "string",
              "enum": ["current_or_upcoming", "current", "upcoming", "past", "all"],
              "default": "current_or_upcoming"
            }
          },
          {
            "name": "starts_at_gte",
            "in": "query",
            "required": false,
            "description": "Inclusive lower bound on event start; timezone required.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "starts_at_lt",
            "in": "query",
            "required": false,
            "description": "Exclusive upper bound on event start; timezone required.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Start time direction; equal starts use creation time in the same direction.",
            "schema": {
              "type": "string",
              "enum": ["starts_at", "-starts_at"],
              "default": "starts_at"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum items per page; short or empty continuation pages are possible.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor. Preserve the original query. Expires after one hour.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful read.",
            "headers": {
              "X-Request-Id": {
                "description": "Request reference for support.",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "description": "Authenticated responses cannot enter shared caches.",
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventList"
                },
                "example": {
                  "data": [
                    {
                      "id": "event_example",
                      "code": "4829167305",
                      "object": "event",
                      "org_id": "org_example",
                      "title": "Student concert",
                      "slug": "student-concert",
                      "description": "Live music at the student house.",
                      "description_html": "<p>Live music at the student house.</p>",
                      "status": "published",
                      "starts_at": "2026-12-04T18:00:00.000Z",
                      "ends_at": "2026-12-04T22:00:00.000Z",
                      "publish_at": null,
                      "location": {
                        "name": "Student house",
                        "address": null,
                        "city": "Ålesund",
                        "latitude": null,
                        "longitude": null
                      },
                      "image_url": "https://example.com/event-cover.jpg",
                      "categories": [],
                      "min_age": 18,
                      "age_note": null,
                      "max_capacity": 200,
                      "url": "https://stello.no/e/example/student-concert",
                      "updated_at": "2026-11-09T12:00:00.000Z",
                      "free_entry": false,
                      "refund_policy": null,
                      "ticket_channel": "inapp",
                      "fee_model": "org_pays",
                      "pricing": {
                        "from_ticket_type_id": "type_example",
                        "from_amount": 10000,
                        "from_total_amount": 10000,
                        "requires_membership": false
                      },
                      "availability": {
                        "status": "on_sale",
                        "remaining": 120,
                        "checked_at": "2026-11-09T12:00:00.000Z"
                      },
                      "ticket_types_url": "https://api.stello.no/v1/events/event_example/ticket-types"
                    }
                  ],
                  "pagination": {
                    "next_cursor": null,
                    "has_more": false
                  },
                  "as_of": "2026-11-09T12:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    },
    "/events/{event_id}": {
      "get": {
        "operationId": "getEvent",
        "tags": ["Events"],
        "summary": "Retrieve an event",
        "description": "Returns an allowed event regardless of status or dates. List defaults do not apply. Outside selection or organization returns 404.",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "description": "Stable event ID or its ten-digit event code. Not the slug.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful read.",
            "headers": {
              "X-Request-Id": {
                "description": "Request reference for support.",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "description": "Authenticated responses cannot enter shared caches.",
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventResponse"
                },
                "example": {
                  "data": {
                    "id": "event_example",
                    "code": "4829167305",
                    "object": "event",
                    "org_id": "org_example",
                    "title": "Student concert",
                    "slug": "student-concert",
                    "description": "Live music at the student house.",
                    "description_html": "<p>Live music at the student house.</p>",
                    "status": "published",
                    "starts_at": "2026-12-04T18:00:00.000Z",
                    "ends_at": "2026-12-04T22:00:00.000Z",
                    "publish_at": null,
                    "location": {
                      "name": "Student house",
                      "address": null,
                      "city": "Ålesund",
                      "latitude": null,
                      "longitude": null
                    },
                    "image_url": "https://example.com/event-cover.jpg",
                    "categories": [],
                    "min_age": 18,
                    "age_note": null,
                    "max_capacity": 200,
                    "url": "https://stello.no/e/example/student-concert",
                    "updated_at": "2026-11-09T12:00:00.000Z",
                    "free_entry": false,
                    "refund_policy": null,
                    "ticket_channel": "inapp",
                    "fee_model": "org_pays",
                    "pricing": {
                      "from_ticket_type_id": "type_example",
                      "from_amount": 10000,
                      "from_total_amount": 10000,
                      "requires_membership": false
                    },
                    "availability": {
                      "status": "on_sale",
                      "remaining": 120,
                      "checked_at": "2026-11-09T12:00:00.000Z"
                    },
                    "ticket_types_url": "https://api.stello.no/v1/events/event_example/ticket-types"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    },
    "/events/{event_id}/ticket-types": {
      "get": {
        "operationId": "listEventTicketTypes",
        "tags": ["Events"],
        "summary": "List ticket types for an event",
        "description": "All types for an allowed parent; ordered by sort_order then creation time ascending. Only publish types with publicly_listed=true. Includes member restrictions, prices, fees and live display availability.",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "description": "Stable event ID or its ten-digit event code. Not the slug.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum items per page; short or empty continuation pages are possible.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor. Preserve the original query. Expires after one hour.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful read.",
            "headers": {
              "X-Request-Id": {
                "description": "Request reference for support.",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "description": "Authenticated responses cannot enter shared caches.",
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketTypeList"
                },
                "example": {
                  "data": [
                    {
                      "id": "type_example",
                      "object": "ticket_type",
                      "org_id": "org_example",
                      "event_id": "event_example",
                      "name": "Standard",
                      "description": null,
                      "status": "published",
                      "publicly_listed": true,
                      "sales_channel": "all",
                      "sort_order": 0,
                      "price": 10000,
                      "vat_rate": 0,
                      "membership_requirement": {
                        "required": false,
                        "membership_type_ids": []
                      },
                      "sale_starts_at": "2026-11-09T12:00:00.000Z",
                      "sale_ends_at": null,
                      "sales_paused": false,
                      "max_per_order": 4,
                      "allow_multiple": true,
                      "quantity_available": 200,
                      "external_url": null,
                      "availability": {
                        "status": "on_sale",
                        "remaining": 120,
                        "checked_at": "2026-11-09T12:00:00.000Z"
                      },
                      "updated_at": "2026-11-09T12:00:00.000Z",
                      "total_price": 10000
                    }
                  ],
                  "pagination": {
                    "next_cursor": null,
                    "has_more": false
                  },
                  "as_of": "2026-11-09T12:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    },
    "/events/{event_id}/tickets/{ticket_id}": {
      "get": {
        "operationId": "getEventTicket",
        "tags": ["Events"],
        "summary": "Retrieve a ticket",
        "description": "Tells a booking system whether a ticket counts. Requires the key's Ticket lookup permission and an event the key can read. The ticket must belong to the event, otherwise the answer is 404, the same as for an unknown ID. `valid` is true for an active ticket, or one already checked in, to an event that is not canceled; refunded, released and expired tickets are returned with `valid: false`. The response contains no name, email, holder ID or QR code. `ticket_id` can be the ticket's ID or the 7-character code printed under its QR, which is unique within the event. If two tickets of an event were ever found to share a code the answer is 409 `ambiguous_ticket_code`, and the ID always works. There is no endpoint that lists tickets.",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "description": "Stable event ID or its ten-digit event code. Not the slug.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "ticket_id",
            "in": "path",
            "required": true,
            "description": "The ticket's ID, or its code: the 7 characters printed under the ticket's QR, in any case. A code is unique within its event.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The ticket.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketResponse"
                },
                "example": {
                  "data": {
                    "id": "ticket_example",
                    "code": "98J5WS9",
                    "object": "ticket",
                    "event_id": "event_example",
                    "ticket_type": {
                      "id": "ticket_type_example",
                      "name": "Medlem"
                    },
                    "status": "active",
                    "valid": true,
                    "checked_in": false,
                    "checked_in_at": null,
                    "as_of": "2026-11-19T14:00:00.000Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "405": {
            "$ref": "#/components/responses/Error405"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Organization-owned secret API key. Server use only; not a webhook signing secret."
      }
    },
    "schemas": {
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable event ID; never use the editable slug as a record key."
          },
          "code": {
            "type": ["string", "null"],
            "description": "Short event code: ten digits. Accepted anywhere an event ID is, and stable like the ID. Null for an event that has not been assigned one yet."
          },
          "object": {
            "type": "string",
            "description": "Resource discriminator.",
            "const": "event"
          },
          "org_id": {
            "type": "string",
            "description": "Organization that owns the event. Sub-organization events retain their own organization ID when retrieved through a parent key."
          },
          "title": {
            "type": "string",
            "description": "Event title."
          },
          "slug": {
            "type": "string",
            "description": "Editable event URL segment."
          },
          "description": {
            "type": ["string", "null"],
            "description": "Plain-text description, identical in meaning to the webhook field."
          },
          "description_html": {
            "type": ["string", "null"],
            "description": "Sanitized rich description. Null when no rich version exists."
          },
          "status": {
            "type": "string",
            "description": "Lifecycle/visibility status. canceled uses the existing Stello spelling.",
            "enum": ["draft", "scheduled", "published", "unlisted", "canceled", "ended"]
          },
          "starts_at": {
            "type": "string",
            "description": "Event start.",
            "format": "date-time"
          },
          "ends_at": {
            "type": "string",
            "description": "Event end.",
            "format": "date-time"
          },
          "publish_at": {
            "type": ["string", "null"],
            "description": "Scheduled publication timestamp, if present.",
            "format": "date-time"
          },
          "location": {
            "type": "object",
            "properties": {
              "name": {
                "type": ["string", "null"],
                "description": "Venue name or custom label."
              },
              "address": {
                "type": ["string", "null"],
                "description": "Street address."
              },
              "city": {
                "type": ["string", "null"],
                "description": "Municipality."
              },
              "latitude": {
                "type": ["number", "null"],
                "minimum": -90,
                "maximum": 90,
                "description": "Decimal latitude."
              },
              "longitude": {
                "type": ["number", "null"],
                "minimum": -180,
                "maximum": 180,
                "description": "Decimal longitude."
              }
            },
            "required": ["name", "address", "city", "latitude", "longitude"]
          },
          "image_url": {
            "type": ["string", "null"],
            "description": "Public cover-image URL; no API key needed to load it.",
            "format": "uri"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Category identifier."
            },
            "description": "Event categories, including the legacy single category when applicable."
          },
          "min_age": {
            "type": ["integer", "null"],
            "description": "Minimum age, if set.",
            "minimum": 0
          },
          "age_note": {
            "type": ["string", "null"],
            "description": "Additional age policy."
          },
          "max_capacity": {
            "type": ["integer", "null"],
            "description": "Shared event capacity; null if no event-wide cap.",
            "minimum": 0
          },
          "url": {
            "type": ["string", "null"],
            "description": "Public Stello event page/booking link. Visibility rules still apply when opened.",
            "format": "uri"
          },
          "updated_at": {
            "type": ["string", "null"],
            "description": "Last event metadata edit. Does not capture all ticket-price or inventory changes.",
            "format": "date-time"
          },
          "free_entry": {
            "type": "boolean",
            "description": "Organizer marks this as free without requiring a ticket. Real ticket types take precedence."
          },
          "refund_policy": {
            "type": ["string", "null"],
            "description": "Organizer-entered event refund terms; null means use Stello default explanatory copy."
          },
          "ticket_channel": {
            "type": ["string", "null"],
            "description": "Configured ticketing channel; null for legacy/unconfigured events.",
            "enum": ["inapp", "external", "free", null]
          },
          "fee_model": {
            "type": "string",
            "description": "Who carries the platform fee.",
            "enum": ["org_pays", "split", "buyer_pays"]
          },
          "pricing": {
            "type": "object",
            "properties": {
              "from_ticket_type_id": {
                "type": ["string", "null"],
                "description": "Publicly listed ticket type with the lowest standard total; ties use sort_order then creation time. Null when no comparable type exists."
              },
              "from_amount": {
                "type": ["integer", "null"],
                "description": "Listed price of from_ticket_type_id, in minor units, before the service fee. Null if unknown.",
                "minimum": 0
              },
              "from_total_amount": {
                "type": ["integer", "null"],
                "description": "Indicative listed price plus standard service fee for from_ticket_type_id. Excludes discounts and payment-method additions. Null if unknown.",
                "minimum": 0
              },
              "requires_membership": {
                "type": "boolean",
                "description": "Whether from_ticket_type_id requires an eligible membership. False if no representative type exists."
              }
            },
            "required": [
              "from_ticket_type_id",
              "from_amount",
              "from_total_amount",
              "requires_membership"
            ],
            "description": "Prices cover publicly listed types only, including types not currently on sale. Free entry with no ticket types is represented by free_entry, not fabricated zero-price tiers."
          },
          "availability": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "description": "Current display state. Checkout remains authoritative.",
                "enum": [
                  "on_sale",
                  "sold_out",
                  "not_started",
                  "paused",
                  "ended",
                  "unavailable",
                  "external",
                  "free_entry"
                ]
              },
              "remaining": {
                "type": ["integer", "null"],
                "description": "Effective remaining seats after holds and shared capacity, where available. Null for unknown, uncapped or non-ticketed inventory.",
                "minimum": 0
              },
              "checked_at": {
                "type": "string",
                "description": "When availability was computed; independent of pagination as_of.",
                "format": "date-time"
              }
            },
            "required": ["status", "remaining", "checked_at"]
          },
          "ticket_types_url": {
            "type": "string",
            "description": "Authenticated URL to the paginated ticket-type endpoint. Fetch on your server.",
            "format": "uri"
          }
        },
        "required": [
          "id",
          "code",
          "object",
          "org_id",
          "title",
          "slug",
          "description",
          "description_html",
          "status",
          "starts_at",
          "ends_at",
          "publish_at",
          "location",
          "image_url",
          "categories",
          "min_age",
          "age_note",
          "max_capacity",
          "url",
          "updated_at",
          "free_entry",
          "refund_policy",
          "ticket_channel",
          "fee_model",
          "pricing",
          "availability",
          "ticket_types_url"
        ]
      },
      "TicketType": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable ticket-type ID."
          },
          "object": {
            "type": "string",
            "description": "Resource discriminator.",
            "const": "ticket_type"
          },
          "org_id": {
            "type": "string",
            "description": "Owning organization ID."
          },
          "event_id": {
            "type": "string",
            "description": "Parent event ID."
          },
          "name": {
            "type": "string",
            "description": "Ticket type name."
          },
          "description": {
            "type": ["string", "null"],
            "description": "Ticket description."
          },
          "status": {
            "type": "string",
            "description": "Normalized visibility status, including legacy records.",
            "enum": ["draft", "published", "unlisted", "archived"]
          },
          "publicly_listed": {
            "type": "boolean",
            "description": "True when the parent is published and this type is eligible for the public Stello listing under current visibility/reveal rules. Sold-out types may remain listed. Not a sale guarantee."
          },
          "sales_channel": {
            "type": "string",
            "description": "Normalized sales channel: absent legacy channel becomes all.",
            "enum": ["all", "till"]
          },
          "sort_order": {
            "type": "integer",
            "description": "Organizer display order."
          },
          "price": {
            "type": ["integer", "null"],
            "description": "Listed per-ticket amount in minor units. Null for an external ticket with unknown price; zero means known free.",
            "minimum": 0
          },
          "vat_rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "VAT percentage, normalized to zero when absent."
          },
          "membership_requirement": {
            "type": "object",
            "properties": {
              "required": {
                "type": "boolean",
                "description": "A valid pass of at least one listed membership type is required."
              },
              "membership_type_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Membership type ID."
                },
                "description": "OR relationship: any one eligible membership satisfies the requirement. Empty means unrestricted."
              }
            },
            "required": ["required", "membership_type_ids"]
          },
          "sale_starts_at": {
            "type": ["string", "null"],
            "description": "Configured sale opening; null for external links.",
            "format": "date-time"
          },
          "sale_ends_at": {
            "type": ["string", "null"],
            "description": "Configured sale closing; null if unset or external.",
            "format": "date-time"
          },
          "sales_paused": {
            "type": "boolean",
            "description": "Temporary pause independent of the sale window."
          },
          "max_per_order": {
            "type": "integer",
            "description": "Maximum tickets per order.",
            "minimum": 1
          },
          "allow_multiple": {
            "type": "boolean",
            "description": "Whether more than one ticket can be purchased together."
          },
          "quantity_available": {
            "type": ["integer", "null"],
            "description": "Configured total quantity cap; not remaining inventory. Null for uncapped or external.",
            "minimum": 0
          },
          "external_url": {
            "type": ["string", "null"],
            "description": "Off-platform booking link, if this is an external ticket type.",
            "format": "uri"
          },
          "availability": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "description": "Current display state. Checkout remains authoritative.",
                "enum": [
                  "on_sale",
                  "sold_out",
                  "not_started",
                  "paused",
                  "ended",
                  "unavailable",
                  "external",
                  "free_entry"
                ]
              },
              "remaining": {
                "type": ["integer", "null"],
                "description": "Effective remaining seats after holds and shared capacity, where available. Null for unknown, uncapped or non-ticketed inventory.",
                "minimum": 0
              },
              "checked_at": {
                "type": "string",
                "description": "When availability was computed; independent of pagination as_of.",
                "format": "date-time"
              }
            },
            "required": ["status", "remaining", "checked_at"]
          },
          "updated_at": {
            "type": "string",
            "description": "Last edit of this ticket type.",
            "format": "date-time"
          },
          "total_price": {
            "type": ["integer", "null"],
            "description": "Ticket price plus the standard service fee, in øre (NOK). Null for an unknown external total.",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "object",
          "org_id",
          "event_id",
          "name",
          "description",
          "status",
          "publicly_listed",
          "sales_channel",
          "sort_order",
          "price",
          "vat_rate",
          "membership_requirement",
          "sale_starts_at",
          "sale_ends_at",
          "sales_paused",
          "max_per_order",
          "allow_multiple",
          "quantity_available",
          "external_url",
          "availability",
          "updated_at",
          "total_price"
        ]
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "next_cursor": {
            "type": ["string", "null"],
            "description": "Opaque cursor, or null at the end. May be present for a short or empty page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether a continuation page exists."
          }
        },
        "required": ["next_cursor", "has_more"]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable machine-readable error code.",
                "enum": [
                  "invalid_query",
                  "invalid_cursor",
                  "unauthorized",
                  "api_access_disabled",
                  "insufficient_scope",
                  "ambiguous_ticket_code",
                  "not_found",
                  "method_not_allowed",
                  "rate_limited",
                  "internal_error",
                  "temporarily_unavailable"
                ]
              },
              "message": {
                "type": "string",
                "description": "Human-readable message; do not branch on it."
              },
              "request_id": {
                "type": "string",
                "description": "Request reference for support."
              }
            },
            "required": ["code", "message", "request_id"]
          }
        },
        "required": ["error"]
      },
      "EventResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Event"
          }
        },
        "required": ["data"]
      },
      "EventList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            },
            "description": "Events on this page."
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "as_of": {
            "type": "string",
            "description": "First-page reference instant for event-time filtering; not a database snapshot.",
            "format": "date-time"
          }
        },
        "required": ["data", "pagination", "as_of"]
      },
      "TicketTypeList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TicketType"
            },
            "description": "Ticket types on this page."
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "as_of": {
            "type": "string",
            "description": "First-page traversal reference instant; availability is computed live.",
            "format": "date-time"
          }
        },
        "required": ["data", "pagination", "as_of"]
      },
      "TicketResponse": {
        "type": "object",
        "required": ["data"],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Ticket"
          }
        }
      },
      "Ticket": {
        "type": "object",
        "required": [
          "id",
          "code",
          "object",
          "event_id",
          "ticket_type",
          "status",
          "valid",
          "checked_in",
          "checked_in_at",
          "as_of"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The ticket's ID."
          },
          "code": {
            "type": "string",
            "description": "The 7-character code printed under the ticket's QR, upper-case. Unique within the event."
          },
          "object": {
            "type": "string",
            "const": "ticket",
            "description": "Resource discriminator."
          },
          "event_id": {
            "type": "string",
            "description": "The event the ticket is for."
          },
          "ticket_type": {
            "type": "object",
            "required": ["id", "name"],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "status": {
            "type": "string",
            "enum": ["active", "used", "refunded", "released", "expired"],
            "description": "`active`: not yet checked in. `used`: checked in. The rest no longer count."
          },
          "valid": {
            "type": "boolean",
            "description": "True for an active or checked-in ticket to an event that is not canceled."
          },
          "checked_in": {
            "type": "boolean"
          },
          "checked_in_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "When this answer was produced."
          }
        }
      }
    },
    "responses": {
      "Error400": {
        "description": "Invalid query or cursor.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error401": {
        "description": "Invalid, missing, inactive, expired or revoked key.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error403": {
        "description": "Organization API access disabled or required scope missing.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error404": {
        "description": "Missing or inaccessible resource.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error405": {
        "description": "Read-only API; method unsupported.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          },
          "Allow": {
            "schema": {
              "type": "string",
              "const": "GET"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error429": {
        "description": "Key or organization rate limit exceeded.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          },
          "Retry-After": {
            "description": "Seconds before retrying, rounded up.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error500": {
        "description": "Internal error; details are redacted.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error503": {
        "description": "Temporarily unavailable.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error409": {
        "description": "More than one ticket of the event has this code. Use the full ticket ID.",
        "headers": {
          "X-Request-Id": {
            "description": "Request reference for support.",
            "schema": {
              "type": "string"
            }
          },
          "Cache-Control": {
            "description": "Authenticated responses cannot enter shared caches.",
            "schema": {
              "type": "string",
              "const": "private, no-store"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
