# Geolocations ## List Geolocations `client.radar.geolocations.list(GeolocationListParamsquery?, RequestOptionsoptions?): GeolocationListResponse` **get** `/radar/geolocations` Retrieves a list of geolocations. Geolocation names can be localized by sending an `Accept-Language` HTTP header with a BCP 47 language tag (e.g., `Accept-Language: pt-PT`). The full quality-value chain is supported (e.g., `pt-PT,pt;q=0.9,en;q=0.8`). ### Parameters - `query: GeolocationListParams` - `format?: "JSON" | "CSV"` Format in which results will be returned. - `"JSON"` - `"CSV"` - `geoId?: string` Filters results by geolocation. Specify a comma-separated list of GeoNames IDs. - `limit?: number` Limits the number of objects returned in the response. - `location?: string` Filters results by location. Specify a comma-separated list of alpha-2 location codes. - `offset?: number` Skips the specified number of objects before fetching the results. ### Returns - `GeolocationListResponse` - `geolocations: Array` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `parent: Parent` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `parent: Parent` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const geolocations = await client.radar.geolocations.list(); console.log(geolocations.geolocations); ``` #### Response ```json { "result": { "geolocations": [ { "geoId": "2267056", "latitude": "10", "longitude": "10", "name": "Lisbon", "parent": { "geoId": "2267056", "latitude": "10", "longitude": "10", "name": "Lisbon", "parent": { "geoId": "2267056", "latitude": "10", "longitude": "10", "name": "Lisbon", "type": "CONTINENT", "code": "PT-11", "locale": "pt-PT" }, "type": "CONTINENT", "code": "PT-11", "locale": "pt-PT" }, "type": "CONTINENT", "code": "PT-11", "locale": "pt-PT" } ] }, "success": true } ``` ## Get Geolocation details `client.radar.geolocations.get(stringgeoId, GeolocationGetParamsquery?, RequestOptionsoptions?): GeolocationGetResponse` **get** `/radar/geolocations/{geo_id}` Retrieves the requested Geolocation information. Geolocation names can be localized by sending an `Accept-Language` HTTP header with a BCP 47 language tag (e.g., `Accept-Language: pt-PT`). The full quality-value chain is supported (e.g., `pt-PT,pt;q=0.9,en;q=0.8`). ### Parameters - `geoId: string` Geolocation ID. Refer to [GeoNames](https://download.geonames.org/export/dump/readme.txt) - `query: GeolocationGetParams` - `format?: "JSON" | "CSV"` Format in which results will be returned. - `"JSON"` - `"CSV"` ### Returns - `GeolocationGetResponse` - `geolocation: Geolocation` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `parent: Parent` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `parent: Parent` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const geolocation = await client.radar.geolocations.get('3190509'); console.log(geolocation.geolocation); ``` #### Response ```json { "result": { "geolocation": { "geoId": "2267056", "latitude": "10", "longitude": "10", "name": "Lisbon", "parent": { "geoId": "2267056", "latitude": "10", "longitude": "10", "name": "Lisbon", "parent": { "geoId": "2267056", "latitude": "10", "longitude": "10", "name": "Lisbon", "type": "CONTINENT", "code": "PT-11", "locale": "pt-PT" }, "type": "CONTINENT", "code": "PT-11", "locale": "pt-PT" }, "type": "CONTINENT", "code": "PT-11", "locale": "pt-PT" } }, "success": true } ``` ## Domain Types ### Geolocation List Response - `GeolocationListResponse` - `geolocations: Array` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `parent: Parent` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `parent: Parent` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation ### Geolocation Get Response - `GeolocationGetResponse` - `geolocation: Geolocation` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `parent: Parent` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `parent: Parent` - `geoId: string` - `latitude: string` A numeric string. - `longitude: string` A numeric string. - `name: string` - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation - `type: "CONTINENT" | "COUNTRY" | "ADM1"` The type of the geolocation. - `"CONTINENT"` - `"COUNTRY"` - `"ADM1"` - `code?: string` - `locale?: string` BCP 47 locale code used for the geolocation name translation