Skip to content
Start here

Get IP address details

client.Radar.Entities.Get(ctx, query) (*EntityGetResponse, error)
GET/radar/entities/ip

Retrieves IP address information.

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
query EntityGetParams
IP param.Field[string]

IP address.

formatip
Format param.Field[EntityGetParamsFormat]optional

Format in which results will be returned.

const EntityGetParamsFormatJson EntityGetParamsFormat = "JSON"
const EntityGetParamsFormatCsv EntityGetParamsFormat = "CSV"
ReturnsExpand Collapse
type EntityGetResponse struct{…}
IP EntityGetResponseIP
ASN string
ASNLocation string
ASNName string
ASNOrgName string
IP string
IPVersion string
Location string
LocationName string

Get IP address 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"),
  )
  entity, err := client.Radar.Entities.Get(context.TODO(), radar.EntityGetParams{
    IP: cloudflare.F("8.8.8.8"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", entity.IP)
}
{
  "result": {
    "ip": {
      "asn": "15169",
      "asnLocation": "US",
      "asnName": "GOOGLE",
      "asnOrgName": "Google LLC",
      "ip": "8.8.8.8",
      "ipVersion": "IPv4",
      "location": "GB",
      "locationName": "United Kingdom"
    }
  },
  "success": true
}
Returns Examples
{
  "result": {
    "ip": {
      "asn": "15169",
      "asnLocation": "US",
      "asnName": "GOOGLE",
      "asnOrgName": "Google LLC",
      "ip": "8.8.8.8",
      "ipVersion": "IPv4",
      "location": "GB",
      "locationName": "United Kingdom"
    }
  },
  "success": true
}