{
    "openapi": "3.1.0",
    "info": {
        "title": "Music Retreat Calendar API",
        "version": "1.0.0",
        "description": "Read-only access to published songwriting retreats, camps and conferences. An API key is optional: without one the limit is 60 requests per minute per IP; keys (created by the site admin) get their own limit. Send it as `Authorization: Bearer <key>`, never in the URL. Responses are cached for a few minutes and carry an ETag. Errors use RFC 9457 problem details."
    },
    "servers": [
        {
            "url": "https://calendar.moonbearmusic.com"
        }
    ],
    "security": [
        [],
        {
            "bearer": []
        }
    ],
    "paths": {
        "/api/v1/events": {
            "get": {
                "summary": "List events",
                "operationId": "listEvents",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Free-text search in title, place, organizer and description (max 100 chars)",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Events ending on or after this date",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Events starting on or before this date",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "country",
                        "in": "query",
                        "required": false,
                        "description": "ISO country codes, comma-separated (DE,FR) or repeated (country[]=DE)",
                        "schema": {
                            "type": "string"
                        },
                        "example": "DE,FR"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "Event type slugs, comma-separated or repeated",
                        "schema": {
                            "type": "string"
                        },
                        "example": "songwriting-retreat"
                    },
                    {
                        "name": "organizer",
                        "in": "query",
                        "required": false,
                        "description": "Organizer slug",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "show",
                        "in": "query",
                        "required": false,
                        "description": "upcoming (default): future events with exact dates; past; tbd: dates not clear yet (only month/year known, or none); all. Default is all when from/to is given.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "upcoming",
                                "past",
                                "tbd",
                                "all"
                            ]
                        }
                    },
                    {
                        "name": "available",
                        "in": "query",
                        "required": false,
                        "description": "1 = hide sold-out and cancelled events",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "online",
                        "in": "query",
                        "required": false,
                        "description": "1 = online only, 0 = in person only",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "0",
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "required": false,
                        "description": "date (default), -date (newest first; default for past), title, updated",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "date",
                                "-date",
                                "title",
                                "updated"
                            ]
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Items per page",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "headers": {
                            "RateLimit-Limit": {
                                "description": "Requests allowed per minute",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Remaining": {
                                "description": "Requests left in this window",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Reset": {
                                "description": "Seconds until the window resets",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "ETag": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/EventList"
                                }
                            }
                        }
                    },
                    "304": {
                        "description": "Not modified (If-None-Match matched the ETag)"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooMany"
                    }
                }
            }
        },
        "/api/v1/events/{slug}": {
            "get": {
                "summary": "One event with tags and sources",
                "operationId": "getEvent",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-z0-9-]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "headers": {
                            "RateLimit-Limit": {
                                "description": "Requests allowed per minute",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Remaining": {
                                "description": "Requests left in this window",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Reset": {
                                "description": "Seconds until the window resets",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "ETag": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/EventDetail"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "304": {
                        "description": "Not modified (If-None-Match matched the ETag)"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooMany"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/api/v1/facets": {
            "get": {
                "summary": "Filter options with counts for the current filters",
                "operationId": "getFacets",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Free-text search in title, place, organizer and description (max 100 chars)",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Events ending on or after this date",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Events starting on or before this date",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "country",
                        "in": "query",
                        "required": false,
                        "description": "ISO country codes, comma-separated (DE,FR) or repeated (country[]=DE)",
                        "schema": {
                            "type": "string"
                        },
                        "example": "DE,FR"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "Event type slugs, comma-separated or repeated",
                        "schema": {
                            "type": "string"
                        },
                        "example": "songwriting-retreat"
                    },
                    {
                        "name": "organizer",
                        "in": "query",
                        "required": false,
                        "description": "Organizer slug",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "show",
                        "in": "query",
                        "required": false,
                        "description": "upcoming (default): future events with exact dates; past; tbd: dates not clear yet (only month/year known, or none); all. Default is all when from/to is given.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "upcoming",
                                "past",
                                "tbd",
                                "all"
                            ]
                        }
                    },
                    {
                        "name": "available",
                        "in": "query",
                        "required": false,
                        "description": "1 = hide sold-out and cancelled events",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "online",
                        "in": "query",
                        "required": false,
                        "description": "1 = online only, 0 = in person only",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "0",
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "required": false,
                        "description": "date (default), -date (newest first; default for past), title, updated",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "date",
                                "-date",
                                "title",
                                "updated"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "headers": {
                            "RateLimit-Limit": {
                                "description": "Requests allowed per minute",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Remaining": {
                                "description": "Requests left in this window",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Reset": {
                                "description": "Seconds until the window resets",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "ETag": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "countries": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Facet"
                                                    }
                                                },
                                                "types": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Facet"
                                                    }
                                                },
                                                "organizers": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Facet"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "304": {
                        "description": "Not modified (If-None-Match matched the ETag)"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooMany"
                    }
                }
            }
        },
        "/api/v1/organizers": {
            "get": {
                "summary": "Organizers with published events",
                "operationId": "listOrganizers",
                "responses": {
                    "200": {
                        "description": "OK",
                        "headers": {
                            "RateLimit-Limit": {
                                "description": "Requests allowed per minute",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Remaining": {
                                "description": "Requests left in this window",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Reset": {
                                "description": "Seconds until the window resets",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "ETag": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/OrganizerSummary"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "304": {
                        "description": "Not modified (If-None-Match matched the ETag)"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooMany"
                    }
                }
            }
        },
        "/api/v1/meta": {
            "get": {
                "summary": "API version, last data update and attribution",
                "operationId": "getMeta",
                "responses": {
                    "200": {
                        "description": "OK",
                        "headers": {
                            "RateLimit-Limit": {
                                "description": "Requests allowed per minute",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Remaining": {
                                "description": "Requests left in this window",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "RateLimit-Reset": {
                                "description": "Seconds until the window resets",
                                "schema": {
                                    "type": "integer"
                                }
                            },
                            "ETag": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "304": {
                        "description": "Not modified (If-None-Match matched the ETag)"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooMany"
                    }
                }
            }
        },
        "/api/v1/health": {
            "get": {
                "summary": "Health check (database reachable)",
                "operationId": "health",
                "security": [
                    []
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "503": {
                        "description": "Database unavailable"
                    }
                }
            }
        },
        "/calendar.ics": {
            "get": {
                "summary": "iCalendar feed (same filters as /api/v1/events; exact-date events only)",
                "operationId": "ical",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Free-text search in title, place, organizer and description (max 100 chars)",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Events ending on or after this date",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Events starting on or before this date",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "country",
                        "in": "query",
                        "required": false,
                        "description": "ISO country codes, comma-separated (DE,FR) or repeated (country[]=DE)",
                        "schema": {
                            "type": "string"
                        },
                        "example": "DE,FR"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "Event type slugs, comma-separated or repeated",
                        "schema": {
                            "type": "string"
                        },
                        "example": "songwriting-retreat"
                    },
                    {
                        "name": "organizer",
                        "in": "query",
                        "required": false,
                        "description": "Organizer slug",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "show",
                        "in": "query",
                        "required": false,
                        "description": "upcoming (default): future events with exact dates; past; tbd: dates not clear yet (only month/year known, or none); all. Default is all when from/to is given.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "upcoming",
                                "past",
                                "tbd",
                                "all"
                            ]
                        }
                    },
                    {
                        "name": "available",
                        "in": "query",
                        "required": false,
                        "description": "1 = hide sold-out and cancelled events",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "online",
                        "in": "query",
                        "required": false,
                        "description": "1 = online only, 0 = in person only",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "0",
                                "1"
                            ]
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "required": false,
                        "description": "date (default), -date (newest first; default for past), title, updated",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "date",
                                "-date",
                                "title",
                                "updated"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "text/calendar",
                        "content": {
                            "text/calendar": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "API key, format rtr_live_…"
            }
        },
        "responses": {
            "Unauthorized": {
                "description": "Invalid or revoked API key",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "$ref": "#/components/schemas/Problem"
                        }
                    }
                }
            },
            "TooMany": {
                "description": "Rate limit reached; see Retry-After",
                "headers": {
                    "Retry-After": {
                        "schema": {
                            "type": "integer"
                        }
                    }
                },
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "$ref": "#/components/schemas/Problem"
                        }
                    }
                }
            },
            "NotFound": {
                "description": "Not found",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "$ref": "#/components/schemas/Problem"
                        }
                    }
                }
            }
        },
        "schemas": {
            "Problem": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    },
                    "status": {
                        "type": "integer"
                    },
                    "detail": {
                        "type": "string"
                    }
                }
            },
            "Facet": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "count": {
                        "type": "integer"
                    }
                }
            },
            "OrganizerSummary": {
                "type": "object",
                "properties": {
                    "slug": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "website": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "country_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "upcoming_count": {
                        "type": "integer"
                    },
                    "total_count": {
                        "type": "integer"
                    }
                }
            },
            "Event": {
                "type": "object",
                "required": [
                    "id",
                    "slug",
                    "title",
                    "date_precision",
                    "date_display",
                    "location",
                    "availability",
                    "links"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    },
                    "type": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "slug": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "start_date": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "end_date": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "date_precision": {
                        "type": "string",
                        "enum": [
                            "day",
                            "month",
                            "year",
                            "unknown"
                        ],
                        "description": "month = only the month is known (start_date is the 1st)"
                    },
                    "date_display": {
                        "type": "string",
                        "example": "22–26 Mar 2027"
                    },
                    "location": {
                        "type": "object",
                        "properties": {
                            "venue": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "city": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "region": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "country_code": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "country_name": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "online": {
                                "type": "boolean"
                            },
                            "latitude": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "longitude": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "display": {
                                "type": "string"
                            }
                        }
                    },
                    "url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Organizer's page for this event"
                    },
                    "price": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "from": {
                                "type": "number"
                            },
                            "currency": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "availability": {
                        "type": "string",
                        "enum": [
                            "unknown",
                            "open",
                            "few_places",
                            "waitlist",
                            "sold_out",
                            "cancelled"
                        ]
                    },
                    "organizer": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "slug": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            },
                            "website": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "verified": {
                        "type": "boolean"
                    },
                    "last_verified_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "summary": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "self": {
                                "type": "string"
                            },
                            "page": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "EventDetail": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Event"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "description": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "tags": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "slug": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "sources": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "url": {
                                            "type": "string"
                                        },
                                        "checked_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    }
                ]
            },
            "EventList": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Event"
                        }
                    },
                    "meta": {
                        "type": "object",
                        "properties": {
                            "page": {
                                "type": "integer"
                            },
                            "per_page": {
                                "type": "integer"
                            },
                            "total": {
                                "type": "integer"
                            },
                            "total_pages": {
                                "type": "integer"
                            },
                            "last_updated": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "filters": {
                                "type": "object"
                            }
                        }
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "self": {
                                "type": "string"
                            },
                            "first": {
                                "type": "string"
                            },
                            "last": {
                                "type": "string"
                            },
                            "prev": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "next": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}