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:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
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
}