{
    "openapi": "3.1.0",
    "info": {
        "title": "Sportschoolradar API",
        "version": "1.0.0",
        "description": "Dutch gym prices as they really are: each gym's real monthly price (sign-up fee spread over the term, 13 payments a year for per-4-weeks billing, required extras), every plan, opening hours and a dated price history, read from the gym's own website. Without a key: free, 30 calls a minute and 300 a day per IP address, current data only. With a key: EUR 10 for 1.000 calls, one credit per call, price history and the price-changes and gym-changes feeds included. The same data is an MCP server at https://sportschoolradar.com/mcp."
    },
    "servers": [
        {
            "url": "https://sportschoolradar.com"
        }
    ],
    "paths": {
        "/api/v1/towns": {
            "get": {
                "operationId": "list_towns",
                "summary": "List towns with checked gyms",
                "description": "Every Dutch town with published gyms: how many, the cheapest real monthly price, and the town page. Also lists the tag slugs search_gyms accepts. Free without a key; one credit with a key.",
                "security": [
                    [],
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The answer. data.summary says it in one sentence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Answer"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/api/v1/gyms": {
            "get": {
                "operationId": "search_gyms",
                "summary": "Search gyms by town or distance",
                "description": "Gyms ranked by real monthly price (sign-up fee spread over the term, 13 payments a year for per-4-weeks billing, required extras), in one town or within a distance of a Dutch postcode, place or coordinates. Give town, near, or lat and lng. A gym whose own site gives only a \"from\" price is not ranked: it comes apart in not_ranked, with that price and why. A town search also names, in no_price, the gyms there that put no price on their own site (a trial or an intake first), or a price without saying how often you pay it (price_without_period: true, the note quotes it). Free without a key; one credit with a key.",
                "parameters": [
                    {
                        "name": "town",
                        "in": "query",
                        "description": "Town name or slug, e.g. \"Helmond\" or \"heeze\".",
                        "schema": {
                            "type": "string",
                            "maxLength": 80
                        }
                    },
                    {
                        "name": "near",
                        "in": "query",
                        "description": "A Dutch postcode (\"5711 CN\", \"5711\") or place name to search around.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    },
                    {
                        "name": "lat",
                        "in": "query",
                        "description": "Latitude, with lng, instead of near.",
                        "schema": {
                            "type": "number",
                            "minimum": 50.6,
                            "maximum": 53.7
                        }
                    },
                    {
                        "name": "lng",
                        "in": "query",
                        "description": "Longitude, with lat.",
                        "schema": {
                            "type": "number",
                            "minimum": 3.2,
                            "maximum": 7.3
                        }
                    },
                    {
                        "name": "km",
                        "in": "query",
                        "description": "Radius in km for near or lat/lng. Default 10.",
                        "schema": {
                            "type": "number",
                            "minimum": 1,
                            "maximum": 50
                        }
                    },
                    {
                        "name": "max_price_eur",
                        "in": "query",
                        "description": "Only gyms whose real monthly price is at most this.",
                        "schema": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1000
                        }
                    },
                    {
                        "name": "tag",
                        "in": "query",
                        "description": "Only gyms with this tag, e.g. \"24-7-open\", \"alleen-vrouwen\", \"sauna-wellness\".",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "alleen-vrouwen",
                                "24-7-open",
                                "sauna-wellness",
                                "groepslessen-inbegrepen",
                                "fysio-in-huis",
                                "dagpas",
                                "maandelijks-opzegbaar",
                                "squash",
                                "studentenkorting",
                                "altijd-begeleiding",
                                "squat-rack",
                                "deadlift-platform",
                                "functionele-zone"
                            ]
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "\"price\" (default) or \"distance\".",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "price",
                                "distance"
                            ]
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Results to return. Without a key at most 25, with a key at most 200.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 200
                        }
                    }
                ],
                "security": [
                    [],
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The answer. data.summary says it in one sentence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Answer"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/api/v1/gyms/{town}/{gym}": {
            "get": {
                "operationId": "get_gym",
                "summary": "Get one gym's prices, hours and fine print",
                "description": "One gym in full: every current plan with its real monthly price and which one sets the ranking, add-ons, day passes, sign-up fees, opening hours, open-gym hours, tags, AI photo scores, its rank in town (or not_ranked_because, when its own site gives only a \"from\" price), its brand and the company behind it (from the KvK number on its own site), the source page and the date it was checked. Free without a key; one credit with a key.",
                "parameters": [
                    {
                        "name": "town",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Town slug, e.g. \"deurne\"."
                    },
                    {
                        "name": "gym",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Gym slug, e.g. \"feel-fit-center\"."
                    }
                ],
                "security": [
                    [],
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The answer. data.summary says it in one sentence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Answer"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/api/v1/gyms/{town}/{gym}/history": {
            "get": {
                "operationId": "get_price_history",
                "summary": "Get a gym's dated price history",
                "description": "Every price we ever recorded for one gym, with the first and last day each was seen on its site and the day it ended, plus its other dated changes (renamed, moved, new website, brand or company). Needs an API key (one credit).",
                "parameters": [
                    {
                        "name": "town",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Town slug, e.g. \"deurne\"."
                    },
                    {
                        "name": "gym",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Gym slug, e.g. \"feel-fit-center\"."
                    }
                ],
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The answer. data.summary says it in one sentence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Answer"
                                }
                            }
                        }
                    },
                    "402": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/api/v1/price-changes": {
            "get": {
                "operationId": "list_price_changes",
                "summary": "List gym price changes since a date",
                "description": "Price changes across all gyms (or one town) since a date, newest first: the plan, old and new price, and the day the new price was first seen. Needs an API key (one credit).",
                "parameters": [
                    {
                        "name": "since",
                        "in": "query",
                        "description": "YYYY-MM-DD. Default: 90 days ago.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "town",
                        "in": "query",
                        "description": "Only this town (name or slug).",
                        "schema": {
                            "type": "string",
                            "maxLength": 80
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "At most this many changes. Default 100.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 200
                        }
                    }
                ],
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The answer. data.summary says it in one sentence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Answer"
                                }
                            }
                        }
                    },
                    "402": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/api/v1/gym-events": {
            "get": {
                "operationId": "list_gym_events",
                "summary": "List gym openings, renames, moves and owner changes since a date",
                "description": "Dated changes across all gyms (or one town) since a date, newest first: listed on or taken off Sportschoolradar, renamed, moved, new website, new brand, or a new company behind the club. Seen_on is the day we saw the change. Price changes are in list_price_changes. Needs an API key (one credit).",
                "parameters": [
                    {
                        "name": "since",
                        "in": "query",
                        "description": "YYYY-MM-DD. Default: 90 days ago.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "town",
                        "in": "query",
                        "description": "Only this town (name or slug).",
                        "schema": {
                            "type": "string",
                            "maxLength": 80
                        }
                    },
                    {
                        "name": "kind",
                        "in": "query",
                        "description": "Only this kind of change.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "published",
                                "unpublished",
                                "closed",
                                "renamed",
                                "moved",
                                "website_changed",
                                "brand_changed",
                                "operator_changed"
                            ]
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "At most this many events. Default 100.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 200
                        }
                    }
                ],
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The answer. data.summary says it in one sentence.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Answer"
                                }
                            }
                        }
                    },
                    "402": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/api/v1/purchase": {
            "post": {
                "operationId": "start_purchase",
                "summary": "Start buying an API key (for agents)",
                "description": "Returns a Stripe checkout_url for a person to pay, and a claim secret. Poll poll_url with the header X-Claim-Secret until status is \"paid\"; that answer carries the new API key, once.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "email"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "maxLength": 254,
                                        "description": "The buyer's email: the account, and where the receipt goes."
                                    },
                                    "plan": {
                                        "type": "string",
                                        "enum": [
                                            "api-1000"
                                        ],
                                        "description": "Default api-1000."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Purchase started."
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "503": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/api/v1/purchase/{claim}": {
            "get": {
                "operationId": "collect_purchase",
                "summary": "Check a purchase and collect the key",
                "parameters": [
                    {
                        "name": "claim",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "pc_[a-z0-9]{24}"
                        }
                    },
                    {
                        "name": "X-Claim-Secret",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "status is \"pending\", \"paid\" (with api_key, once) or \"collected\"."
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "410": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "Your key, \"ssr_...\". Optional for free endpoints."
            }
        },
        "schemas": {
            "Answer": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "description": "Starts with summary, a plain sentence."
                    },
                    "meta": {
                        "type": "object",
                        "properties": {
                            "credits_remaining": {
                                "type": "integer"
                            },
                            "access": {
                                "type": "string"
                            },
                            "attribution": {
                                "type": "string"
                            },
                            "docs": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "Error": {
                "type": "object",
                "required": [
                    "error",
                    "message"
                ],
                "properties": {
                    "error": {
                        "type": "string",
                        "description": "invalid, invalid_key, key_required, credits_exhausted, not_found, gym_not_found, town_not_found, place_not_found, location_required, rate_limited, expired, not_available"
                    },
                    "message": {
                        "type": "string",
                        "description": "What went wrong and what to send instead."
                    },
                    "docs": {
                        "type": "string"
                    }
                }
            }
        },
        "responses": {
            "Error": {
                "description": "An error in the one envelope every endpoint uses.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        }
    }
}