{
    "openapi": "3.1.0",
    "info": {
        "title": "Compare Broadband Market API",
        "version": "3.0",
        "description": "Free, keyless, read-only UK broadband data. /api/offers and /products.json list current partner broadband deals with speeds, upfront costs and estimated whole-contract costs, checked daily but not for any specific address. /api/postcode returns Ofcom postcode-level coverage estimates and a link to compare deals checked for an exact address. Limited to 30 requests per minute per IP; honour Retry-After."
    },
    "servers": [
        {
            "url": "https://www.comparebroadbandmarket.co.uk"
        }
    ],
    "paths": {
        "/api/postcode": {
            "get": {
                "operationId": "getPostcodeBroadbandSummary",
                "summary": "Broadband coverage summary and comparison link for a UK postcode",
                "description": "Use when a user asks about broadband in a UK postcode. Share compare_url so they can choose their address and see live partner deals, upfront costs and whole-contract totals. Always relay the caveats; never present the coverage summary as a deal or guaranteed availability. Rate limits and service failures do not mean broadband is unavailable; respect Retry-After when supplied.",
                "parameters": [
                    {
                        "name": "postcode",
                        "in": "query",
                        "required": true,
                        "description": "Full UK postcode, for example SW1A 1AA.",
                        "schema": {
                            "type": "string",
                            "maxLength": 16
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Postcode summary",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PostcodeSummary"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid postcode format",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Postcode not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limited",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "When present, seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "Postcode lookup or request safeguards temporarily unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "When present, seconds to wait before retrying.",
                                "schema": {
                                    "type": "integer",
                                    "minimum": 1
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/offers": {
            "get": {
                "operationId": "listBroadbandDeals",
                "summary": "Search current UK partner broadband deals",
                "description": "Returns the deals shown on the browse page and /best/ lists, filtered and sorted. Prices are advertised or sample-property prices on last_checked, not checked for any address. Use /api/postcode for postcode coverage.",
                "parameters": [
                    {
                        "name": "provider",
                        "in": "query",
                        "required": false,
                        "description": "Case-insensitive provider name match, such as sky or virgin.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "min_speed",
                        "in": "query",
                        "required": false,
                        "description": "Minimum download speed in Mbps. Unknown speeds are excluded when set.",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "max_term",
                        "in": "query",
                        "required": false,
                        "description": "Maximum contract length in months.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "max_monthly",
                        "in": "query",
                        "required": false,
                        "description": "Highest starting monthly price in pounds.",
                        "schema": {
                            "type": "number",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "max_average",
                        "in": "query",
                        "required": false,
                        "description": "Highest estimated average monthly cost over the contract, in pounds.",
                        "schema": {
                            "type": "number",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "max_total",
                        "in": "query",
                        "required": false,
                        "description": "Highest estimated whole-contract total in pounds.",
                        "schema": {
                            "type": "number",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "max_setup",
                        "in": "query",
                        "required": false,
                        "description": "Highest upfront or setup cost in pounds.",
                        "schema": {
                            "type": "number",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "no_price_rises",
                        "in": "query",
                        "required": false,
                        "description": "Only deals with no known in-contract price rise.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "true"
                            ]
                        }
                    },
                    {
                        "name": "free_months",
                        "in": "query",
                        "required": false,
                        "description": "Only deals with free months.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "true"
                            ]
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "required": false,
                        "description": "Sort order; unknown values sort last. value_per_mbps = best value (lowest average monthly cost per Mbps).",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "average_monthly",
                                "total_cost",
                                "value_per_mbps",
                                "monthly_cost",
                                "speed"
                            ],
                            "default": "average_monthly"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Results per page.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Matching deals",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DealList"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limited; honour Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/products.json": {
            "get": {
                "operationId": "getDealDirectory",
                "summary": "All current partner broadband deals grouped by provider",
                "responses": {
                    "200": {
                        "description": "Deal directory",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DealDirectory"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limited; honour Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Deal": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "Identifier for this catalogue snapshot; may change after a daily refresh."
                    },
                    "provider": {
                        "type": "string"
                    },
                    "product": {
                        "type": "string"
                    },
                    "speed_mbps": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Advertised download speed; null when not confirmed."
                    },
                    "o2_volt_speed_mbps": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Virgin Media boosted average download speed with eligible O2 Volt; otherwise null."
                    },
                    "term_months": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "monthly_cost": {
                        "type": "number",
                        "description": "Starting monthly price in pounds including VAT."
                    },
                    "monthly_cost_label": {
                        "type": "string"
                    },
                    "setup_cost": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "Upfront or setup cost in pounds; null when not confirmed."
                    },
                    "total_cost": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "Estimated whole-contract cost including setup and known price rises; null when not confirmed."
                    },
                    "average_monthly_cost": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "total_cost divided by term_months."
                    },
                    "highest_monthly_cost": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "Highest known monthly bill during the contract."
                    },
                    "price_rises": {
                        "type": [
                            "boolean",
                            "null"
                        ],
                        "description": "Whether a price rise is known during the contract; null when unknown."
                    },
                    "free_months": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    },
                    "price_details": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "special_offer": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "valid_until": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "description": "Offer end date; null means not confirmed, not indefinite."
                    },
                    "last_checked": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date",
                        "description": "UK date the price was checked."
                    },
                    "price_type": {
                        "type": "string",
                        "enum": [
                            "sampled_property",
                            "provider_catalogue",
                            "advertised"
                        ]
                    },
                    "deal_url": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "uri",
                        "description": "Affiliate link to the provider; the provider checks the address."
                    },
                    "comparison_url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Compare Broadband Market page listing this deal. Link here when citing."
                    }
                }
            },
            "DealList": {
                "type": "object",
                "properties": {
                    "api_version": {
                        "type": "string"
                    },
                    "documentation": {
                        "type": "string",
                        "format": "uri"
                    },
                    "data_last_updated": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "notes": {
                        "type": "string"
                    },
                    "query": {
                        "type": "object"
                    },
                    "pagination": {
                        "type": "object",
                        "properties": {
                            "page": {
                                "type": "integer"
                            },
                            "per_page": {
                                "type": "integer"
                            },
                            "total_results": {
                                "type": "integer"
                            },
                            "total_pages": {
                                "type": "integer"
                            },
                            "next": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "uri"
                            },
                            "previous": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "uri"
                            }
                        }
                    },
                    "offers": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Deal"
                        }
                    }
                }
            },
            "DealDirectory": {
                "type": "object",
                "properties": {
                    "api_version": {
                        "type": "string"
                    },
                    "generated_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "latest_source_check": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    },
                    "notes": {
                        "type": "string"
                    },
                    "providers": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "offers": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Deal"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    }
                }
            },
            "PostcodeSummary": {
                "type": "object",
                "required": [
                    "postcode",
                    "coverage",
                    "partners_checked_live",
                    "compare_url",
                    "caveats"
                ],
                "properties": {
                    "postcode": {
                        "type": "string"
                    },
                    "area": {
                        "type": "object",
                        "properties": {
                            "district": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "region": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "coverage": {
                        "type": "object",
                        "properties": {
                            "source": {
                                "type": "string"
                            },
                            "status": {
                                "type": "string",
                                "enum": [
                                    "available",
                                    "not_found",
                                    "unavailable"
                                ]
                            },
                            "premises": {
                                "type": "integer"
                            },
                            "superfast_share": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "ultrafast_share": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "highest_predicted_download_mbps": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "lowest_predicted_download_mbps": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "highest_predicted_upload_mbps": {
                                "type": [
                                    "number",
                                    "null"
                                ]
                            },
                            "definitions": {
                                "type": "string"
                            }
                        }
                    },
                    "partners_checked_live": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "compare_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "how_to_get_deals": {
                        "type": "string"
                    },
                    "caveats": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "disclosure": {
                        "type": "string"
                    },
                    "generated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            }
        }
    }
}