1. Home
  2. Docs
  3. Getting started
  4. JSONP Callbacks

JSONP Callbacks

The ClarifyIP API supports JSONP Callbacks, enabling you to enter a function name and prompt the API to return your requested API result wrapped inside that function. In order to specify a callback, pass a function name into the API’s callback GET parameter.

Example Request: In our example request, we are specifying the function name to be MY_FUNCTION

https://api.clarifyip.com/?key=YOUR_ACCESS_KEY&ip=185.245.87.169&callback=MY_FUNCTION

Example Response: Your API response will be wrapped inside your preferred callback function.

MY_FUNCTION({  
   "connection":{  
      "asn":9009,
      "ip":"185.245.87.169",
      "isp":"M247 Ltd",
      "type":"ipv4"
   },
   "zip":"90014",
   "city":{  
      "name":"Los Angeles",
      "id":5368361
   },
   "location":{  
      "metro_code":34.0494,
      "languages":[  
         "eng"
      ],
      "calling_code":[  
         "+1"
      ],
      "flag":"//cdn.clarifyip.com/assets/flags/svg/us.svg",
      "emoji":"??",
      "latitude":34.0494,
      "longitude":-118.2641
   },
   "country":{  
      "code_3":"USA",
      "name":"United States",
      "id":6252001,
      "code":"US"
   },
   "region":{  
      "code":"CA",
      "name":"California"
   },
   "continent":{  
      "name":"North America",
      "id":6255149,
      "code":"NA"
   },
   "time_zone":{  
      "id":"America/Los_Angeles"
   }
});

Please note: JSONP Callbacks can only be used if the user sets the API output format to json.

Was this article helpful to you? Yes No

How can we help?