{
    "openapi": "3.1.0",
    "info": {
        "title": "REST Countries",
        "version": "2026-07-10",
        "summary": "Country data and currency exchange-rate APIs: 250+ countries with 90+ normalized fields each, plus currency conversion and rates across fiat and crypto.",
        "description": "REST Countries is a read-only API family served as JSON over HTTPS and authenticated with a single Bearer token. It provides two APIs that share one account, one key, and one request quota: the Countries API (/countries/v5) for structured country data, and the Currencies API (/currencies/v1) for currency conversion and exchange rates across fiat and crypto. Each API is versioned in its path; additive changes ship inside the current version, and breaking changes get a new version. See https://restcountries.com/docs for the full reference and https://restcountries.com/docs#versioning for the versioning policy.",
        "termsOfService": "https://restcountries.com/legal/terms-of-service",
        "contact": {
            "name": "REST Countries Support",
            "url": "https://restcountries.com/support",
            "email": "support@restcountries.com"
        },
        "license": {
            "name": "Proprietary"
        }
    },
    "servers": [
        {
            "url": "https://api.restcountries.com",
            "description": "Production"
        }
    ],
    "security": [
        {"BearerAuth": []},
        {"KeyQuery": []}
    ],
    "tags": [
        {"name": "Countries", "description": "Country data endpoints."},
        {"name": "Aggregates", "description": "Aggregate searches across code and name field families."},
        {"name": "Currencies", "description": "Currency conversion and exchange-rate endpoints."}
    ],
    "paths": {
        "/countries/v5": {
            "get": {
                "tags": ["Countries"],
                "summary": "List or search countries",
                "description": "Returns a paginated list of countries. Supports full-text search via q, per-property filter chains (e.g. ?region=Europe&landlocked=1), pagination via limit/offset, and response shaping via response_fields / response_fields_omit. Per-property filters use any searchable field name as a query parameter; see https://restcountries.com/docs#fields for the full list.",
                "operationId": "listCountries",
                "parameters": [
                    {"$ref": "#/components/parameters/Q"},
                    {"$ref": "#/components/parameters/Limit"},
                    {"$ref": "#/components/parameters/Offset"},
                    {"$ref": "#/components/parameters/ResponseFields"},
                    {"$ref": "#/components/parameters/ResponseFieldsOmit"},
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/CountryList"},
                    "400": {"$ref": "#/components/responses/Error400"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        },
        "/countries/v5/code": {
            "get": {
                "tags": ["Aggregates"],
                "summary": "Aggregate search across every code property",
                "description": "Searches the q value across alpha_2, alpha_3, ccn3, fips, gec, fifa, and cioc simultaneously. Useful when the caller has a code but doesn't know which standard it belongs to.",
                "operationId": "searchCodes",
                "parameters": [
                    {"$ref": "#/components/parameters/QRequired"},
                    {"$ref": "#/components/parameters/Limit"},
                    {"$ref": "#/components/parameters/Offset"},
                    {"$ref": "#/components/parameters/ResponseFields"},
                    {"$ref": "#/components/parameters/ResponseFieldsOmit"},
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/CountryList"},
                    "400": {"$ref": "#/components/responses/Error400"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        },
        "/countries/v5/name": {
            "get": {
                "tags": ["Aggregates"],
                "summary": "Aggregate search across every name field",
                "description": "Searches the q value across common, official, native, and alternates simultaneously.",
                "operationId": "searchNames",
                "parameters": [
                    {"$ref": "#/components/parameters/QRequired"},
                    {"$ref": "#/components/parameters/Limit"},
                    {"$ref": "#/components/parameters/Offset"},
                    {"$ref": "#/components/parameters/ResponseFields"},
                    {"$ref": "#/components/parameters/ResponseFieldsOmit"},
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/CountryList"},
                    "400": {"$ref": "#/components/responses/Error400"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        },
        "/countries/v5/{property}": {
            "get": {
                "tags": ["Countries"],
                "summary": "Search within a single property",
                "description": "Returns a paginated list of countries whose {property} value matches q (or all countries when q is omitted). Property accepts any searchable field name as a dot-path (e.g. codes.alpha_3, names.common, region, landlocked, memberships.eu). See https://restcountries.com/docs#fields for the full list.",
                "operationId": "searchByProperty",
                "parameters": [
                    {"$ref": "#/components/parameters/Property"},
                    {"$ref": "#/components/parameters/Q"},
                    {"$ref": "#/components/parameters/Limit"},
                    {"$ref": "#/components/parameters/Offset"},
                    {"$ref": "#/components/parameters/ResponseFields"},
                    {"$ref": "#/components/parameters/ResponseFieldsOmit"},
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/CountryList"},
                    "400": {"$ref": "#/components/responses/Error400"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        },
        "/countries/v5/{property}/{value}": {
            "get": {
                "tags": ["Countries"],
                "summary": "Filter by property value",
                "description": "Returns a paginated list of countries whose {property} value equals {value} (case-insensitive, URL-decoded; spaces accept either + or %20). For unique fields like codes.alpha_3 this returns at most one record; for non-unique fields like region this returns every match. An empty result returns an empty objects array, not 404. Supports an optional q to refine within the filtered set.",
                "operationId": "filterByPropertyValue",
                "parameters": [
                    {"$ref": "#/components/parameters/Property"},
                    {"$ref": "#/components/parameters/Value"},
                    {"$ref": "#/components/parameters/Q"},
                    {"$ref": "#/components/parameters/Limit"},
                    {"$ref": "#/components/parameters/Offset"},
                    {"$ref": "#/components/parameters/ResponseFields"},
                    {"$ref": "#/components/parameters/ResponseFieldsOmit"},
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/CountryList"},
                    "400": {"$ref": "#/components/responses/Error400"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        },
        "/currencies/v1/convert": {
            "get": {
                "tags": ["Currencies"],
                "summary": "Convert an amount between currencies",
                "description": "Converts amount from one currency into one or more targets. from and to are required; amount is optional and defaults to 1, so omitting it returns the unit rate as result. to accepts a comma-separated list of up to 5 currencies, and the response carries one object per target, in the order requested. The call is all-or-nothing: an unknown from, any unknown to, or more than 5 targets fails the whole request with 400. Both fiat and crypto codes are accepted.",
                "operationId": "convertCurrency",
                "parameters": [
                    {"$ref": "#/components/parameters/From"},
                    {"$ref": "#/components/parameters/To"},
                    {"$ref": "#/components/parameters/Amount"},
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/ConvertList"},
                    "400": {"$ref": "#/components/responses/Error400"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        },
        "/currencies/v1/rates/{base}": {
            "get": {
                "tags": ["Currencies"],
                "summary": "Exchange-rate table for a base currency (path slug)",
                "description": "Returns the full exchange-rate table for a base currency: every supported currency expressed as units per one unit of the base. Supply the base as the path slug. Every key in the returned rates map is itself a queryable base. Both fiat and crypto codes are accepted.",
                "operationId": "ratesByBasePath",
                "parameters": [
                    {"$ref": "#/components/parameters/BasePath"},
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/RatesList"},
                    "400": {"$ref": "#/components/responses/Error400"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        },
        "/currencies/v1/rates": {
            "get": {
                "tags": ["Currencies"],
                "summary": "Exchange-rate table for a base currency (query param)",
                "description": "Same as /currencies/v1/rates/{base}, but with the base supplied via the base query parameter (e.g. ?base=USD). When both the path slug and the query param are given, the path wins. A bare /rates with no base resolves to 400.",
                "operationId": "ratesByBaseQuery",
                "parameters": [
                    {"$ref": "#/components/parameters/Base"},
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/RatesList"},
                    "400": {"$ref": "#/components/responses/Error400"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        },
        "/currencies/v1/symbols": {
            "get": {
                "tags": ["Currencies"],
                "summary": "List supported currencies",
                "description": "Returns the supported-currency catalog: one object per currency (code, name, symbol), sorted by code. symbol is null where the currency has no conventional sign (e.g. XAU, gold). Takes no parameters beyond the key. Every code listed here is usable as a from, to, or base elsewhere in the API.",
                "operationId": "listSymbols",
                "parameters": [
                    {"$ref": "#/components/parameters/Pretty"}
                ],
                "responses": {
                    "200": {"$ref": "#/components/responses/SymbolsList"},
                    "401": {"$ref": "#/components/responses/Error401"},
                    "403": {"$ref": "#/components/responses/Error403"},
                    "404": {"$ref": "#/components/responses/Error404"},
                    "405": {"$ref": "#/components/responses/Error405"},
                    "410": {"$ref": "#/components/responses/Error410"},
                    "429": {"$ref": "#/components/responses/Error429"}
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "BearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "rc_live_...",
                "description": "Pass your API key as a bearer token: Authorization: Bearer rc_live_..."
            },
            "KeyQuery": {
                "type": "apiKey",
                "in": "query",
                "name": "api-key",
                "description": "API key as a query parameter. The Bearer header form is preferred so the key never lands in server logs or browser history."
            }
        },
        "parameters": {
            "Q": {
                "name": "q",
                "in": "query",
                "required": false,
                "description": "Full-text search across every searchable property. Case-insensitive substring match.",
                "schema": {"type": "string"},
                "example": "canada"
            },
            "QRequired": {
                "name": "q",
                "in": "query",
                "required": true,
                "description": "Search term. Case-insensitive substring match.",
                "schema": {"type": "string"},
                "example": "EU"
            },
            "Property": {
                "name": "property",
                "in": "path",
                "required": true,
                "description": "Dot-path field name to filter or look up on. See https://restcountries.com/docs#fields for the full set of accepted values.",
                "schema": {"type": "string"},
                "example": "codes.alpha_3"
            },
            "Value": {
                "name": "value",
                "in": "path",
                "required": true,
                "description": "Exact value to match (case-insensitive, URL-decoded).",
                "schema": {"type": "string"},
                "example": "CAN"
            },
            "Limit": {
                "name": "limit",
                "in": "query",
                "required": false,
                "description": "Number of records to return. Defaults to 25; accepts an integer from 1 to 100 on the free plan, or up to 500 on paid plans. Non-integer or below-range values return HTTP 400; a value above your plan's ceiling but within the paid maximum (e.g. 200 on a free plan) returns HTTP 403 indicating it is valid only on paid plans. See https://restcountries.com/docs#pagination for details.",
                "schema": {"type": "integer", "minimum": 1, "maximum": 500, "default": 25}
            },
            "Offset": {
                "name": "offset",
                "in": "query",
                "required": false,
                "description": "Number of records to skip for pagination. Default 0.",
                "schema": {"type": "integer", "minimum": 0, "default": 0}
            },
            "ResponseFields": {
                "name": "response_fields",
                "in": "query",
                "required": false,
                "description": "Comma-separated dot-path projection. Only the specified fields are returned. Example: names.common,codes.alpha_2,flag.emoji",
                "schema": {"type": "string"}
            },
            "ResponseFieldsOmit": {
                "name": "response_fields_omit",
                "in": "query",
                "required": false,
                "description": "Comma-separated dot-path blocklist. The specified fields are removed from the response. Useful for trimming heavy branches like names.translations.",
                "schema": {"type": "string"}
            },
            "Pretty": {
                "name": "pretty",
                "in": "query",
                "required": false,
                "description": "Set to true (a bare ?pretty, 1, or true) to pretty-print the JSON response; 0 or false keep it minified. Default is minified.",
                "schema": {"type": "boolean"}
            },
            "From": {
                "name": "from",
                "in": "query",
                "required": true,
                "description": "Source currency code to convert from (e.g. USD). Case-insensitive. Also accepted under the alias base.",
                "schema": {"type": "string"},
                "example": "USD"
            },
            "To": {
                "name": "to",
                "in": "query",
                "required": true,
                "description": "Target currency code, or a comma-separated list of up to 5 (e.g. EUR or EUR,CAD). Returns one object per target. More than 5 targets returns HTTP 400.",
                "schema": {"type": "string"},
                "example": "EUR,CAD"
            },
            "Amount": {
                "name": "amount",
                "in": "query",
                "required": false,
                "description": "Amount in the source currency to convert. Must be a number; defaults to 1 when omitted.",
                "schema": {"type": "number", "default": 1},
                "example": 100
            },
            "Base": {
                "name": "base",
                "in": "query",
                "required": false,
                "description": "Base currency the rate table is expressed against (e.g. USD). Optional when supplied as the /rates/{base} path slug, which takes precedence when both are present. Also accepted under the alias from. A bare /rates with no base returns HTTP 400.",
                "schema": {"type": "string"},
                "example": "USD"
            },
            "BasePath": {
                "name": "base",
                "in": "path",
                "required": true,
                "description": "Base currency code the rate table is expressed against (e.g. USD). Case-insensitive.",
                "schema": {"type": "string"},
                "example": "USD"
            }
        },
        "responses": {
            "CountryList": {
                "description": "Paginated list of countries.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/CountryListResponse"},
                        "example": {
                            "data": {
                                "objects": [
                                    {
                                        "uuid": "189581ed-44b0-47d7-9849-6b097401a7d6",
                                        "names": {
                                            "common": "Canada",
                                            "official": "Canada",
                                            "alternates": [],
                                            "native": {
                                                "eng": {"common": "Canada", "official": "Canada"},
                                                "fra": {"common": "Canada", "official": "Canada"}
                                            }
                                        },
                                        "codes": {
                                            "alpha_2": "CA",
                                            "alpha_3": "CAN",
                                            "ccn3": "124",
                                            "fips": "CA",
                                            "gec": "CA",
                                            "fifa": "CAN",
                                            "cioc": "CAN"
                                        },
                                        "capitals": [
                                            {
                                                "name": "Ottawa",
                                                "coordinates": {"lat": 45.42, "lng": -75.7},
                                                "attributes": {
                                                    "primary": true,
                                                    "constitutional": false,
                                                    "administrative": false,
                                                    "executive": false,
                                                    "legislative": false,
                                                    "judicial": false
                                                }
                                            }
                                        ],
                                        "flag": {
                                            "emoji": "🇨🇦",
                                            "url_png": "https://flags.restcountries.com/v5/w640/ca.png",
                                            "url_svg": "https://flags.restcountries.com/v5/svg/ca.svg"
                                        },
                                        "region": "Americas",
                                        "subregion": "North America",
                                        "continents": ["North America"],
                                        "landlocked": false,
                                        "borders": ["USA"],
                                        "area": {"kilometers": 9984670, "miles": 3855101.1},
                                        "population": 38005238,
                                        "currencies": [
                                            {"code": "CAD", "name": "Canadian dollar", "symbol": "$"}
                                        ],
                                        "languages": [
                                            {"iso639_1": "en", "iso639_3": "eng", "bcp47": "en", "name": "English", "native_name": "English"},
                                            {"iso639_1": "fr", "iso639_3": "fra", "bcp47": "fr", "name": "French", "native_name": "français"}
                                        ],
                                        "calling_codes": ["1"],
                                        "tlds": [".ca"],
                                        "memberships": {
                                            "un": true,
                                            "g7": true,
                                            "g20": true,
                                            "nato": true,
                                            "commonwealth": true,
                                            "oecd": true
                                        }
                                    }
                                ],
                                "meta": {
                                    "total": 1,
                                    "count": 1,
                                    "limit": 25,
                                    "offset": 0,
                                    "more": false,
                                    "request_id": "b3f1c2a8-9d4e-4c7a-8f21-6e0a1b2c3d4e",
                                    "duration": 12
                                }
                            }
                        }
                    }
                }
            },
            "Error400": {
                "description": "Bad request. Malformed parameters or unsupported property.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/ErrorResponse"},
                        "example": {
                            "errors": [
                                {
                                    "code": "limitOutOfRange",
                                    "message": "Limit must be an integer between 1 and 500."
                                }
                            ]
                        }
                    }
                }
            },
            "Error401": {
                "description": "Unauthorized. Missing, invalid, expired, or revoked API key.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/ErrorResponse"}
                    }
                }
            },
            "Error403": {
                "description": "Forbidden. The account is deleted, disabled, frozen, or pending approval; the request origin isn't in the key's allowed CORS origins; a paid-only field was used as a search, filter, or lookup target on a plan that doesn't include it; a limit above the plan's ceiling but within the paid maximum was requested on a non-paid plan; or the monthly quota has been exceeded past the soft-limit grace period.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/ErrorResponse"}
                    }
                }
            },
            "Error404": {
                "description": "Not found. The route doesn't match any defined endpoint, the API isn't active, or listing isn't supported for this API version.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/ErrorResponse"}
                    }
                }
            },
            "Error405": {
                "description": "Method not allowed. Every endpoint is GET-only.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/ErrorResponse"}
                    }
                }
            },
            "Error410": {
                "description": "Gone. The requested API version is no longer active.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/ErrorResponse"}
                    }
                }
            },
            "Error429": {
                "description": "Too Many Requests. Sustained traffic above the per-second edge limit (20 requests/second) is rejected by Cloudflare before the request reaches the API, so this response is generated at the edge and does not carry the standard JSON error envelope. Back off briefly and retry."
            },
            "ConvertList": {
                "description": "Conversion result, one object per requested target currency.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/ConvertResponse"},
                        "example": {
                            "data": {
                                "objects": [
                                    {
                                        "from": {"code": "USD", "name": "United States dollar", "symbol": "$"},
                                        "to": {"code": "EUR", "name": "Euro", "symbol": "€"},
                                        "amount": 100,
                                        "rate": 0.8772645,
                                        "result": 87.72645,
                                        "as_of": 1782691200
                                    }
                                ],
                                "meta": {"total": 1, "request_id": "b3f1c2a8-9d4e-4c7a-8f21-6e0a1b2c3d4e", "duration": 4}
                            }
                        }
                    }
                }
            },
            "RatesList": {
                "description": "Full exchange-rate table for a base currency.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/RatesResponse"},
                        "example": {
                            "data": {
                                "objects": [
                                    {
                                        "base": "USD",
                                        "as_of": 1782691200,
                                        "rates": {"EUR": 0.8772645, "GBP": 0.75560016, "CAD": 1.42319257, "JPY": 162.17946627}
                                    }
                                ],
                                "meta": {"total": 1, "request_id": "b3f1c2a8-9d4e-4c7a-8f21-6e0a1b2c3d4e", "duration": 3}
                            }
                        }
                    }
                }
            },
            "SymbolsList": {
                "description": "Supported-currency catalog, one object per currency, sorted by code.",
                "content": {
                    "application/json": {
                        "schema": {"$ref": "#/components/schemas/SymbolsResponse"},
                        "example": {
                            "data": {
                                "objects": [
                                    {"code": "AED", "name": "United Arab Emirates dirham", "symbol": "د.إ"},
                                    {"code": "EUR", "name": "Euro", "symbol": "€"},
                                    {"code": "USD", "name": "United States dollar", "symbol": "$"},
                                    {"code": "XAU", "name": "Gold (troy ounce)", "symbol": null}
                                ],
                                "meta": {"total": 4, "request_id": "b3f1c2a8-9d4e-4c7a-8f21-6e0a1b2c3d4e", "duration": 2}
                            }
                        }
                    }
                }
            }
        },
        "schemas": {
            "CountryListResponse": {
                "type": "object",
                "required": ["data"],
                "properties": {
                    "data": {
                        "type": "object",
                        "required": ["objects"],
                        "properties": {
                            "objects": {
                                "type": "array",
                                "items": {"$ref": "#/components/schemas/Country"}
                            },
                            "meta": {"$ref": "#/components/schemas/ListMeta"}
                        }
                    }
                }
            },
            "ListMeta": {
                "type": "object",
                "required": ["total", "count", "limit", "offset", "more", "request_id", "duration"],
                "properties": {
                    "total":      {"type": "integer", "description": "Total records matching the query (independent of limit/offset)."},
                    "count":      {"type": "integer", "description": "Number of records in this page (length of objects)."},
                    "limit":      {"type": "integer"},
                    "offset":     {"type": "integer"},
                    "more":       {"type": "boolean", "description": "True when records remain beyond this page."},
                    "request_id": {"type": "string"},
                    "duration":   {"type": "integer", "description": "Server-side processing time in milliseconds."}
                }
            },
            "ErrorResponse": {
                "type": "object",
                "required": ["errors"],
                "properties": {
                    "errors": {
                        "type": "array",
                        "description": "One or more error objects describing what went wrong.",
                        "items": {
                            "type": "object",
                            "required": ["message"],
                            "properties": {
                                "message": {"type": "string"},
                                "code":    {"type": "string", "description": "Machine-readable error key. Present on request-validation failures; omitted by some endpoints."}
                            }
                        }
                    }
                }
            },
            "Country": {
                "type": "object",
                "description": "A single country record. See https://restcountries.com/docs#fields for the canonical field reference.",
                "properties": {
                    "uuid": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Stable per-country identifier independent of code revisions."
                    },
                    "names": {
                        "type": "object",
                        "properties": {
                            "common":     {"type": "string"},
                            "official":   {"type": "string"},
                            "alternates": {"type": "array", "items": {"type": "string"}},
                            "native": {
                                "type": "object",
                                "description": "Map of ISO 639-3 language code to native name pair.",
                                "additionalProperties": {
                                    "type": "object",
                                    "properties": {
                                        "common":   {"type": "string"},
                                        "official": {"type": "string"}
                                    }
                                }
                            },
                            "translations": {
                                "type": "object",
                                "description": "Map of ISO 639-3 language code to translated name pair. Heavy field; trim with response_fields_omit when not needed.",
                                "additionalProperties": {
                                    "type": "object",
                                    "properties": {
                                        "common":   {"type": "string"},
                                        "official": {"type": "string"}
                                    }
                                }
                            }
                        }
                    },
                    "codes": {
                        "type": "object",
                        "properties": {
                            "alpha_2": {"type": "string", "description": "ISO 3166-1 alpha-2 (two-letter) code."},
                            "alpha_3": {"type": "string", "description": "ISO 3166-1 alpha-3 (three-letter) code."},
                            "ccn3":    {"type": "string", "description": "ISO 3166-1 numeric (three-digit) code."},
                            "fips":    {"type": "string", "description": "FIPS 10-4 country code."},
                            "gec":     {"type": "string", "description": "GEC code."},
                            "fifa":    {"type": "string", "description": "FIFA code."},
                            "cioc":    {"type": "string", "description": "International Olympic Committee code."}
                        }
                    },
                    "capitals": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {"type": "string"},
                                "coordinates": {
                                    "type": "object",
                                    "properties": {
                                        "lat": {"type": "number"},
                                        "lng": {"type": "number"}
                                    }
                                },
                                "attributes": {
                                    "type": "object",
                                    "description": "Role flags for this capital. Multi-capital countries set whichever flags fit each city; single-capital countries set primary.",
                                    "properties": {
                                        "primary":        {"type": "boolean"},
                                        "constitutional": {"type": "boolean"},
                                        "administrative": {"type": "boolean"},
                                        "executive":      {"type": "boolean"},
                                        "legislative":    {"type": "boolean"},
                                        "judicial":       {"type": "boolean"}
                                    }
                                }
                            }
                        }
                    },
                    "continents":     {"type": "array", "items": {"type": "string"}},
                    "region":         {"type": "string"},
                    "subregion":      {"type": "string"},
                    "landlocked":     {"type": "boolean"},
                    "coordinates": {
                        "type": "object",
                        "properties": {
                            "lat": {"type": "number"},
                            "lng": {"type": "number"}
                        }
                    },
                    "area": {
                        "type": "object",
                        "properties": {
                            "kilometers": {"type": "number"},
                            "miles":      {"type": "number"}
                        }
                    },
                    "borders":   {"type": "array", "items": {"type": "string", "description": "Neighboring country alpha-3 code."}},
                    "timezones": {"type": "array", "items": {"type": "string"}},
                    "government_type": {"type": "string"},
                    "leaders": {
                        "type": "array",
                        "description": "Heads of state and government. Paid-plan field: on plans that don't include it, this is replaced with a single notice object ({message, sample}) instead of the leader array, and using leaders as a search, filter, or lookup target returns HTTP 403.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "assets": {"type": "array", "items": {"type": "object"}},
                                "attributes": {
                                    "type": "object",
                                    "properties": {
                                        "administers_executive": {"type": ["boolean", "null"]},
                                        "de_facto_executive":    {"type": ["boolean", "null"]},
                                        "head_of_government":    {"type": ["boolean", "null"]},
                                        "head_of_state":         {"type": ["boolean", "null"]},
                                        "is_representative":     {"type": ["boolean", "null"]},
                                        "pending_office":        {"type": ["boolean", "null"]},
                                        "provisional":           {"type": ["boolean", "null"]}
                                    }
                                },
                                "links": {
                                    "type": "object",
                                    "properties": {
                                        "wikipedia": {"type": ["string", "null"], "format": "uri"}
                                    }
                                },
                                "name":  {"type": ["string", "null"]},
                                "title": {"type": ["string", "null"]}
                            }
                        }
                    },
                    "flag": {
                        "type": "object",
                        "properties": {
                            "emoji":       {"type": "string"},
                            "unicode":     {"type": "string"},
                            "html_entity": {"type": "string"},
                            "description": {"type": "string"},
                            "url_png":     {"type": "string", "format": "uri"},
                            "url_svg":     {"type": "string", "format": "uri"},
                            "colors": {
                                "type": "object",
                                "properties": {
                                    "dominant": {"type": "string", "description": "Dominant flag color as a hex string."},
                                    "prominent": {"type": "string", "description": "Most prominent flag color (the single color covering the largest share of the flag's area) as a hex string."},
                                    "palette": {
                                        "type": "array",
                                        "description": "Flag color palette as an array of {hex, proportion} maps, each pairing a hex color with the share (0-1) of the flag it covers.",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "hex":        {"type": "string"},
                                                "proportion": {"type": "number"}
                                            }
                                        }
                                    },
                                    "swatches": {
                                        "type": "object",
                                        "description": "Flag semantic color swatches keyed by role. All six roles are always present; a role the flag has no matching color for is null.",
                                        "properties": {
                                            "vibrant":       {"type": ["string", "null"]},
                                            "muted":         {"type": ["string", "null"]},
                                            "dark_vibrant":  {"type": ["string", "null"]},
                                            "dark_muted":    {"type": ["string", "null"]},
                                            "light_vibrant": {"type": ["string", "null"]},
                                            "light_muted":   {"type": ["string", "null"]}
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "currencies": {
                        "type": "array",
                        "description": "Currencies used by the country.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "code":   {"type": "string"},
                                "name":   {"type": "string"},
                                "symbol": {"type": "string"}
                            }
                        }
                    },
                    "population": {"type": "integer"},
                    "economy": {
                        "type": "object",
                        "properties": {
                            "gini_coefficient": {
                                "type": "object",
                                "description": "Map of year (string) to Gini value (number).",
                                "additionalProperties": {"type": "number"}
                            }
                        }
                    },
                    "demonyms": {
                        "type": "object",
                        "description": "Map of ISO 639-3 language code to {m, f} demonym pair.",
                        "additionalProperties": {
                            "type": "object",
                            "properties": {
                                "m": {"type": "string"},
                                "f": {"type": "string"}
                            }
                        }
                    },
                    "languages": {
                        "type": "array",
                        "description": "Languages used in the country, each with ISO 639 identifiers, BCP 47 tag, English name, and native name.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "iso639_1":  {"type": "string"},
                                "iso639_2t": {"type": "string"},
                                "iso639_2b": {"type": "string"},
                                "iso639_3":  {"type": "string"},
                                "bcp47":     {"type": "string"},
                                "name":      {"type": "string"},
                                "native_name": {"type": "string"}
                            }
                        }
                    },
                    "calling_codes": {"type": "array", "items": {"type": "string"}},
                    "tlds":          {"type": "array", "items": {"type": "string"}},
                    "cars": {
                        "type": "object",
                        "properties": {
                            "driving_side": {"type": "string", "enum": ["left", "right"]},
                            "signs":        {"type": "array", "items": {"type": "string"}}
                        }
                    },
                    "postal_code": {
                        "type": "object",
                        "properties": {
                            "format": {"type": "string"},
                            "regex":  {"type": "string"}
                        }
                    },
                    "number_format": {
                        "type": "object",
                        "properties": {
                            "decimal_separator":   {"type": "string"},
                            "thousands_separator": {"type": "string"}
                        }
                    },
                    "units": {
                        "type": "object",
                        "properties": {
                            "measurement_system": {"type": "string", "enum": ["metric", "imperial"]},
                            "temperature_scale":  {"type": "string", "enum": ["Celsius", "Fahrenheit"]}
                        }
                    },
                    "memberships": {
                        "type": "object",
                        "properties": {
                            "un":            {"type": "boolean"},
                            "african_union": {"type": "boolean"},
                            "arab_league":   {"type": "boolean"},
                            "asean":         {"type": "boolean"},
                            "brics":         {"type": "boolean"},
                            "commonwealth":  {"type": "boolean"},
                            "eu":            {"type": "boolean"},
                            "eurozone":      {"type": "boolean"},
                            "g7":            {"type": "boolean"},
                            "g20":           {"type": "boolean"},
                            "nato":          {"type": "boolean"},
                            "oecd":          {"type": "boolean"},
                            "opec":          {"type": "boolean"},
                            "schengen":      {"type": "boolean"}
                        }
                    },
                    "classification": {
                        "type": "object",
                        "properties": {
                            "sovereign":       {"type": "boolean"},
                            "disputed":        {"type": "boolean"},
                            "iso_status":      {"type": "string", "enum": ["official", "user_assigned", "unassigned"]},
                            "un_member":       {"type": "boolean"},
                            "un_observer":     {"type": "boolean"},
                            "dependency":      {"type": "boolean"},
                            "dependency_type": {"type": "string", "description": "Kind of dependency for dependent entities (e.g. overseas_territory, crown_dependency, special_administrative_region, constituent_country); empty string when the entity is not a dependency."}
                        }
                    },
                    "parent": {
                        "type": "object",
                        "description": "Present on dependent entities (overseas territories, crown dependencies, SARs).",
                        "properties": {
                            "alpha_2": {"type": "string"},
                            "alpha_3": {"type": "string"}
                        }
                    },
                    "date": {
                        "type": "object",
                        "properties": {
                            "start_of_week": {"type": "string", "enum": ["monday", "sunday", "saturday"]},
                            "academic_year_start": {
                                "type": "object",
                                "properties": {
                                    "month": {"type": "integer"},
                                    "day":   {"type": "integer"}
                                }
                            },
                            "fiscal_year_start": {
                                "type": "object",
                                "properties": {
                                    "government": {
                                        "type": "object",
                                        "properties": {
                                            "month": {"type": "integer"},
                                            "day":   {"type": "integer"}
                                        }
                                    },
                                    "corporate": {
                                        "type": "object",
                                        "properties": {
                                            "month": {"type": "integer"},
                                            "day":   {"type": "integer"},
                                            "basis": {"type": "string"}
                                        }
                                    },
                                    "personal": {
                                        "type": "object",
                                        "properties": {
                                            "month": {"type": "integer"},
                                            "day":   {"type": "integer"}
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "wikipedia":        {"type": "string", "format": "uri"},
                            "official":         {"type": "string", "format": "uri"},
                            "google_maps":      {"type": "string", "format": "uri"},
                            "open_street_maps": {"type": "string", "format": "uri"}
                        }
                    },
                    "assets": {
                        "type": "array",
                        "description": "Hosted files and media associated with the country (e.g. a link to a photo of the parliament building). Currently always empty; each item will be an object describing one asset.",
                        "items": {"type": "object"}
                    }
                }
            },
            "Currency": {
                "type": "object",
                "description": "A currency as { code, name, symbol }. symbol is null where the currency has no conventional sign (e.g. precious metals).",
                "required": ["code", "name", "symbol"],
                "properties": {
                    "code":   {"type": "string", "description": "Uppercase currency code (e.g. USD, BTC)."},
                    "name":   {"type": "string"},
                    "symbol": {"type": ["string", "null"]}
                }
            },
            "ConvertObject": {
                "type": "object",
                "properties": {
                    "from":   {"$ref": "#/components/schemas/Currency"},
                    "to":     {"$ref": "#/components/schemas/Currency"},
                    "amount": {"type": "number", "description": "The input amount in the source currency (the amount sent, or 1 by default)."},
                    "rate":   {"type": "number", "description": "Units of the target currency per one unit of the source, read from the as_of snapshot."},
                    "result": {"type": "number", "description": "The converted amount (amount x rate)."},
                    "as_of":  {"type": "integer", "description": "Unix timestamp (seconds) the rate was sourced. Day-granular today."}
                }
            },
            "RatesObject": {
                "type": "object",
                "properties": {
                    "base":  {"type": "string", "description": "The base currency code (uppercase) the table is expressed against."},
                    "as_of": {"type": "integer", "description": "Unix timestamp (seconds) the table was sourced."},
                    "rates": {
                        "type": "object",
                        "description": "Map of uppercase currency code to its rate (units per one unit of base). Every key is itself a queryable base.",
                        "additionalProperties": {"type": "number"}
                    }
                }
            },
            "ResultMeta": {
                "type": "object",
                "required": ["total", "request_id", "duration"],
                "properties": {
                    "total":      {"type": "integer", "description": "Number of objects returned."},
                    "request_id": {"type": "string"},
                    "duration":   {"type": "integer", "description": "Server-side processing time in milliseconds."}
                }
            },
            "ConvertResponse": {
                "type": "object",
                "required": ["data"],
                "properties": {
                    "data": {
                        "type": "object",
                        "required": ["objects"],
                        "properties": {
                            "objects": {
                                "type": "array",
                                "items": {"$ref": "#/components/schemas/ConvertObject"}
                            },
                            "meta": {"$ref": "#/components/schemas/ResultMeta"}
                        }
                    }
                }
            },
            "RatesResponse": {
                "type": "object",
                "required": ["data"],
                "properties": {
                    "data": {
                        "type": "object",
                        "required": ["objects"],
                        "properties": {
                            "objects": {
                                "type": "array",
                                "items": {"$ref": "#/components/schemas/RatesObject"}
                            },
                            "meta": {"$ref": "#/components/schemas/ResultMeta"}
                        }
                    }
                }
            },
            "SymbolsResponse": {
                "type": "object",
                "required": ["data"],
                "properties": {
                    "data": {
                        "type": "object",
                        "required": ["objects"],
                        "properties": {
                            "objects": {
                                "type": "array",
                                "items": {"$ref": "#/components/schemas/Currency"}
                            },
                            "meta": {"$ref": "#/components/schemas/ResultMeta"}
                        }
                    }
                }
            }
        }
    }
}
