Authentication
You'll need to authenticate your requests to access any of the endpoints in the ipbase API. In this guide, we'll look at how authentication works. ipbase offers two ways to authenticate your API requests: API key as GET parameter, or via request header.
GET query parameter
You can pass your API key along with every request by adding it as a query parameter apikey
Example request with authentication via get request
curl "https://api.ipbase.com/v2/info?ip=1.1.1.1&apikey=YOUR-APIKEY"
Please don't commit your ipbase API key to GitHub!
HTTP Header
The recommended way to authenticate with the ipbase API through a HTTP request header:
Example request with authentication via header
curl "https://api.ipbase.com/v2/info?ip=1.1.1.1" \
-H "apikey: YOUR-API-KEY"
Always keep your API key safe and reset it if you suspect it has been compromised.
Using an SDK
If you use one of our official SDKs, you won't have to worry about any of the above — grab your API key from the ipbase dashboard, pass it to the client on instantiation, and the library takes care of authenticating every request for you.