{
    "openapi": "3.0.0",
    "info": {
        "title": "Tikkio Public API v4",
        "description": "Modern REST API for external integrations with third-party services like Zapier, Make.com, and AI agents. Features JWT authentication, granular permissions, and comprehensive event, product, and attendee management.",
        "contact": {
            "name": "Tikkio API Support",
            "url": "https://tikkio.com/support"
        },
        "version": "4.0.0"
    },
    "servers": [
        {
            "url": "/api/v4",
            "description": "Tikkio API v4"
        }
    ],
    "paths": {
        "/": {
            "get": {
                "tags": [
                    "System"
                ],
                "summary": "API root and discovery",
                "description": "Get information about the API, available endpoints, and capabilities. This endpoint does not require authentication and serves as the entry point for API discovery.",
                "operationId": "getApiRoot",
                "responses": {
                    "200": {
                        "description": "API information and available endpoints",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "version": {
                                            "description": "API version",
                                            "type": "string",
                                            "example": "4.0.0"
                                        },
                                        "name": {
                                            "description": "API name",
                                            "type": "string",
                                            "example": "Tikkio Public API"
                                        },
                                        "description": {
                                            "description": "API description",
                                            "type": "string",
                                            "example": "REST API for external integrations"
                                        },
                                        "endpoints": {
                                            "description": "Available API endpoints",
                                            "properties": {
                                                "health": {
                                                    "description": "Health check endpoint",
                                                    "type": "string",
                                                    "example": "/api/v4/health"
                                                },
                                                "events": {
                                                    "description": "Events listing",
                                                    "type": "string",
                                                    "example": "/api/v4/events"
                                                },
                                                "tickets": {
                                                    "description": "Tickets listing",
                                                    "type": "string",
                                                    "example": "/api/v4/tickets"
                                                },
                                                "documentation": {
                                                    "description": "Interactive API documentation",
                                                    "type": "string",
                                                    "example": "/api/v4/documentation"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "features": {
                                            "description": "API capabilities and features",
                                            "properties": {
                                                "authentication": {
                                                    "description": "Authentication method",
                                                    "type": "string",
                                                    "example": "JWT Bearer tokens"
                                                },
                                                "pagination": {
                                                    "description": "Pagination support",
                                                    "type": "boolean",
                                                    "example": true
                                                },
                                                "filtering": {
                                                    "description": "Filtering support",
                                                    "type": "boolean",
                                                    "example": true
                                                },
                                                "sorting": {
                                                    "description": "Sorting support",
                                                    "type": "boolean",
                                                    "example": true
                                                },
                                                "includes": {
                                                    "description": "Relationship includes support",
                                                    "type": "boolean",
                                                    "example": true
                                                },
                                                "rate_limit": {
                                                    "description": "Rate limit information",
                                                    "type": "string",
                                                    "example": "1000 requests per hour"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "links": {
                                            "description": "Related links",
                                            "properties": {
                                                "documentation": {
                                                    "description": "Full API documentation",
                                                    "type": "string",
                                                    "format": "uri",
                                                    "example": "https://docs.tikkio.com/api/v4"
                                                },
                                                "support": {
                                                    "description": "Support page",
                                                    "type": "string",
                                                    "format": "uri",
                                                    "example": "https://tikkio.com/support"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/events/{event}/attendees": {
            "get": {
                "tags": [
                    "Attendees"
                ],
                "summary": "List event attendees",
                "description": "Get a paginated list of attendees for a specific event.",
                "operationId": "639240effdbf14787d4c237129fa53c5",
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "description": "The event ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 123
                        }
                    },
                    {
                        "name": "filter[user.email]",
                        "in": "query",
                        "description": "Filter attendees by email (partial match) - requires attendee data access",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "john@example.com"
                        }
                    },
                    {
                        "name": "filter[user.name]",
                        "in": "query",
                        "description": "Filter attendees by name (partial match)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "John"
                        }
                    },
                    {
                        "name": "filter[ticket_id]",
                        "in": "query",
                        "description": "Filter attendees by ticket ID",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 456
                        }
                    },
                    {
                        "name": "filter[scanned]",
                        "in": "query",
                        "description": "Filter by check-in status. Use 'true' for checked-in, 'false' for not checked-in",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "true",
                            "enum": [
                                "true",
                                "false"
                            ]
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "Sort results. Use minus for descending. Available: created_at, scanned_at, user.name",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "-created_at"
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "description": "Include related data. Available: user, ticket, event",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "user,ticket,event"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Number of results per page (max 100)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 100,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number for pagination",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "attendee_id": {
                                                        "description": "Unique attendee ID",
                                                        "type": "integer",
                                                        "example": 789
                                                    },
                                                    "ticket_id": {
                                                        "description": "Product/ticket type ID",
                                                        "type": "integer",
                                                        "example": 456
                                                    },
                                                    "event_id": {
                                                        "type": "integer",
                                                        "example": 123
                                                    },
                                                    "user_id": {
                                                        "type": "integer",
                                                        "example": 567
                                                    },
                                                    "ref_id": {
                                                        "description": "Reference ID for the ticket sale",
                                                        "type": "string",
                                                        "example": "ABC123",
                                                        "nullable": true
                                                    },
                                                    "name": {
                                                        "description": "Attendee name from ticket",
                                                        "type": "string",
                                                        "example": "John Doe"
                                                    },
                                                    "price": {
                                                        "description": "Price rounded to 2 decimal places",
                                                        "type": "number",
                                                        "format": "float",
                                                        "example": 299
                                                    },
                                                    "scanned_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2024-01-20T18:30:00Z",
                                                        "nullable": true
                                                    },
                                                    "created_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2024-01-20T14:30:00Z"
                                                    },
                                                    "custom_fields": {
                                                        "description": "Custom ticket fields and their answers",
                                                        "type": "array",
                                                        "items": {
                                                            "properties": {
                                                                "label": {
                                                                    "description": "Field label (translated)",
                                                                    "type": "string",
                                                                    "example": "T-shirt size"
                                                                },
                                                                "value": {
                                                                    "description": "Field answer value",
                                                                    "type": "string",
                                                                    "example": "Large"
                                                                }
                                                            },
                                                            "type": "object"
                                                        }
                                                    },
                                                    "date_of_birth": {
                                                        "description": "Date of birth (requires include_user_pii)",
                                                        "type": "string",
                                                        "format": "date",
                                                        "example": "1990-05-15",
                                                        "nullable": true
                                                    },
                                                    "gender": {
                                                        "description": "Gender (requires include_user_pii)",
                                                        "type": "string",
                                                        "example": "female",
                                                        "nullable": true,
                                                        "enum": [
                                                            "male",
                                                            "female",
                                                            "other"
                                                        ]
                                                    },
                                                    "postal_code": {
                                                        "description": "Postal/zip code (requires include_user_pii)",
                                                        "type": "string",
                                                        "example": "0150",
                                                        "nullable": true
                                                    },
                                                    "user": {
                                                        "description": "Attendee user information",
                                                        "properties": {
                                                            "user_id": {
                                                                "type": "integer",
                                                                "example": 567
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "example": "John Doe"
                                                            },
                                                            "email": {
                                                                "type": "string",
                                                                "example": "john@example.com"
                                                            }
                                                        },
                                                        "type": "object"
                                                    },
                                                    "ticket": {
                                                        "description": "Ticket type information",
                                                        "properties": {
                                                            "ticket_id": {
                                                                "type": "integer",
                                                                "example": 456
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "example": "General Admission"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "properties": {
                                                "total": {
                                                    "type": "integer",
                                                    "example": 150
                                                },
                                                "count": {
                                                    "type": "integer",
                                                    "example": 100
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "example": 100
                                                },
                                                "current_page": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "example": 2
                                                },
                                                "has_more_pages": {
                                                    "type": "boolean",
                                                    "example": true
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Event not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Insufficient permissions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RateLimitResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/events/{event}/attendees/{attendee}": {
            "get": {
                "tags": [
                    "Attendees"
                ],
                "summary": "Get single attendee",
                "description": "Get detailed information about a specific attendee by sale ID.",
                "operationId": "850748ca6a38f8c477a509046aadf323",
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "description": "The event ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 123
                        }
                    },
                    {
                        "name": "attendee",
                        "in": "path",
                        "description": "The attendee ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 789
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "description": "Include related data. Available: user, ticket, event",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "user,ticket,event"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "attendee_id": {
                                                    "description": "Unique attendee ID",
                                                    "type": "integer",
                                                    "example": 789
                                                },
                                                "ticket_id": {
                                                    "description": "Product/ticket type ID",
                                                    "type": "integer",
                                                    "example": 456
                                                },
                                                "event_id": {
                                                    "type": "integer",
                                                    "example": 123
                                                },
                                                "user_id": {
                                                    "type": "integer",
                                                    "example": 567
                                                },
                                                "ref_id": {
                                                    "description": "Reference ID for the ticket sale",
                                                    "type": "string",
                                                    "example": "ABC123",
                                                    "nullable": true
                                                },
                                                "name": {
                                                    "description": "Attendee name from ticket",
                                                    "type": "string",
                                                    "example": "John Doe"
                                                },
                                                "price": {
                                                    "description": "Price rounded to 2 decimal places",
                                                    "type": "number",
                                                    "format": "float",
                                                    "example": 299
                                                },
                                                "currency": {
                                                    "description": "Currency code (ISO 4217)",
                                                    "type": "string",
                                                    "example": "NOK"
                                                },
                                                "scanned_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-01-20T18:30:00Z",
                                                    "nullable": true
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-01-20T14:30:00Z"
                                                },
                                                "custom_fields": {
                                                    "description": "Custom ticket fields and their answers",
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "label": {
                                                                "description": "Field label (translated)",
                                                                "type": "string",
                                                                "example": "T-shirt size"
                                                            },
                                                            "value": {
                                                                "description": "Field answer value",
                                                                "type": "string",
                                                                "example": "Large"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "date_of_birth": {
                                                    "description": "Date of birth (requires include_user_pii)",
                                                    "type": "string",
                                                    "format": "date",
                                                    "example": "1990-05-15",
                                                    "nullable": true
                                                },
                                                "gender": {
                                                    "description": "Gender (requires include_user_pii)",
                                                    "type": "string",
                                                    "example": "female",
                                                    "nullable": true,
                                                    "enum": [
                                                        "male",
                                                        "female",
                                                        "other"
                                                    ]
                                                },
                                                "postal_code": {
                                                    "description": "Postal/zip code (requires include_user_pii)",
                                                    "type": "string",
                                                    "example": "0150",
                                                    "nullable": true
                                                },
                                                "user": {
                                                    "description": "Attendee user information",
                                                    "properties": {
                                                        "user_id": {
                                                            "type": "integer",
                                                            "example": 567
                                                        },
                                                        "name": {
                                                            "type": "string",
                                                            "example": "John Doe"
                                                        },
                                                        "email": {
                                                            "type": "string",
                                                            "example": "john@example.com"
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "ticket": {
                                                    "description": "Ticket type information",
                                                    "properties": {
                                                        "ticket_id": {
                                                            "type": "integer",
                                                            "example": 456
                                                        },
                                                        "name": {
                                                            "type": "string",
                                                            "example": "General Admission"
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "event": {
                                                    "description": "Event information",
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "example": 123
                                                        },
                                                        "name": {
                                                            "type": "string",
                                                            "example": "Summer Concert"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Attendee not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Insufficient permissions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RateLimitResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/events": {
            "get": {
                "tags": [
                    "Events"
                ],
                "summary": "List events",
                "description": "Get a paginated list of events accessible by your API token.",
                "operationId": "64f96ba155176d6a0748c69093fb0962",
                "parameters": [
                    {
                        "name": "filter[status]",
                        "in": "query",
                        "description": "Filter events by status (active, upcoming, ended, cancelled, postponed, rescheduled, sold-out, few-tickets, tba, draft)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "active"
                        }
                    },
                    {
                        "name": "filter[name]",
                        "in": "query",
                        "description": "Filter events by name (partial match)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "concert"
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "Sort results. Use minus for descending",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "-starts_at"
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "description": "Include related data",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "tickets,venue"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Number of results per page (max 100)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 100,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number for pagination",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 123
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "Summer Concert"
                                                    },
                                                    "slug": {
                                                        "type": "string",
                                                        "example": "summer-concert"
                                                    },
                                                    "description": {
                                                        "type": "string",
                                                        "example": "An amazing summer concert experience"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "example": "active"
                                                    },
                                                    "starts_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2024-07-15T20:00:00Z"
                                                    },
                                                    "ends_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2024-07-15T23:00:00Z"
                                                    },
                                                    "timezone": {
                                                        "type": "string",
                                                        "example": "Europe/Oslo"
                                                    },
                                                    "currency": {
                                                        "description": "Currency code (ISO 4217)",
                                                        "type": "string",
                                                        "example": "NOK"
                                                    },
                                                    "attendee_count": {
                                                        "type": "integer",
                                                        "example": 150
                                                    },
                                                    "max_capacity": {
                                                        "type": "integer",
                                                        "example": 500
                                                    },
                                                    "created_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2024-01-15T10:30:00Z"
                                                    },
                                                    "updated_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2024-01-20T14:45:00Z"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "properties": {
                                                "total": {
                                                    "type": "integer",
                                                    "example": 25
                                                },
                                                "count": {
                                                    "type": "integer",
                                                    "example": 10
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "example": 100
                                                },
                                                "current_page": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "has_more_pages": {
                                                    "type": "boolean",
                                                    "example": false
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Insufficient permissions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "headers": {
                            "X-RateLimit-Limit": {
                                "description": "Request limit per hour",
                                "schema": {
                                    "type": "integer",
                                    "example": 1000
                                }
                            },
                            "X-RateLimit-Remaining": {
                                "description": "Remaining requests",
                                "schema": {
                                    "type": "integer",
                                    "example": 847
                                }
                            },
                            "X-RateLimit-Reset": {
                                "description": "Timestamp when rate limit resets",
                                "schema": {
                                    "type": "integer",
                                    "example": 1640995200
                                }
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RateLimitResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/events/{event}": {
            "get": {
                "tags": [
                    "Events"
                ],
                "summary": "Show event",
                "description": "Get detailed information about a specific event.",
                "operationId": "50b4fb385f8d10613ac2cb2eb82a4b7f",
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "description": "The event ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 123
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "description": "Include related data",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "tickets,attendees,venue"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "example": 123
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "example": "Summer Concert"
                                                },
                                                "slug": {
                                                    "type": "string",
                                                    "example": "summer-concert"
                                                },
                                                "description": {
                                                    "type": "string",
                                                    "example": "An amazing summer concert experience"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "example": "active"
                                                },
                                                "starts_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-07-15T20:00:00Z"
                                                },
                                                "ends_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-07-15T23:00:00Z"
                                                },
                                                "timezone": {
                                                    "type": "string",
                                                    "example": "Europe/Oslo"
                                                },
                                                "currency": {
                                                    "description": "Currency code (ISO 4217)",
                                                    "type": "string",
                                                    "example": "NOK"
                                                },
                                                "attendee_count": {
                                                    "type": "integer",
                                                    "example": 150
                                                },
                                                "max_capacity": {
                                                    "type": "integer",
                                                    "example": 500
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-01-15T10:30:00Z"
                                                },
                                                "updated_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-01-20T14:45:00Z"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Event not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Insufficient permissions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/health": {
            "get": {
                "tags": [
                    "System"
                ],
                "summary": "Health check",
                "description": "Check the API health and get version information. This endpoint does not require authentication.",
                "operationId": "getHealth",
                "responses": {
                    "200": {
                        "description": "API is operational",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "description": "API operational status",
                                            "type": "string",
                                            "example": "operational"
                                        },
                                        "version": {
                                            "description": "API version",
                                            "type": "string",
                                            "example": "4.0.0"
                                        },
                                        "timestamp": {
                                            "description": "Current server time in ISO 8601 format",
                                            "type": "string",
                                            "format": "date-time",
                                            "example": "2024-10-07T12:00:00Z"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/events/{event}/insights": {
            "get": {
                "tags": [
                    "Insights"
                ],
                "summary": "Get event insights",
                "description": "Get anonymized aggregate demographics and insights for a specific event. Returns gender distribution, age groups with average age, and top attendee locations. No individual PII is exposed — only aggregate counts.",
                "operationId": "66a3bd5ab33adf749576e56fc2b109c9",
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "description": "The event ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 123
                        }
                    },
                    {
                        "name": "top_locations",
                        "in": "query",
                        "description": "Number of top locations to return (default 10, max 50)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 10,
                            "maximum": 50,
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "event_id": {
                                                    "type": "integer",
                                                    "example": 123
                                                },
                                                "total_attendees": {
                                                    "type": "integer",
                                                    "example": 542
                                                },
                                                "gender": {
                                                    "properties": {
                                                        "distribution": {
                                                            "type": "array",
                                                            "items": {
                                                                "properties": {
                                                                    "gender": {
                                                                        "type": "string",
                                                                        "example": "male"
                                                                    },
                                                                    "count": {
                                                                        "type": "integer",
                                                                        "example": 245
                                                                    },
                                                                    "percentage": {
                                                                        "type": "number",
                                                                        "format": "float",
                                                                        "example": 45.2
                                                                    }
                                                                },
                                                                "type": "object"
                                                            }
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "age_groups": {
                                                    "properties": {
                                                        "average_age": {
                                                            "type": "number",
                                                            "format": "float",
                                                            "example": 34.2
                                                        },
                                                        "distribution": {
                                                            "type": "array",
                                                            "items": {
                                                                "properties": {
                                                                    "group": {
                                                                        "type": "string",
                                                                        "example": "18-24"
                                                                    },
                                                                    "count": {
                                                                        "type": "integer",
                                                                        "example": 89
                                                                    },
                                                                    "percentage": {
                                                                        "type": "number",
                                                                        "format": "float",
                                                                        "example": 16.42
                                                                    }
                                                                },
                                                                "type": "object"
                                                            }
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "top_locations": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "postal_code": {
                                                                "type": "string",
                                                                "example": "0150"
                                                            },
                                                            "country": {
                                                                "type": "string",
                                                                "example": "NO"
                                                            },
                                                            "count": {
                                                                "type": "integer",
                                                                "example": 45
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Event not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Insufficient permissions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RateLimitResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/events/{event}/tickets": {
            "get": {
                "tags": [
                    "Tickets"
                ],
                "summary": "List event tickets",
                "description": "Get a paginated list of tickets for a specific event.",
                "operationId": "9df30df06e47dfe7168443742af20339",
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "description": "The event ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 123
                        }
                    },
                    {
                        "name": "filter[name]",
                        "in": "query",
                        "description": "Filter tickets by name (partial match)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "VIP ticket"
                        }
                    },
                    {
                        "name": "filter[type]",
                        "in": "query",
                        "description": "Filter tickets by type",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "ticket"
                        }
                    },
                    {
                        "name": "filter[status]",
                        "in": "query",
                        "description": "Filter tickets by status",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "active"
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "Sort results. Use minus for descending",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "-price"
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "description": "Include related data",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "event"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Number of results per page (max 100)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 100,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number for pagination",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 456
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "General Admission"
                                                    },
                                                    "description": {
                                                        "type": "string",
                                                        "example": "General admission ticket"
                                                    },
                                                    "type": {
                                                        "type": "string",
                                                        "example": "ticket"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "example": "active"
                                                    },
                                                    "price": {
                                                        "description": "Price rounded to 2 decimal places",
                                                        "type": "number",
                                                        "format": "float",
                                                        "example": 299
                                                    },
                                                    "currency": {
                                                        "description": "Currency code (ISO 4217)",
                                                        "type": "string",
                                                        "example": "NOK"
                                                    },
                                                    "quantity_total": {
                                                        "type": "integer",
                                                        "example": 100
                                                    },
                                                    "quantity_available": {
                                                        "type": "integer",
                                                        "example": 75
                                                    },
                                                    "quantity_sold": {
                                                        "type": "integer",
                                                        "example": 25
                                                    },
                                                    "event_id": {
                                                        "type": "integer",
                                                        "example": 123
                                                    },
                                                    "created_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2024-01-15T10:30:00Z"
                                                    },
                                                    "updated_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2024-01-20T14:45:00Z"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "meta": {
                                            "properties": {
                                                "total": {
                                                    "type": "integer",
                                                    "example": 5
                                                },
                                                "count": {
                                                    "type": "integer",
                                                    "example": 5
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "example": 100
                                                },
                                                "current_page": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "total_pages": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "has_more_pages": {
                                                    "type": "boolean",
                                                    "example": false
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Event not found"
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Insufficient permissions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RateLimitResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/events/{event}/tickets/{ticket}": {
            "get": {
                "tags": [
                    "Tickets"
                ],
                "summary": "Show ticket",
                "description": "Get detailed information about a specific ticket within an event.",
                "operationId": "266d446945ebd61c24cca5c1e00fa24d",
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "description": "The event ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 123
                        }
                    },
                    {
                        "name": "ticket",
                        "in": "path",
                        "description": "The ticket ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 456
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "description": "Include related data",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "event"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "example": 456
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "example": "General Admission"
                                                },
                                                "description": {
                                                    "type": "string",
                                                    "example": "General admission ticket"
                                                },
                                                "type": {
                                                    "type": "string",
                                                    "example": "ticket"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "example": "active"
                                                },
                                                "price": {
                                                    "description": "Price rounded to 2 decimal places",
                                                    "type": "number",
                                                    "format": "float",
                                                    "example": 299
                                                },
                                                "currency": {
                                                    "description": "Currency code (ISO 4217)",
                                                    "type": "string",
                                                    "example": "NOK"
                                                },
                                                "quantity_total": {
                                                    "type": "integer",
                                                    "example": 100
                                                },
                                                "quantity_available": {
                                                    "type": "integer",
                                                    "example": 75
                                                },
                                                "quantity_sold": {
                                                    "type": "integer",
                                                    "example": 25
                                                },
                                                "event_id": {
                                                    "type": "integer",
                                                    "example": 123
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-01-15T10:30:00Z"
                                                },
                                                "updated_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-01-20T14:45:00Z"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Ticket not found"
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Insufficient permissions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RateLimitResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "ErrorResponse": {
                "description": "Standard error response format",
                "properties": {
                    "error": {
                        "properties": {
                            "code": {
                                "description": "Machine-readable error code",
                                "type": "string",
                                "example": "TOKEN_EXPIRED"
                            },
                            "message": {
                                "description": "Human-readable error message",
                                "type": "string",
                                "example": "The provided token has expired"
                            },
                            "status": {
                                "description": "HTTP status code",
                                "type": "integer",
                                "example": 401
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "RateLimitResponse": {
                "description": "Rate limit exceeded error response",
                "properties": {
                    "error": {
                        "properties": {
                            "code": {
                                "type": "string",
                                "example": "RATE_LIMIT_EXCEEDED"
                            },
                            "message": {
                                "type": "string",
                                "example": "Rate limit of 1000 requests per hour exceeded"
                            },
                            "status": {
                                "type": "integer",
                                "example": 429
                            },
                            "retry_after": {
                                "description": "Seconds until rate limit resets",
                                "type": "integer",
                                "example": 3600
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "JWT",
                "description": "Enter your JWT token. You can create and manage API tokens in your Event Manager dashboard under Tools → API Tokens."
            }
        }
    },
    "tags": [
        {
            "name": "System",
            "description": "System endpoints for health checks and API discovery"
        },
        {
            "name": "Events",
            "description": "API endpoints for managing events"
        },
        {
            "name": "Tickets",
            "description": "API endpoints for managing tickets and products"
        },
        {
            "name": "Attendees",
            "description": "API endpoints for managing attendees"
        },
        {
            "name": "Insights",
            "description": "Event attendee demographics and insights"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ]
}