JSON Response


We try to automatically detect when someone wants to call our API versus view our website, and then we send back the appropriate JSON response rather than HTML. We do this based on the user agent for known popular programming languages, tools, and frameworks. However, there are a couple of other ways to force a JSON response when it doesn't happen automatically.

One is to append /json at the end of any request:

$ curl api.ip.cc/json
$ curl api.ip.cc/8.8.8.8/json

The other is to set the Accept header to application/json:

$ curl -H "Accept: application/json" api.ip.cc
$ curl -H "Accept: application/json" api.ip.cc/8.8.8.8