Geolocation

Response

Geolocation response fields, address detail components and metadata returned when enabled.

Sample JSON response:

{
"status":"ok",
"balance":0,
"lat":39.56764454,
"lon":-105.00728197,
"accuracy":10,
"address":"High Line Canal Trail, Littleton, Douglas County, Colorado, 80129, United States of America"
}

The response will be a JSON object and may contain the following elements. Every location is calculated from our large, continuously-updated database of cell and WiFi observations - use the accuracy and fallback fields below to gauge confidence in a given result.

ParameterDescription
statusIf the request is successful, ok is returned. Otherwise error is returned
messageContains a specific error message when status is error. This field can be used for programmatic error handling. Read more
helpWhen present, may include additional context about errors for informational purposes. This field is provided for human readability and should not be used for programmatic error handling.
balanceApproximate remaining balance on the API token. Requests that return error are not charged. Use the balance endpoint for more accurate values.
balance_slotsApproximate remaining balance of device slots. Requests that return error are not charged. A value of -1 indicates an error in retrieving the slots balance. Only appears for device plans.
latThe latitude representing the location
lonThe longitude representing the location
accuracyThe accuracy of the position is returned in meters
addressThe physical address of the location
address_detailThe physical address of the location broken into sub-components. Read more
agedShown when the location is based on a single measurement or those older than 90 days or is an LAC fallback
fallbackShown when the location is based on a fallback. Possible options include ipf, lacf, scf, cidf, ncf.
metadataAn object that contains additional information about the request or response, if any, and is shown when metadata is set to 1 in the request. Read more

Address Detail

The API only returns components that have valid values for a location. Component town is normalized to city to make things simple. For more granular control, please use our Geocoding service - LocationIQ.

Components that would be returned are:

  • area
  • locality
  • district
  • county
  • city
  • state
  • country
  • country_code
  • postal_code

Metadata

When metadata is enabled, the Geolocation API returns additional information about the request or response. For example, when a gps object is sent in the request, the API response will look similar to the example below.

Sample response with the metadata object

{
    "status": "ok",
    "balance": 266647,
    "lat": 39.56764858,
    "lon": -105.00733121,
    "accuracy": 120,
    "metadata": {
        "gps": {
            "status": "ok",
            "gps_sandbox": 0
        }
    }
}

Since the information inside the metadata object primarily contains debug information, its elements may change without notice. We recommend that you program defensively to avoid breaking your program when these values change.

On this page