Skip to content
Start here

Get Geolocation details

client.Radar.Geolocations.Get(ctx, geoID, query) (*GeolocationGetResponse, error)
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).

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
User Details WriteUser Details Read
ParametersExpand Collapse
geoID string

Geolocation ID. Refer to GeoNames

maxLength100
query GeolocationGetParams
Format param.Field[GeolocationGetParamsFormat]optional

Format in which results will be returned.

const GeolocationGetParamsFormatJson GeolocationGetParamsFormat = "JSON"
const GeolocationGetParamsFormatCsv GeolocationGetParamsFormat = "CSV"
ReturnsExpand Collapse
type GeolocationGetResponse struct{…}
Geolocation GeolocationGetResponseGeolocation
GeoID string
Latitude string

A numeric string.

Longitude string

A numeric string.

Name string
Parent GeolocationGetResponseGeolocationParent
GeoID string
Latitude string

A numeric string.

Longitude string

A numeric string.

Name string
Parent GeolocationGetResponseGeolocationParentParent
GeoID string
Latitude string

A numeric string.

Longitude string

A numeric string.

Name string
Type GeolocationGetResponseGeolocationParentParentType

The type of the geolocation.

One of the following:
const GeolocationGetResponseGeolocationParentParentTypeContinent GeolocationGetResponseGeolocationParentParentType = "CONTINENT"
const GeolocationGetResponseGeolocationParentParentTypeCountry GeolocationGetResponseGeolocationParentParentType = "COUNTRY"
const GeolocationGetResponseGeolocationParentParentTypeAdm1 GeolocationGetResponseGeolocationParentParentType = "ADM1"
Code stringoptional
Locale stringoptional

BCP 47 locale code used for the geolocation name translation

Type GeolocationGetResponseGeolocationParentType

The type of the geolocation.

One of the following:
const GeolocationGetResponseGeolocationParentTypeContinent GeolocationGetResponseGeolocationParentType = "CONTINENT"
const GeolocationGetResponseGeolocationParentTypeCountry GeolocationGetResponseGeolocationParentType = "COUNTRY"
const GeolocationGetResponseGeolocationParentTypeAdm1 GeolocationGetResponseGeolocationParentType = "ADM1"
Code stringoptional
Locale stringoptional

BCP 47 locale code used for the geolocation name translation

Type GeolocationGetResponseGeolocationType

The type of the geolocation.

One of the following:
const GeolocationGetResponseGeolocationTypeContinent GeolocationGetResponseGeolocationType = "CONTINENT"
const GeolocationGetResponseGeolocationTypeCountry GeolocationGetResponseGeolocationType = "COUNTRY"
const GeolocationGetResponseGeolocationTypeAdm1 GeolocationGetResponseGeolocationType = "ADM1"
Code stringoptional
Locale stringoptional

BCP 47 locale code used for the geolocation name translation

Get Geolocation details

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/radar"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  geolocation, err := client.Radar.Geolocations.Get(
    context.TODO(),
    "3190509",
    radar.GeolocationGetParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", geolocation.Geolocation)
}
{
  "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
}
Returns Examples
{
  "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
}