{
    "openapi": "3.0.0",
    "info": {
        "title": "JMP WASH data API",
        "description": "API for accessing JMP WASH (Water, Sanitation and Hygiene) data including country, regional, and subnational estimates.",
        "version": "1.0.0"
    },
    "paths": {
        "/v1/{dataSource}/files": {
            "get": {
                "tags": [
                    "Files"
                ],
                "summary": "List uploaded files",
                "description": "Returns a paginated list of uploaded data files with metadata including filename, data source, type, upload date, and status. Supports filtering by file status. Supports CSV export via ?format=csv or Accept: text/csv header.",
                "operationId": "get_list_files",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Maximum number of results to return (default: 10000, max: 50000)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 10000,
                            "maximum": 50000,
                            "minimum": 1
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "description": "Number of results to skip (default: 0)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 0,
                            "minimum": 0
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Filter by file status",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "none",
                                "imported",
                                "processed"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated list of files",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "description": "Query parameters used",
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "description": "Total number of files matching criteria",
                                            "type": "integer"
                                        },
                                        "results": {
                                            "description": "Array of file metadata",
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 123
                                                    },
                                                    "type": {
                                                        "type": "string",
                                                        "example": "est_country"
                                                    },
                                                    "dataSource": {
                                                        "type": "string",
                                                        "example": "household"
                                                    },
                                                    "filename": {
                                                        "type": "string",
                                                        "example": "household_estimates_2023.csv"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "example": "processed"
                                                    },
                                                    "created": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2023-01-15T10:30:00Z"
                                                    },
                                                    "processed": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2023-01-15T11:00:00Z",
                                                        "nullable": true
                                                    },
                                                    "isActive": {
                                                        "type": "boolean",
                                                        "example": true
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "description": "CSV export with columns: id, type, dataSource, filename, status, created, processed, isActive",
                                    "type": "string",
                                    "format": "binary",
                                    "example": "id,type,dataSource,filename,status,created,processed,isActive\n123,est_country,household,household_estimates_2023.csv,processed,2023-01-15T10:30:00Z,2023-01-15T11:00:00Z,1"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/files/{id}": {
            "get": {
                "tags": [
                    "Files"
                ],
                "summary": "Download file as CSV",
                "description": "Downloads the contents of an uploaded file by reconstructing the CSV from database rows. Returns the file with appropriate CSV headers.",
                "operationId": "get_download_file",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "description": "File ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "CSV file content",
                        "headers": {
                            "Content-Disposition": {
                                "description": "Attachment filename",
                                "schema": {
                                    "type": "string",
                                    "example": "attachment; filename=\"household_est_country_data.csv\""
                                }
                            }
                        },
                        "content": {
                            "text/csv": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "File not found"
                    }
                }
            }
        },
        "/v1/{dataSource}/service-levels": {
            "get": {
                "tags": [
                    "Reference Data"
                ],
                "summary": "Get service level definitions",
                "description": "Returns all service level definitions (water, sanitation, hygiene ladders) for data source. Supports CSV export via ?format=csv or Accept: text/csv header. CSV columns: service_type, service_level, ladder, ordering, label_ordering, label, definition.",
                "operationId": "get_service_levels",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "service_type",
                        "in": "query",
                        "description": "Filter by service type",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "Drinking water",
                                "Environmental cleaning",
                                "Health care waste",
                                "Hygiene",
                                "Menstrual Health",
                                "Sanitation",
                                "Water"
                            ]
                        },
                        "example": "Drinking water"
                    },
                    {
                        "name": "service_level",
                        "in": "query",
                        "description": "Filter by service level code",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "Ability to reduce menstruation-related pain",
                                "Alcohol at points of care",
                                "At least basic",
                                "Available",
                                "Awareness of menstruation before menarche",
                                "Basic service",
                                "Cleaning protocols",
                                "Comfort seeking help from a health care provider",
                                "Disposed insitu",
                                "Enough menstrual materials",
                                "Facility",
                                "Faecal sludge treated",
                                "Free from contamination",
                                "Hand hygiene facilities at points of care",
                                "Improved",
                                "Improved and accessible to those with limited mobility",
                                "Improved and available",
                                "Improved and dedicated for staff",
                                "Improved and on premises",
                                "Improved and sex-separated",
                                "Improved and usable",
                                "Improved latrine and other",
                                "Improved with menstrual hygiene",
                                "Insufficient data",
                                "Limited service",
                                "nd_",
                                "No handwashing facility",
                                "No service",
                                "Non-piped improved",
                                "On premises",
                                "Open defecation",
                                "Participation in school, work, social activities during menstruation",
                                "Piped improved",
                                "Private place to wash and change",
                                "Reusable materials",
                                "Safe segregation of waste",
                                "Safe treatment and disposal of infectious waste",
                                "Safe treatment and disposal of sharps",
                                "Safe treatment and disposal of waste",
                                "Safely managed service",
                                "Septic tank",
                                "Sewage treated",
                                "Sewer",
                                "Single-use materials",
                                "Soap and water at points of care",
                                "Soap and water at toilets",
                                "Surface water",
                                "Training on cleaning procedures",
                                "Unimproved",
                                "Use of menstrual materials"
                            ]
                        },
                        "example": "Basic service"
                    },
                    {
                        "name": "ladder",
                        "in": "query",
                        "description": "Filter by ladder type",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "Facility",
                                "Facility type",
                                "Improved",
                                "Safely managed element",
                                "Service element",
                                "Service level"
                            ]
                        },
                        "example": "Service level"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Service level definitions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "description": "Echo of query parameters",
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "type": "integer",
                                            "example": 17
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "service_type": {
                                                        "type": "string",
                                                        "example": "Drinking water"
                                                    },
                                                    "service_level": {
                                                        "type": "string",
                                                        "example": "Basic service"
                                                    },
                                                    "ladder": {
                                                        "type": "string",
                                                        "example": "Service level"
                                                    },
                                                    "ordering": {
                                                        "type": "integer",
                                                        "example": 4
                                                    },
                                                    "label_ordering": {
                                                        "description": "Label display order (defaults to ordering value if not set)",
                                                        "type": "integer",
                                                        "example": 3,
                                                        "nullable": true
                                                    },
                                                    "label": {
                                                        "type": "string",
                                                        "example": "Basic"
                                                    },
                                                    "definition": {
                                                        "type": "string",
                                                        "example": "Improved drinking water source with water available"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "description": "CSV export with columns: service_type, service_level, ladder, ordering, label_ordering, label, definition",
                                    "type": "string",
                                    "format": "binary",
                                    "example": "service_type,service_level,ladder,ordering,label_ordering,label,definition\nDrinking water,Basic service,Service level,4,3,Basic,Improved drinking water source with water available when needed"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/country-regions": {
            "get": {
                "tags": [
                    "Reference Data"
                ],
                "summary": "Get country-region mappings",
                "description": "Returns all countries with their regional classifications (SDG, WHO, UNICEF, income groups, etc.). Supports CSV export via ?format=csv or Accept: text/csv header. CSV columns: iso3, full_name, least_developed_country, landlocked_developed_country, small_island_developing_state, fragile, mdg, sdg, m49, m49_sub, who, unicef_new, unicef_old, unesco_gemr, unesco_uis, income.",
                "operationId": "get_country_regions",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "iso3",
                        "in": "query",
                        "description": "Filter by ISO3 country code(s)",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Country-region mappings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "type": "integer"
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "iso3": {
                                                        "description": "ISO3 country code",
                                                        "type": "string",
                                                        "example": "KEN"
                                                    },
                                                    "full_name": {
                                                        "description": "Full country name",
                                                        "type": "string",
                                                        "example": "Kenya"
                                                    },
                                                    "least_developed_country": {
                                                        "description": "Least Developed Country status",
                                                        "type": "boolean"
                                                    },
                                                    "landlocked_developed_country": {
                                                        "description": "Landlocked Developed Country status",
                                                        "type": "boolean"
                                                    },
                                                    "small_island_developing_state": {
                                                        "description": "Small Island Developing State status",
                                                        "type": "boolean"
                                                    },
                                                    "fragile": {
                                                        "description": "Fragile state status",
                                                        "type": "boolean"
                                                    },
                                                    "mdg": {
                                                        "description": "MDG region",
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "sdg": {
                                                        "description": "SDG region",
                                                        "type": "string",
                                                        "example": "Sub-Saharan Africa"
                                                    },
                                                    "m49": {
                                                        "description": "M49 region",
                                                        "type": "string",
                                                        "example": "Sub-Saharan Africa"
                                                    },
                                                    "m49_sub": {
                                                        "description": "M49 sub-region",
                                                        "type": "string",
                                                        "example": "Middle Africa"
                                                    },
                                                    "who": {
                                                        "description": "WHO region",
                                                        "type": "string",
                                                        "example": "African Region"
                                                    },
                                                    "unicef_new": {
                                                        "description": "UNICEF region (new classification)",
                                                        "type": "string"
                                                    },
                                                    "unicef_old": {
                                                        "description": "UNICEF region (old classification)",
                                                        "type": "string"
                                                    },
                                                    "unesco_gemr": {
                                                        "description": "UNESCO GEMR region (school/healthcare data sources only)",
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "unesco_uis": {
                                                        "description": "UNESCO UIS region (school/healthcare data sources only)",
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "income": {
                                                        "description": "World Bank income group",
                                                        "type": "string",
                                                        "example": "Lower middle income"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "description": "CSV export with columns: iso3, full_name, least_developed_country, landlocked_developed_country, small_island_developing_state, fragile, mdg, sdg, m49, m49_sub, who, unicef_new, unicef_old, unesco_gemr, unesco_uis, income",
                                    "type": "string",
                                    "format": "binary",
                                    "example": "iso3,full_name,least_developed_country,landlocked_developed_country,small_island_developing_state,fragile,mdg,sdg,m49,m49_sub,who,unicef_new,unicef_old,unesco_gemr,unesco_uis,income\nKEN,Kenya,0,0,0,0,Sub-Saharan Africa,Sub-Saharan Africa,Sub-Saharan Africa,Eastern Africa,African Region,Eastern and Southern Africa,Eastern and Southern Africa,,Sub-Saharan Africa,Lower middle income"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/population": {
            "get": {
                "tags": [
                    "Population"
                ],
                "summary": "Get population data",
                "description": "Returns population figures by country, year, and residence type. Supports CSV export via ?format=csv or Accept: text/csv header. CSV columns: country, year, residence_type, population.",
                "operationId": "get_population",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "country",
                        "in": "query",
                        "description": "ISO3 country code(s)",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "KEN"
                    },
                    {
                        "name": "year",
                        "in": "query",
                        "description": "Year(s). Cannot be combined with year_from or year_to. Select \u201c\u2014\u201d when using year_from or year_to.",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "enum": [
                                2000,
                                2001,
                                2002,
                                2003,
                                2004,
                                2005,
                                2006,
                                2007,
                                2008,
                                2009,
                                2010,
                                2011,
                                2012,
                                2013,
                                2014,
                                2015,
                                2016,
                                2017,
                                2018,
                                2019,
                                2020,
                                2021,
                                2022,
                                2023,
                                2024,
                                2025
                            ]
                        },
                        "example": 2022
                    },
                    {
                        "name": "year_from",
                        "in": "query",
                        "description": "Start of year range (inclusive). Cannot be combined with the year parameter. Leave it empty when using year.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2015
                    },
                    {
                        "name": "year_to",
                        "in": "query",
                        "description": "End of year range (inclusive). Cannot be combined with the year parameter. Leave it empty when using year.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2022
                    },
                    {
                        "name": "residence",
                        "in": "query",
                        "description": "Residence type",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "total",
                                "urban",
                                "rural"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Population data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "type": "integer"
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "country": {
                                                        "type": "string",
                                                        "example": "KEN"
                                                    },
                                                    "year": {
                                                        "type": "integer",
                                                        "example": 2022
                                                    },
                                                    "residence_type": {
                                                        "type": "string",
                                                        "example": "total"
                                                    },
                                                    "population": {
                                                        "type": "number",
                                                        "example": 54000000
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/estimates/country": {
            "get": {
                "tags": [
                    "Estimates"
                ],
                "summary": "Get country-level estimates",
                "description": "Returns country-level WASH coverage estimates. Can filter by country, year, residence type, service type/level. Supports filtering by region_type and region to get all countries in a region. Supports CSV export via ?format=csv or Accept: text/csv header. CSV columns: country, year, residence_type, service_type, service_level, value, population.",
                "operationId": "get_country_estimate",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "country[]",
                        "in": "query",
                        "description": "ISO3 country code(s) - supports multiple values. See Reference Data/country-regions for details on country names and their ISO3 codes.",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": [
                            "KEN"
                        ]
                    },
                    {
                        "name": "year[]",
                        "in": "query",
                        "description": "Year(s) - supports multiple values. Cannot be combined with year_from or year_to. Select \u201c\u2014\u201d when using year_from or year_to.",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "integer",
                                "enum": [
                                    2000,
                                    2001,
                                    2002,
                                    2003,
                                    2004,
                                    2005,
                                    2006,
                                    2007,
                                    2008,
                                    2009,
                                    2010,
                                    2011,
                                    2012,
                                    2013,
                                    2014,
                                    2015,
                                    2016,
                                    2017,
                                    2018,
                                    2019,
                                    2020,
                                    2021,
                                    2022,
                                    2023,
                                    2024,
                                    2025
                                ]
                            }
                        },
                        "example": [
                            2023
                        ]
                    },
                    {
                        "name": "year_from",
                        "in": "query",
                        "description": "Start of year range (inclusive). Cannot be combined with the year parameter. Leave it empty when using year.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2015
                    },
                    {
                        "name": "year_to",
                        "in": "query",
                        "description": "End of year range (inclusive). Cannot be combined with the year parameter. Leave it empty when using year.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2023
                    },
                    {
                        "name": "residence[]",
                        "in": "query",
                        "description": "Residence type(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "total",
                                    "urban",
                                    "rural"
                                ]
                            }
                        }
                    },
                    {
                        "name": "service_type[]",
                        "in": "query",
                        "description": "Service type(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "Drinking water",
                                    "Environmental cleaning",
                                    "Health care waste",
                                    "Hygiene",
                                    "Menstrual Health",
                                    "Sanitation",
                                    "Water"
                                ]
                            }
                        },
                        "example": [
                            "Hygiene"
                        ]
                    },
                    {
                        "name": "service_level[]",
                        "in": "query",
                        "description": "Service level(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "Ability to reduce menstruation-related pain",
                                    "Alcohol at points of care",
                                    "At least basic",
                                    "Available",
                                    "Awareness of menstruation before menarche",
                                    "Basic service",
                                    "Cleaning protocols",
                                    "Comfort seeking help from a health care provider",
                                    "Disposed insitu",
                                    "Enough menstrual materials",
                                    "Facility",
                                    "Faecal sludge treated",
                                    "Free from contamination",
                                    "Hand hygiene facilities at points of care",
                                    "Improved",
                                    "Improved and accessible to those with limited mobility",
                                    "Improved and available",
                                    "Improved and dedicated for staff",
                                    "Improved and on premises",
                                    "Improved and sex-separated",
                                    "Improved and usable",
                                    "Improved latrine and other",
                                    "Improved with menstrual hygiene",
                                    "Insufficient data",
                                    "Limited service",
                                    "nd_",
                                    "No handwashing facility",
                                    "No service",
                                    "Non-piped improved",
                                    "On premises",
                                    "Open defecation",
                                    "Participation in school, work, social activities during menstruation",
                                    "Piped improved",
                                    "Private place to wash and change",
                                    "Reusable materials",
                                    "Safe segregation of waste",
                                    "Safe treatment and disposal of infectious waste",
                                    "Safe treatment and disposal of sharps",
                                    "Safe treatment and disposal of waste",
                                    "Safely managed service",
                                    "Septic tank",
                                    "Sewage treated",
                                    "Sewer",
                                    "Single-use materials",
                                    "Soap and water at points of care",
                                    "Soap and water at toilets",
                                    "Surface water",
                                    "Training on cleaning procedures",
                                    "Unimproved",
                                    "Use of menstrual materials"
                                ]
                            }
                        },
                        "example": [
                            "No service"
                        ]
                    },
                    {
                        "name": "region_type",
                        "in": "query",
                        "description": "Region type for filtering (use with region param)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "au_all",
                                "au_subreg",
                                "c_caribbean_cwwa",
                                "fragile",
                                "fragileoecd",
                                "income",
                                "ldc",
                                "lldc",
                                "lmic",
                                "m49",
                                "m49_sub",
                                "mdg",
                                "sdg",
                                "sids",
                                "unesco_uis",
                                "unicef_eap_asean",
                                "unicef_humanitarian",
                                "unicef_new",
                                "unicef_old",
                                "unicef_other_ssa",
                                "wb_afe",
                                "wb_afw",
                                "wb_arb",
                                "wb_ceb",
                                "wb_css",
                                "wb_eap",
                                "wb_ear",
                                "wb_eas",
                                "wb_eca",
                                "wb_ecs",
                                "wb_emu",
                                "wb_euu",
                                "wb_hic",
                                "wb_hpc",
                                "wb_ibd",
                                "wb_ibt",
                                "wb_ida",
                                "wb_idb",
                                "wb_idx",
                                "wb_lac",
                                "wb_lcn",
                                "wb_ldc",
                                "wb_lic",
                                "wb_lmc",
                                "wb_lte",
                                "wb_mic",
                                "wb_nac",
                                "wb_oecd",
                                "wb_oss",
                                "wb_pre",
                                "wb_pss",
                                "wb_pst",
                                "wb_sas",
                                "wb_ssa",
                                "wb_ssf",
                                "wb_sst",
                                "wb_tea",
                                "wb_tec",
                                "wb_tla",
                                "wb_tsa",
                                "wb_tss",
                                "wb_umc",
                                "wb_world",
                                "who",
                                "who_legal_status",
                                "world"
                            ]
                        },
                        "example": "world"
                    },
                    {
                        "name": "region",
                        "in": "query",
                        "description": "Region name (requires region_type)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                " Arab States",
                                " Central and Eastern Europe",
                                " Central Asia",
                                " East Asia and the Pacific",
                                " Latin America and the Caribbean",
                                " North America and Western Europe",
                                " South and West Asia",
                                " Sub-Saharan Africa",
                                "A",
                                "Africa",
                                "Africa Eastern and Southern",
                                "Africa Western and Central",
                                "African Union (n=55)",
                                "Americas",
                                "Arab World",
                                "Asia",
                                "Association of Southeast Asian Nations (ASEAN)",
                                "Australia and New Zealand",
                                "Caribbean",
                                "Caribbean (CWWA)",
                                "Caribbean small states",
                                "Central Africa",
                                "Central America",
                                "Central and Southern Asia",
                                "Central Asia",
                                "Central Europe and the Baltics",
                                "Developed regions",
                                "Developing regions",
                                "E",
                                "Early-demographic dividend",
                                "East Asia & Pacific",
                                "East Asia & Pacific (excluding high income)",
                                "East Asia & Pacific (IDA & IBRD)",
                                "East Asia and Pacific",
                                "Eastern Africa",
                                "Eastern and South-Eastern Asia",
                                "Eastern and Southern Africa",
                                "Eastern Asia",
                                "Eastern Europe",
                                "Eastern Mediterranean",
                                "Euro area",
                                "Europe",
                                "Europe & Central Asia",
                                "Europe & Central Asia (excluding high income)",
                                "Europe & Central Asia (IDA & IBRD)",
                                "Europe and Central Asia",
                                "Europe and Northern America",
                                "European Union",
                                "Extremely fragile",
                                "Fragile Contexts",
                                "Heavily indebted poor countries (HIPC)",
                                "High income",
                                "IBRD only",
                                "IDA & IBRD total",
                                "IDA blend",
                                "IDA only",
                                "IDA total",
                                "Landlocked Developing Countries",
                                "Late-demographic dividend",
                                "Latin America & Caribbean",
                                "Latin America & Caribbean (excluding high income)",
                                "Latin America & Caribbean (IDA & IBRD)",
                                "Latin America and Caribbean",
                                "Latin America and the Caribbean",
                                "Least Developed Countries",
                                "Least developed countries: UN classification",
                                "Low & middle income",
                                "Low income",
                                "Lower middle income",
                                "M",
                                "Melanesia",
                                "Micronesia",
                                "Middle Africa",
                                "Middle East and North Africa",
                                "Middle income",
                                "N",
                                "North America",
                                "Northern Africa",
                                "Northern Africa and Western Asia",
                                "Northern America",
                                "Northern Europe",
                                "Oceania",
                                "OECD members",
                                "Other",
                                "Other fragile",
                                "Other small states",
                                "Pacific island small states",
                                "Polynesia",
                                "Post-demographic dividend",
                                "Pre-demographic dividend",
                                "Small Island Developing States",
                                "Small states",
                                "South America",
                                "South Asia",
                                "South Asia (IDA & IBRD)",
                                "South-East Asia",
                                "South-eastern Asia",
                                "Southern Africa",
                                "Southern Asia",
                                "Southern Europe",
                                "Sub-Saharan Africa",
                                "Sub-Saharan Africa (excluding high income)",
                                "Sub-Saharan Africa (IDA & IBRD)",
                                "T",
                                "UNICEF Humanitarian",
                                "Upper middle income",
                                "West and Central Africa",
                                "Western Africa",
                                "Western Asia",
                                "Western Europe",
                                "Western Pacific",
                                "World",
                                "World (World Bank)"
                            ]
                        },
                        "example": "World"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Maximum number of results per page (default 10000, max 50000)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 10000,
                            "maximum": 50000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "description": "Number of results to skip for pagination (default 0)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Country estimates with calculated population",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "description": "Echo of applied filters",
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "description": "Number of results in this page",
                                            "type": "integer",
                                            "example": 116
                                        },
                                        "total_count": {
                                            "description": "Total number of matching results across all pages",
                                            "type": "integer",
                                            "example": 300000
                                        },
                                        "limit": {
                                            "type": "integer",
                                            "example": 10000
                                        },
                                        "offset": {
                                            "type": "integer",
                                            "example": 0
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "country": {
                                                        "type": "string",
                                                        "example": "AGO"
                                                    },
                                                    "year": {
                                                        "type": "integer",
                                                        "example": 2023
                                                    },
                                                    "residence_type": {
                                                        "type": "string",
                                                        "example": "total"
                                                    },
                                                    "service_type": {
                                                        "type": "string",
                                                        "example": "Hygiene"
                                                    },
                                                    "service_level": {
                                                        "type": "string",
                                                        "example": "No service"
                                                    },
                                                    "value": {
                                                        "type": "number",
                                                        "example": 12.969049999999999300825948012061417102813720703125
                                                    },
                                                    "population": {
                                                        "type": "number",
                                                        "example": 1633019.07000000006519258022308349609375
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "description": "CSV export with columns: country, year, residence_type, service_type, service_level, value, population",
                                    "type": "string",
                                    "format": "binary",
                                    "example": "country,year,residence_type,service_type,service_level,value,population\nAGO,2023,total,Hygiene,No service,12.96905,1633019.07"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/country-subregions": {
            "get": {
                "tags": [
                    "Reference Data"
                ],
                "summary": "Get country subregions",
                "description": "Returns a flat list of distinct subnational regions with their associated country ISO3 code. Only includes subregions from active data files for the given data source. Supports filtering by one or more country ISO3 codes. Supports CSV export via ?format=csv or Accept: text/csv header.",
                "operationId": "get_country_subregions",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "country[]",
                        "in": "query",
                        "description": "ISO3 country code(s) to filter by \u2014 supports multiple values. See Reference Data/country-regions for details on country names and their ISO3 codes.",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": [
                            "IND"
                        ]
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of distinct subnational regions with their country ISO3 code",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "description": "Echo of applied filters",
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "type": "integer",
                                            "example": 36
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "iso3": {
                                                        "description": "ISO3 country code",
                                                        "type": "string",
                                                        "example": "IND"
                                                    },
                                                    "region_name": {
                                                        "description": "Subnational region name",
                                                        "type": "string",
                                                        "example": "Maharashtra"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "description": "CSV export with columns: iso3, region_name",
                                    "type": "string",
                                    "format": "binary",
                                    "example": "iso3,region_name\nIND,Maharashtra"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/estimates/region": {
            "get": {
                "tags": [
                    "Estimates"
                ],
                "summary": "Get region-level estimates",
                "description": "Returns regional aggregate WASH coverage estimates (e.g., SDG regions, WHO regions, income groups). Supports CSV export via ?format=csv or Accept: text/csv header.",
                "operationId": "get_region_estimate",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "region_type[]",
                        "in": "query",
                        "description": "Region classification type(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "au_all",
                                    "au_subreg",
                                    "c_caribbean_cwwa",
                                    "fragile",
                                    "fragileoecd",
                                    "income",
                                    "ldc",
                                    "lldc",
                                    "lmic",
                                    "m49",
                                    "m49_sub",
                                    "mdg",
                                    "sdg",
                                    "sids",
                                    "unesco_uis",
                                    "unicef_eap_asean",
                                    "unicef_humanitarian",
                                    "unicef_new",
                                    "unicef_old",
                                    "unicef_other_ssa",
                                    "wb_afe",
                                    "wb_afw",
                                    "wb_arb",
                                    "wb_ceb",
                                    "wb_css",
                                    "wb_eap",
                                    "wb_ear",
                                    "wb_eas",
                                    "wb_eca",
                                    "wb_ecs",
                                    "wb_emu",
                                    "wb_euu",
                                    "wb_hic",
                                    "wb_hpc",
                                    "wb_ibd",
                                    "wb_ibt",
                                    "wb_ida",
                                    "wb_idb",
                                    "wb_idx",
                                    "wb_lac",
                                    "wb_lcn",
                                    "wb_ldc",
                                    "wb_lic",
                                    "wb_lmc",
                                    "wb_lte",
                                    "wb_mic",
                                    "wb_nac",
                                    "wb_oecd",
                                    "wb_oss",
                                    "wb_pre",
                                    "wb_pss",
                                    "wb_pst",
                                    "wb_sas",
                                    "wb_ssa",
                                    "wb_ssf",
                                    "wb_sst",
                                    "wb_tea",
                                    "wb_tec",
                                    "wb_tla",
                                    "wb_tsa",
                                    "wb_tss",
                                    "wb_umc",
                                    "wb_world",
                                    "who",
                                    "who_legal_status",
                                    "world"
                                ]
                            }
                        },
                        "example": [
                            "world"
                        ]
                    },
                    {
                        "name": "region[]",
                        "in": "query",
                        "description": "Specific region name(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    " Arab States",
                                    " Central and Eastern Europe",
                                    " Central Asia",
                                    " East Asia and the Pacific",
                                    " Latin America and the Caribbean",
                                    " North America and Western Europe",
                                    " South and West Asia",
                                    " Sub-Saharan Africa",
                                    "A",
                                    "Africa",
                                    "Africa Eastern and Southern",
                                    "Africa Western and Central",
                                    "African Union (n=55)",
                                    "Americas",
                                    "Arab World",
                                    "Asia",
                                    "Association of Southeast Asian Nations (ASEAN)",
                                    "Australia and New Zealand",
                                    "Caribbean",
                                    "Caribbean (CWWA)",
                                    "Caribbean small states",
                                    "Central Africa",
                                    "Central America",
                                    "Central and Southern Asia",
                                    "Central Asia",
                                    "Central Europe and the Baltics",
                                    "Developed regions",
                                    "Developing regions",
                                    "E",
                                    "Early-demographic dividend",
                                    "East Asia & Pacific",
                                    "East Asia & Pacific (excluding high income)",
                                    "East Asia & Pacific (IDA & IBRD)",
                                    "East Asia and Pacific",
                                    "Eastern Africa",
                                    "Eastern and South-Eastern Asia",
                                    "Eastern and Southern Africa",
                                    "Eastern Asia",
                                    "Eastern Europe",
                                    "Eastern Mediterranean",
                                    "Euro area",
                                    "Europe",
                                    "Europe & Central Asia",
                                    "Europe & Central Asia (excluding high income)",
                                    "Europe & Central Asia (IDA & IBRD)",
                                    "Europe and Central Asia",
                                    "Europe and Northern America",
                                    "European Union",
                                    "Extremely fragile",
                                    "Fragile Contexts",
                                    "Heavily indebted poor countries (HIPC)",
                                    "High income",
                                    "IBRD only",
                                    "IDA & IBRD total",
                                    "IDA blend",
                                    "IDA only",
                                    "IDA total",
                                    "Landlocked Developing Countries",
                                    "Late-demographic dividend",
                                    "Latin America & Caribbean",
                                    "Latin America & Caribbean (excluding high income)",
                                    "Latin America & Caribbean (IDA & IBRD)",
                                    "Latin America and Caribbean",
                                    "Latin America and the Caribbean",
                                    "Least Developed Countries",
                                    "Least developed countries: UN classification",
                                    "Low & middle income",
                                    "Low income",
                                    "Lower middle income",
                                    "M",
                                    "Melanesia",
                                    "Micronesia",
                                    "Middle Africa",
                                    "Middle East and North Africa",
                                    "Middle income",
                                    "N",
                                    "North America",
                                    "Northern Africa",
                                    "Northern Africa and Western Asia",
                                    "Northern America",
                                    "Northern Europe",
                                    "Oceania",
                                    "OECD members",
                                    "Other",
                                    "Other fragile",
                                    "Other small states",
                                    "Pacific island small states",
                                    "Polynesia",
                                    "Post-demographic dividend",
                                    "Pre-demographic dividend",
                                    "Small Island Developing States",
                                    "Small states",
                                    "South America",
                                    "South Asia",
                                    "South Asia (IDA & IBRD)",
                                    "South-East Asia",
                                    "South-eastern Asia",
                                    "Southern Africa",
                                    "Southern Asia",
                                    "Southern Europe",
                                    "Sub-Saharan Africa",
                                    "Sub-Saharan Africa (excluding high income)",
                                    "Sub-Saharan Africa (IDA & IBRD)",
                                    "T",
                                    "UNICEF Humanitarian",
                                    "Upper middle income",
                                    "West and Central Africa",
                                    "Western Africa",
                                    "Western Asia",
                                    "Western Europe",
                                    "Western Pacific",
                                    "World",
                                    "World (World Bank)"
                                ]
                            }
                        },
                        "example": [
                            "World"
                        ]
                    },
                    {
                        "name": "year[]",
                        "in": "query",
                        "description": "Year(s) - supports multiple values. Cannot be combined with year_from or year_to. Select \u201c\u2014\u201d when using year_from or year_to.",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "integer",
                                "enum": [
                                    2000,
                                    2001,
                                    2002,
                                    2003,
                                    2004,
                                    2005,
                                    2006,
                                    2007,
                                    2008,
                                    2009,
                                    2010,
                                    2011,
                                    2012,
                                    2013,
                                    2014,
                                    2015,
                                    2016,
                                    2017,
                                    2018,
                                    2019,
                                    2020,
                                    2021,
                                    2022,
                                    2023,
                                    2024,
                                    2025
                                ]
                            }
                        },
                        "example": [
                            2023
                        ]
                    },
                    {
                        "name": "year_from",
                        "in": "query",
                        "description": "Start of year range (inclusive). Cannot be combined with the year parameter. Leave it empty when using year.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2015
                    },
                    {
                        "name": "year_to",
                        "in": "query",
                        "description": "End of year range (inclusive). Cannot be combined with the year parameter. Leave it empty when using year.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2023
                    },
                    {
                        "name": "residence[]",
                        "in": "query",
                        "description": "Residence type(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "total",
                                    "urban",
                                    "rural"
                                ]
                            }
                        }
                    },
                    {
                        "name": "service_type[]",
                        "in": "query",
                        "description": "Service type(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "Drinking water",
                                    "Environmental cleaning",
                                    "Health care waste",
                                    "Hygiene",
                                    "Menstrual Health",
                                    "Sanitation",
                                    "Water"
                                ]
                            }
                        },
                        "example": [
                            "Drinking water"
                        ]
                    },
                    {
                        "name": "service_level[]",
                        "in": "query",
                        "description": "Service level(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "Ability to reduce menstruation-related pain",
                                    "Alcohol at points of care",
                                    "At least basic",
                                    "Available",
                                    "Awareness of menstruation before menarche",
                                    "Basic service",
                                    "Cleaning protocols",
                                    "Comfort seeking help from a health care provider",
                                    "Disposed insitu",
                                    "Enough menstrual materials",
                                    "Facility",
                                    "Faecal sludge treated",
                                    "Free from contamination",
                                    "Hand hygiene facilities at points of care",
                                    "Improved",
                                    "Improved and accessible to those with limited mobility",
                                    "Improved and available",
                                    "Improved and dedicated for staff",
                                    "Improved and on premises",
                                    "Improved and sex-separated",
                                    "Improved and usable",
                                    "Improved latrine and other",
                                    "Improved with menstrual hygiene",
                                    "Insufficient data",
                                    "Limited service",
                                    "nd_",
                                    "No handwashing facility",
                                    "No service",
                                    "Non-piped improved",
                                    "On premises",
                                    "Open defecation",
                                    "Participation in school, work, social activities during menstruation",
                                    "Piped improved",
                                    "Private place to wash and change",
                                    "Reusable materials",
                                    "Safe segregation of waste",
                                    "Safe treatment and disposal of infectious waste",
                                    "Safe treatment and disposal of sharps",
                                    "Safe treatment and disposal of waste",
                                    "Safely managed service",
                                    "Septic tank",
                                    "Sewage treated",
                                    "Sewer",
                                    "Single-use materials",
                                    "Soap and water at points of care",
                                    "Soap and water at toilets",
                                    "Surface water",
                                    "Training on cleaning procedures",
                                    "Unimproved",
                                    "Use of menstrual materials"
                                ]
                            }
                        },
                        "example": [
                            "Basic service"
                        ]
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Maximum number of results per page (default 10000, max 50000)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 10000,
                            "maximum": 50000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "description": "Number of results to skip for pagination (default 0)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Region estimates with calculated population",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "description": "Number of results in this page",
                                            "type": "integer",
                                            "example": 9
                                        },
                                        "total_count": {
                                            "description": "Total number of matching results across all pages",
                                            "type": "integer",
                                            "example": 5000
                                        },
                                        "limit": {
                                            "type": "integer",
                                            "example": 10000
                                        },
                                        "offset": {
                                            "type": "integer",
                                            "example": 0
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "region_type": {
                                                        "type": "string",
                                                        "example": "world"
                                                    },
                                                    "region": {
                                                        "type": "string",
                                                        "example": "World"
                                                    },
                                                    "year": {
                                                        "type": "integer",
                                                        "example": 2023
                                                    },
                                                    "residence_type": {
                                                        "type": "string",
                                                        "example": "total"
                                                    },
                                                    "service_type": {
                                                        "type": "string",
                                                        "example": "Hygiene"
                                                    },
                                                    "service_level": {
                                                        "type": "string",
                                                        "example": "Basic service"
                                                    },
                                                    "value": {
                                                        "type": "number",
                                                        "example": 66.65798187255859375
                                                    },
                                                    "population": {
                                                        "type": "number",
                                                        "example": 1291235745.0016906261444091796875
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "description": "CSV export with columns: region_type, region, year, residence_type, service_type, service_level, value, population",
                                    "type": "string",
                                    "format": "binary",
                                    "example": "region_type,region,year,residence_type,service_type,service_level,value,population\nworld,World,2023,total,Hygiene,Basic service,66.6579818725586,1291235745.0016906"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/estimates/subnational": {
            "get": {
                "tags": [
                    "Estimates"
                ],
                "summary": "Get subnational estimates",
                "description": "Returns subnational/provincial WASH coverage estimates. Use by_country=range to get inequality range metrics, or any other truthy value to get average inequality metrics aggregated by country. Supports CSV export via ?format=csv or Accept: text/csv header.",
                "operationId": "get_subnational_estimate",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "country[]",
                        "in": "query",
                        "description": "ISO3 country code(s) - supports multiple values. See Reference Data/country-regions for details on country names and their ISO3 codes.",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": [
                            "IND"
                        ]
                    },
                    {
                        "name": "year[]",
                        "in": "query",
                        "description": "Year(s) - supports multiple values. Cannot be combined with year_from or year_to. Select \u201c\u2014\u201d when using year_from or year_to.",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "integer",
                                "enum": [
                                    2000,
                                    2001,
                                    2002,
                                    2003,
                                    2004,
                                    2005,
                                    2006,
                                    2007,
                                    2008,
                                    2009,
                                    2010,
                                    2011,
                                    2012,
                                    2013,
                                    2014,
                                    2015,
                                    2016,
                                    2017,
                                    2018,
                                    2019,
                                    2020,
                                    2021,
                                    2022,
                                    2023,
                                    2024,
                                    2025
                                ]
                            }
                        },
                        "example": [
                            2022
                        ]
                    },
                    {
                        "name": "year_from",
                        "in": "query",
                        "description": "Start of year range (inclusive). Cannot be combined with the year parameter. Ignored when latest is set.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2015
                    },
                    {
                        "name": "year_to",
                        "in": "query",
                        "description": "End of year range (inclusive). Cannot be combined with the year parameter. Ignored when latest is set.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2022
                    },
                    {
                        "name": "service_type[]",
                        "in": "query",
                        "description": "Service type(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "Drinking water",
                                    "Environmental cleaning",
                                    "Health care waste",
                                    "Hygiene",
                                    "Menstrual Health",
                                    "Sanitation",
                                    "Water"
                                ]
                            }
                        },
                        "example": [
                            "Drinking water"
                        ]
                    },
                    {
                        "name": "service_level[]",
                        "in": "query",
                        "description": "Service level(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "Ability to reduce menstruation-related pain",
                                    "Alcohol at points of care",
                                    "At least basic",
                                    "Available",
                                    "Awareness of menstruation before menarche",
                                    "Basic service",
                                    "Cleaning protocols",
                                    "Comfort seeking help from a health care provider",
                                    "Disposed insitu",
                                    "Enough menstrual materials",
                                    "Facility",
                                    "Faecal sludge treated",
                                    "Free from contamination",
                                    "Hand hygiene facilities at points of care",
                                    "Improved",
                                    "Improved and accessible to those with limited mobility",
                                    "Improved and available",
                                    "Improved and dedicated for staff",
                                    "Improved and on premises",
                                    "Improved and sex-separated",
                                    "Improved and usable",
                                    "Improved latrine and other",
                                    "Improved with menstrual hygiene",
                                    "Insufficient data",
                                    "Limited service",
                                    "nd_",
                                    "No handwashing facility",
                                    "No service",
                                    "Non-piped improved",
                                    "On premises",
                                    "Open defecation",
                                    "Participation in school, work, social activities during menstruation",
                                    "Piped improved",
                                    "Private place to wash and change",
                                    "Reusable materials",
                                    "Safe segregation of waste",
                                    "Safe treatment and disposal of infectious waste",
                                    "Safe treatment and disposal of sharps",
                                    "Safe treatment and disposal of waste",
                                    "Safely managed service",
                                    "Septic tank",
                                    "Sewage treated",
                                    "Sewer",
                                    "Single-use materials",
                                    "Soap and water at points of care",
                                    "Soap and water at toilets",
                                    "Surface water",
                                    "Training on cleaning procedures",
                                    "Unimproved",
                                    "Use of menstrual materials"
                                ]
                            }
                        },
                        "example": [
                            "Basic service"
                        ]
                    },
                    {
                        "name": "by_country",
                        "in": "query",
                        "description": "Aggregation mode: \"range\" returns max-min difference, any other truthy value returns average. When set, response shape changes (no residence_type, region_name, or survey_code)",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "average"
                    },
                    {
                        "name": "region_type",
                        "in": "query",
                        "description": "Filter by region type (use with region)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "au_all",
                                "au_subreg",
                                "c_caribbean_cwwa",
                                "fragile",
                                "fragileoecd",
                                "income",
                                "ldc",
                                "lldc",
                                "lmic",
                                "m49",
                                "m49_sub",
                                "mdg",
                                "sdg",
                                "sids",
                                "unesco_uis",
                                "unicef_eap_asean",
                                "unicef_humanitarian",
                                "unicef_new",
                                "unicef_old",
                                "unicef_other_ssa",
                                "wb_afe",
                                "wb_afw",
                                "wb_arb",
                                "wb_ceb",
                                "wb_css",
                                "wb_eap",
                                "wb_ear",
                                "wb_eas",
                                "wb_eca",
                                "wb_ecs",
                                "wb_emu",
                                "wb_euu",
                                "wb_hic",
                                "wb_hpc",
                                "wb_ibd",
                                "wb_ibt",
                                "wb_ida",
                                "wb_idb",
                                "wb_idx",
                                "wb_lac",
                                "wb_lcn",
                                "wb_ldc",
                                "wb_lic",
                                "wb_lmc",
                                "wb_lte",
                                "wb_mic",
                                "wb_nac",
                                "wb_oecd",
                                "wb_oss",
                                "wb_pre",
                                "wb_pss",
                                "wb_pst",
                                "wb_sas",
                                "wb_ssa",
                                "wb_ssf",
                                "wb_sst",
                                "wb_tea",
                                "wb_tec",
                                "wb_tla",
                                "wb_tsa",
                                "wb_tss",
                                "wb_umc",
                                "wb_world",
                                "who",
                                "who_legal_status",
                                "world"
                            ]
                        },
                        "example": "sdg"
                    },
                    {
                        "name": "region",
                        "in": "query",
                        "description": "Filter by region name",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                " Arab States",
                                " Central and Eastern Europe",
                                " Central Asia",
                                " East Asia and the Pacific",
                                " Latin America and the Caribbean",
                                " North America and Western Europe",
                                " South and West Asia",
                                " Sub-Saharan Africa",
                                "A",
                                "Africa",
                                "Africa Eastern and Southern",
                                "Africa Western and Central",
                                "African Union (n=55)",
                                "Americas",
                                "Arab World",
                                "Asia",
                                "Association of Southeast Asian Nations (ASEAN)",
                                "Australia and New Zealand",
                                "Caribbean",
                                "Caribbean (CWWA)",
                                "Caribbean small states",
                                "Central Africa",
                                "Central America",
                                "Central and Southern Asia",
                                "Central Asia",
                                "Central Europe and the Baltics",
                                "Developed regions",
                                "Developing regions",
                                "E",
                                "Early-demographic dividend",
                                "East Asia & Pacific",
                                "East Asia & Pacific (excluding high income)",
                                "East Asia & Pacific (IDA & IBRD)",
                                "East Asia and Pacific",
                                "Eastern Africa",
                                "Eastern and South-Eastern Asia",
                                "Eastern and Southern Africa",
                                "Eastern Asia",
                                "Eastern Europe",
                                "Eastern Mediterranean",
                                "Euro area",
                                "Europe",
                                "Europe & Central Asia",
                                "Europe & Central Asia (excluding high income)",
                                "Europe & Central Asia (IDA & IBRD)",
                                "Europe and Central Asia",
                                "Europe and Northern America",
                                "European Union",
                                "Extremely fragile",
                                "Fragile Contexts",
                                "Heavily indebted poor countries (HIPC)",
                                "High income",
                                "IBRD only",
                                "IDA & IBRD total",
                                "IDA blend",
                                "IDA only",
                                "IDA total",
                                "Landlocked Developing Countries",
                                "Late-demographic dividend",
                                "Latin America & Caribbean",
                                "Latin America & Caribbean (excluding high income)",
                                "Latin America & Caribbean (IDA & IBRD)",
                                "Latin America and Caribbean",
                                "Latin America and the Caribbean",
                                "Least Developed Countries",
                                "Least developed countries: UN classification",
                                "Low & middle income",
                                "Low income",
                                "Lower middle income",
                                "M",
                                "Melanesia",
                                "Micronesia",
                                "Middle Africa",
                                "Middle East and North Africa",
                                "Middle income",
                                "N",
                                "North America",
                                "Northern Africa",
                                "Northern Africa and Western Asia",
                                "Northern America",
                                "Northern Europe",
                                "Oceania",
                                "OECD members",
                                "Other",
                                "Other fragile",
                                "Other small states",
                                "Pacific island small states",
                                "Polynesia",
                                "Post-demographic dividend",
                                "Pre-demographic dividend",
                                "Small Island Developing States",
                                "Small states",
                                "South America",
                                "South Asia",
                                "South Asia (IDA & IBRD)",
                                "South-East Asia",
                                "South-eastern Asia",
                                "Southern Africa",
                                "Southern Asia",
                                "Southern Europe",
                                "Sub-Saharan Africa",
                                "Sub-Saharan Africa (excluding high income)",
                                "Sub-Saharan Africa (IDA & IBRD)",
                                "T",
                                "UNICEF Humanitarian",
                                "Upper middle income",
                                "West and Central Africa",
                                "Western Africa",
                                "Western Asia",
                                "Western Europe",
                                "Western Pacific",
                                "World",
                                "World (World Bank)"
                            ]
                        },
                        "example": "Sub-Saharan Africa"
                    },
                    {
                        "name": "region_name[]",
                        "in": "query",
                        "description": "Filter by subnational region name(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": [
                            "Maharashtra"
                        ]
                    },
                    {
                        "name": "survey_code[]",
                        "in": "query",
                        "description": "Filter by survey identifier(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": [
                            "DHS2019"
                        ]
                    },
                    {
                        "name": "latest",
                        "in": "query",
                        "description": "If set to any value, only returns estimates from the latest survey. The year, year_from, and year_to parameters are all ignored when latest is used.",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        },
                        "example": true
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Maximum number of results per page (default 10000, max 50000)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 10000,
                            "maximum": 50000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "description": "Number of results to skip for pagination (default 0)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Subnational estimates",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "description": "Number of results in this page",
                                            "type": "integer"
                                        },
                                        "total_count": {
                                            "description": "Total number of matching results across all pages",
                                            "type": "integer"
                                        },
                                        "limit": {
                                            "type": "integer",
                                            "example": 10000
                                        },
                                        "offset": {
                                            "type": "integer",
                                            "example": 0
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "country": {
                                                        "type": "string",
                                                        "example": "IND"
                                                    },
                                                    "region_name": {
                                                        "type": "string",
                                                        "example": "Maharashtra"
                                                    },
                                                    "year": {
                                                        "type": "integer",
                                                        "example": 2019
                                                    },
                                                    "survey_code": {
                                                        "type": "string",
                                                        "example": "DHS2019"
                                                    },
                                                    "latest_survey": {
                                                        "type": "boolean",
                                                        "example": true
                                                    },
                                                    "service_type": {
                                                        "type": "string",
                                                        "example": "Drinking water"
                                                    },
                                                    "service_level": {
                                                        "type": "string",
                                                        "example": "Basic service"
                                                    },
                                                    "value": {
                                                        "type": "number",
                                                        "example": 78.2999999999999971578290569595992565155029296875
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "description": "CSV export with columns: country, region_name, year, survey_code, latest_survey, service_type, service_level, value (or country, service_type, service_level, year, min, max, range, avg when by_country is used)",
                                    "type": "string",
                                    "format": "binary",
                                    "example": "country,region_name,year,survey_code,latest_survey,service_type,service_level,value\nIND,Maharashtra,2019,DHS2019,1,Drinking water,Basic service,78.3"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/estimates/quintile": {
            "get": {
                "tags": [
                    "Estimates"
                ],
                "summary": "Get quintile estimates",
                "description": "Returns wealth quintile disaggregated estimates. Only available for household data source. Supports CSV export via ?format=csv or Accept: text/csv header.",
                "operationId": "get_quintile_estimate",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Must be \"household\" for quintile data",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household"
                            ]
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "description": "Response format (json or csv)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "json",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    },
                    {
                        "name": "country[]",
                        "in": "query",
                        "description": "ISO3 country code(s) - supports multiple values. See Reference Data/country-regions for details on country names and their ISO3 codes.",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": [
                            "NGA"
                        ]
                    },
                    {
                        "name": "year[]",
                        "in": "query",
                        "description": "Year(s) - supports multiple values. Cannot be combined with year_from or year_to. Select \u201c\u2014\u201d when using year_from or year_to.",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "integer",
                                "enum": [
                                    2000,
                                    2001,
                                    2002,
                                    2003,
                                    2004,
                                    2005,
                                    2006,
                                    2007,
                                    2008,
                                    2009,
                                    2010,
                                    2011,
                                    2012,
                                    2013,
                                    2014,
                                    2015,
                                    2016,
                                    2017,
                                    2018,
                                    2019,
                                    2020,
                                    2021,
                                    2022,
                                    2023,
                                    2024,
                                    2025
                                ]
                            }
                        },
                        "example": [
                            2022
                        ]
                    },
                    {
                        "name": "year_from",
                        "in": "query",
                        "description": "Start of year range (inclusive). Cannot be combined with the year parameter. Ignored when latest is set.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2015
                    },
                    {
                        "name": "year_to",
                        "in": "query",
                        "description": "End of year range (inclusive). Cannot be combined with the year parameter. Ignored when latest is set.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "example": 2022
                    },
                    {
                        "name": "residence[]",
                        "in": "query",
                        "description": "Residence type(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "total",
                                    "urban",
                                    "rural"
                                ]
                            }
                        }
                    },
                    {
                        "name": "service_type[]",
                        "in": "query",
                        "description": "Service type(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "Drinking water",
                                    "Environmental cleaning",
                                    "Health care waste",
                                    "Hygiene",
                                    "Menstrual Health",
                                    "Sanitation",
                                    "Water"
                                ]
                            }
                        },
                        "example": [
                            "Drinking water"
                        ]
                    },
                    {
                        "name": "service_level[]",
                        "in": "query",
                        "description": "Service level(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "Ability to reduce menstruation-related pain",
                                    "Alcohol at points of care",
                                    "At least basic",
                                    "Available",
                                    "Awareness of menstruation before menarche",
                                    "Basic service",
                                    "Cleaning protocols",
                                    "Comfort seeking help from a health care provider",
                                    "Disposed insitu",
                                    "Enough menstrual materials",
                                    "Facility",
                                    "Faecal sludge treated",
                                    "Free from contamination",
                                    "Hand hygiene facilities at points of care",
                                    "Improved",
                                    "Improved and accessible to those with limited mobility",
                                    "Improved and available",
                                    "Improved and dedicated for staff",
                                    "Improved and on premises",
                                    "Improved and sex-separated",
                                    "Improved and usable",
                                    "Improved latrine and other",
                                    "Improved with menstrual hygiene",
                                    "Insufficient data",
                                    "Limited service",
                                    "nd_",
                                    "No handwashing facility",
                                    "No service",
                                    "Non-piped improved",
                                    "On premises",
                                    "Open defecation",
                                    "Participation in school, work, social activities during menstruation",
                                    "Piped improved",
                                    "Private place to wash and change",
                                    "Reusable materials",
                                    "Safe segregation of waste",
                                    "Safe treatment and disposal of infectious waste",
                                    "Safe treatment and disposal of sharps",
                                    "Safe treatment and disposal of waste",
                                    "Safely managed service",
                                    "Septic tank",
                                    "Sewage treated",
                                    "Sewer",
                                    "Single-use materials",
                                    "Soap and water at points of care",
                                    "Soap and water at toilets",
                                    "Surface water",
                                    "Training on cleaning procedures",
                                    "Unimproved",
                                    "Use of menstrual materials"
                                ]
                            }
                        },
                        "example": [
                            "Basic service"
                        ]
                    },
                    {
                        "name": "quintile[]",
                        "in": "query",
                        "description": "Wealth quintile(s) (Q1=poorest to Q5=richest) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": [
                            "Q1"
                        ]
                    },
                    {
                        "name": "survey_code[]",
                        "in": "query",
                        "description": "Filter by survey identifier(s) - supports multiple values",
                        "required": false,
                        "style": "form",
                        "explode": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": [
                            "DHS2018"
                        ]
                    },
                    {
                        "name": "region_type",
                        "in": "query",
                        "description": "Region type for filtering",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "au_all",
                                "au_subreg",
                                "c_caribbean_cwwa",
                                "fragile",
                                "fragileoecd",
                                "income",
                                "ldc",
                                "lldc",
                                "lmic",
                                "m49",
                                "m49_sub",
                                "mdg",
                                "sdg",
                                "sids",
                                "unesco_uis",
                                "unicef_eap_asean",
                                "unicef_humanitarian",
                                "unicef_new",
                                "unicef_old",
                                "unicef_other_ssa",
                                "wb_afe",
                                "wb_afw",
                                "wb_arb",
                                "wb_ceb",
                                "wb_css",
                                "wb_eap",
                                "wb_ear",
                                "wb_eas",
                                "wb_eca",
                                "wb_ecs",
                                "wb_emu",
                                "wb_euu",
                                "wb_hic",
                                "wb_hpc",
                                "wb_ibd",
                                "wb_ibt",
                                "wb_ida",
                                "wb_idb",
                                "wb_idx",
                                "wb_lac",
                                "wb_lcn",
                                "wb_ldc",
                                "wb_lic",
                                "wb_lmc",
                                "wb_lte",
                                "wb_mic",
                                "wb_nac",
                                "wb_oecd",
                                "wb_oss",
                                "wb_pre",
                                "wb_pss",
                                "wb_pst",
                                "wb_sas",
                                "wb_ssa",
                                "wb_ssf",
                                "wb_sst",
                                "wb_tea",
                                "wb_tec",
                                "wb_tla",
                                "wb_tsa",
                                "wb_tss",
                                "wb_umc",
                                "wb_world",
                                "who",
                                "who_legal_status",
                                "world"
                            ]
                        },
                        "example": "sdg"
                    },
                    {
                        "name": "region",
                        "in": "query",
                        "description": "Region name",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                " Arab States",
                                " Central and Eastern Europe",
                                " Central Asia",
                                " East Asia and the Pacific",
                                " Latin America and the Caribbean",
                                " North America and Western Europe",
                                " South and West Asia",
                                " Sub-Saharan Africa",
                                "A",
                                "Africa",
                                "Africa Eastern and Southern",
                                "Africa Western and Central",
                                "African Union (n=55)",
                                "Americas",
                                "Arab World",
                                "Asia",
                                "Association of Southeast Asian Nations (ASEAN)",
                                "Australia and New Zealand",
                                "Caribbean",
                                "Caribbean (CWWA)",
                                "Caribbean small states",
                                "Central Africa",
                                "Central America",
                                "Central and Southern Asia",
                                "Central Asia",
                                "Central Europe and the Baltics",
                                "Developed regions",
                                "Developing regions",
                                "E",
                                "Early-demographic dividend",
                                "East Asia & Pacific",
                                "East Asia & Pacific (excluding high income)",
                                "East Asia & Pacific (IDA & IBRD)",
                                "East Asia and Pacific",
                                "Eastern Africa",
                                "Eastern and South-Eastern Asia",
                                "Eastern and Southern Africa",
                                "Eastern Asia",
                                "Eastern Europe",
                                "Eastern Mediterranean",
                                "Euro area",
                                "Europe",
                                "Europe & Central Asia",
                                "Europe & Central Asia (excluding high income)",
                                "Europe & Central Asia (IDA & IBRD)",
                                "Europe and Central Asia",
                                "Europe and Northern America",
                                "European Union",
                                "Extremely fragile",
                                "Fragile Contexts",
                                "Heavily indebted poor countries (HIPC)",
                                "High income",
                                "IBRD only",
                                "IDA & IBRD total",
                                "IDA blend",
                                "IDA only",
                                "IDA total",
                                "Landlocked Developing Countries",
                                "Late-demographic dividend",
                                "Latin America & Caribbean",
                                "Latin America & Caribbean (excluding high income)",
                                "Latin America & Caribbean (IDA & IBRD)",
                                "Latin America and Caribbean",
                                "Latin America and the Caribbean",
                                "Least Developed Countries",
                                "Least developed countries: UN classification",
                                "Low & middle income",
                                "Low income",
                                "Lower middle income",
                                "M",
                                "Melanesia",
                                "Micronesia",
                                "Middle Africa",
                                "Middle East and North Africa",
                                "Middle income",
                                "N",
                                "North America",
                                "Northern Africa",
                                "Northern Africa and Western Asia",
                                "Northern America",
                                "Northern Europe",
                                "Oceania",
                                "OECD members",
                                "Other",
                                "Other fragile",
                                "Other small states",
                                "Pacific island small states",
                                "Polynesia",
                                "Post-demographic dividend",
                                "Pre-demographic dividend",
                                "Small Island Developing States",
                                "Small states",
                                "South America",
                                "South Asia",
                                "South Asia (IDA & IBRD)",
                                "South-East Asia",
                                "South-eastern Asia",
                                "Southern Africa",
                                "Southern Asia",
                                "Southern Europe",
                                "Sub-Saharan Africa",
                                "Sub-Saharan Africa (excluding high income)",
                                "Sub-Saharan Africa (IDA & IBRD)",
                                "T",
                                "UNICEF Humanitarian",
                                "Upper middle income",
                                "West and Central Africa",
                                "Western Africa",
                                "Western Asia",
                                "Western Europe",
                                "Western Pacific",
                                "World",
                                "World (World Bank)"
                            ]
                        },
                        "example": "Sub-Saharan Africa"
                    },
                    {
                        "name": "latest",
                        "in": "query",
                        "description": "If set to any value, only returns estimates from the latest survey. The year, year_from, and year_to parameters are all ignored when latest is used.",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        },
                        "example": true
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Maximum number of results per page (default 10000, max 50000)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 10000,
                            "maximum": 50000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "description": "Number of results to skip for pagination (default 0)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Quintile estimates with calculated population (1/5 of country total)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "query": {
                                            "type": "object"
                                        },
                                        "result_count": {
                                            "description": "Number of results in this page",
                                            "type": "integer"
                                        },
                                        "total_count": {
                                            "description": "Total number of matching results across all pages",
                                            "type": "integer"
                                        },
                                        "limit": {
                                            "type": "integer",
                                            "example": 10000
                                        },
                                        "offset": {
                                            "type": "integer",
                                            "example": 0
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "country": {
                                                        "type": "string",
                                                        "example": "NGA"
                                                    },
                                                    "quintile": {
                                                        "type": "string",
                                                        "example": "Q1"
                                                    },
                                                    "year": {
                                                        "type": "integer",
                                                        "example": 2018
                                                    },
                                                    "residence_type": {
                                                        "type": "string",
                                                        "example": "total"
                                                    },
                                                    "survey_code": {
                                                        "type": "string",
                                                        "example": "DHS2018"
                                                    },
                                                    "latest_survey": {
                                                        "type": "boolean",
                                                        "example": true
                                                    },
                                                    "service_type": {
                                                        "type": "string",
                                                        "example": "Drinking water"
                                                    },
                                                    "service_level": {
                                                        "type": "string",
                                                        "example": "Basic service"
                                                    },
                                                    "value": {
                                                        "type": "number",
                                                        "example": 45.2000000000000028421709430404007434844970703125
                                                    },
                                                    "population": {
                                                        "type": "number",
                                                        "example": 18000000
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "description": "CSV export with columns: country, quintile, year, residence_type, survey_code, latest_survey, service_type, service_level, value, population",
                                    "type": "string",
                                    "format": "binary",
                                    "example": "country,quintile,year,residence_type,survey_code,latest_survey,service_type,service_level,value,population\nNGA,Q1,2018,total,DHS2018,1,Drinking water,Basic service,45.2,18000000"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{dataSource}/kpi/country": {
            "get": {
                "tags": [
                    "KPIs"
                ],
                "summary": "Get country KPIs",
                "description": "Returns Key Performance Indicators for countries - service level percentages organized by service type and level. Year and residence are required parameters.",
                "operationId": "get_country_kpis",
                "parameters": [
                    {
                        "name": "dataSource",
                        "in": "path",
                        "description": "Data source type",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "household",
                                "school",
                                "healthcare"
                            ]
                        }
                    },
                    {
                        "name": "year",
                        "in": "query",
                        "description": "Year (required)",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "enum": [
                                2000,
                                2001,
                                2002,
                                2003,
                                2004,
                                2005,
                                2006,
                                2007,
                                2008,
                                2009,
                                2010,
                                2011,
                                2012,
                                2013,
                                2014,
                                2015,
                                2016,
                                2017,
                                2018,
                                2019,
                                2020,
                                2021,
                                2022,
                                2023,
                                2024,
                                2025
                            ]
                        },
                        "example": 2022
                    },
                    {
                        "name": "residence",
                        "in": "query",
                        "description": "Residence type (required)",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "total",
                                "urban",
                                "rural"
                            ]
                        }
                    },
                    {
                        "name": "country",
                        "in": "query",
                        "description": "ISO3 country code (optional - if omitted returns all countries)",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "KEN"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "KPI data organized by service type and level",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "wat": {
                                        "basic": 85.5,
                                        "limited": 10.199999999999999289457264239899814128875732421875,
                                        "unimproved": 3.100000000000000088817841970012523233890533447265625,
                                        "surface": 1.1999999999999999555910790149937383830547332763671875
                                    },
                                    "san": {
                                        "basic": 72.2999999999999971578290569595992565155029296875,
                                        "limited": 15.4000000000000003552713678800500929355621337890625
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Missing required parameter (year or residence)"
                    }
                }
            }
        }
    },
    "tags": [
        {
            "name": "Estimates",
            "description": "WASH coverage estimates"
        },
        {
            "name": "Reference Data",
            "description": "Geographic hierarchies and service levels"
        },
        {
            "name": "Population",
            "description": "Population data by country, year, and residence type"
        },
        {
            "name": "KPIs",
            "description": "Key Performance Indicators for countries"
        },
        {
            "name": "Files",
            "description": "Uploaded data files"
        }
    ]
}