Quick Start

Getting started with the Fastah IP Geolocation REST API


First off, subscribe to the Fastah IP Geolocation API on AWS Marketplace. Once you pick a subscription plan and billing term, you will be redirected to the Fastah Developer Console to create an account and obtain your API key.

Once you have obtained your personal Fastah API key, proceed to the following step of making your first API call.

Make an API call

Use either of the following styles to lookup a specific IP, or let the Fastah backend autodetect the client's public IP address

curl \
        -X GET "https://ep.api.getfastah.com/whereis/v1/json/" \
        -H "Fastah-Key: <<fastah-iplocation-demo-key>>" 
curl \
        -X GET "https://ep.api.getfastah.com/whereis/v1/json/auto" \
        -H "Fastah-Key: <<fastah-iplocation-demo-key>>"


Get your key

Make sure to use your own API key from the developer console.

Understanding the response

    "ip": "",
    "isEuropeanUnion": false,
    "locationData": {
        "countryName": "United States",
        "countryCode": "US",
        "cityName": "Boston, MA",
        "cityGeonamesId": 4930956,
        "lat": 42.36,
        "lng": -71.06,
        "tz": "America/New_York",
        "continentCode": "NA"
    "l10n": {
        "currencyName": "Dollar",
        "currencyCode": "USD",
        "langCodes": ["en-US", "es-US", "haw", "fr"]

Here are the key JSON properties you will need to parse. Note that due to the statistical models used for IP geo-location, all locations should be considered approximate.

Field Name



The IP address described in the response


Whether the IP is used in an EU member state


The major city closest to the geo-coordinates described below


The city's lookup key for the GeoNames.org database


The two-letter country code (ISO 3166-1)

lat, lng

The approximate latitude and longitude based on statistical models


The timezone in tzdata string format that is widely supported in date and time packages of most programming languages


The currency in the commonly-used short form, e.g "Dollar" but not "United States Dollar"


The currency code is a 3-letter ISO 4217 code, e.g. "USD".


An array of language locales used in the country - use for text formatting, or translation text lookups.

Always of length >= 1, defaults to "en" as a reasonable fallback when data is not available.

Integration with a backend service

While integrating with a server back end, you will need to determine the visitor's public IP address so that it may be passed to the Fastah API.

The client's public IP address is obtained by inspecting the incoming HTTP request object or context - see your language's HTTP server handler API documentation.

Determine the public IP address

  1. Inspect the X-Forwarded-For header - if present, extract the left-most value from the comma-separated list of IPs if it's present.
X-Forwarded-For: 2001:db8:85a3:8d3:1319:8a2e:370:7348


  1. If the X-Forwarded-For header is absent, simply use the remote IP address with any colons (":") removed - that is split the host and port and use only the host value as the client IP address.

Steps 1 and 2 above are demonstrated below in a Go programming language snippet.

// Use the server handler's object to inspect remote IP address
clientIP := params.HTTPRequest.RemoteAddr
if strings.Contains(clientIP, ":") { // host:port splitting
    if splitIP, _, serr := net.SplitHostPort(clientIP); serr == nil {
          clientIP = splitIP
// Extract X-Forwarded-For imformation if present - and use it
fwdList := params.HTTPRequest.Header.Get("X-Forwarded-For")
if fwdList != "" {
    clientIP = fwdList
        // Extract left-most entry in the comma-seperated list
        leftmost := strings.Split(fwdList, ",")
        if len(leftmost) > 0 {
                    clientIP = leftmost[0] 
clientIP = strings.TrimSpace(clientIP)

Send the request

Simply append the client IP address as a string to the base URL, append the API key as the Fastah-Key HTTP header, and send the request.

url := 'https://ep.api.getfastah.com/whereis/v1/json/' + clientIP

Performance tips - back end

Reuse the same HTTP client for calls to the Fastah API end-point, so that your HTTP connection doesn't have to be re-established every time.
It's highly recommended to enable HTTP/2 support in the client, so that API latency is minimized across all requests, and request+response throughput is maximised between your client and Fastah's API systems.

Integration with a front end (JavaScript)

If you wish to make the browser call the API using XHR or fetch via JavaScript, use the examples below.

Note the URL path ending with auto, which tells the Fastah API backend to auto-detect the client's IP address. Be aware that this will ONLY work for public websites, where the clients are expected to have a public, globally-routable IP address that the Fastah API backend can infer.

  // Fetch is the modern web-standard alternative to XHR
  // API path ends with 'auto' - auto-detect the client's public IP
        { mode: 'cors',
          headers: {'Fastah-Key': '<<fastah-iplocation-demo-key>>'}
  .then(response => response.json())
  .then(data => console.log(data));
  const xhr = new XMLHttpRequest();
  // API path ends with 'auto' - auto-detect the client's public IP
  const url = 'https://ep.api.getfastah.com/whereis/v1/json/auto';
  xhr.open('GET', url);
  xhr.setRequestHeader("Fastah-Key", '<<fastah-iplocation-demo-key>>')
  xhr.onreadystatechange = someHandler;

Performance tips - browser

Consider adding dns-prefetch in the HTML's head to make the API latency extra snappy. If you expect the API call to be made most of the time the page is loaded by the user, add preconnect too to initiate a network connection pre-emptively.

For more information, see the explanation on Mozilla Developer Network.

    <!-- Recommended link tags to turbo-charge Fastah API latency -->
    <link rel="dns-prefetch" href="https://ep.api.getfastah.com/">
    <link rel="preconnect" href="https://ep.api.getfastah.com" crossorigin>
    <!-- and all other head elements -->

Need More Help?

Drop us a line at [email protected] with any questions, bug reports, training requests, or if you just want to chat!

For Postman users

If you use the Postman API development took, use the button below to open the collection in your workspace.

Run in PostmanRun in Postman

Did this page help you?