Reverse Geocoding

Reverse Geocoding

Maps Credits / request: 100

Converts coordinates into an address and address parts.

GET https://api.apikodu.com/api/v1/maps/reversegeocode
Documentation
Overview

Converts coordinates to an address.

Authentication

Every request requires the x-api-key header. Credits used and remaining quota are returned in response headers (x-api-credits-used, x-api-remaining-credits, x-rate-limit-*).

Request
GET https://api.apikodu.com/api/v1/maps/reversegeocode?latitude=40.98765&longitude=29.02541&includeAll=false
Query string.
Parameters
Name Type Required Default Options Description
latitude number * Required — — -90 .. 90.
longitude number * Required — — -180 .. 180.
includeAll boolean Optional false true false All candidates.
Response
Name Type Description
results array Candidate addresses. Usually one item (best match) when includeAll=false.
results[].formattedAddress string Single-line formatted address.
results[].latitude number Latitude WGS84.
results[].longitude number Longitude WGS84.
results[].accuracy string Location accuracy. Example: rooftop, range_interpolated, geometric_center, approximate.
results[].isPartialMatch boolean true when Google returned a partial match (address did not fully match).
results[].countryCode string ISO country code (TR, EE ...).
results[].country string Country name.
results[].region string Region / province (administrative_area_level_1).
results[].district string District.
results[].locality string Locality / city.
results[].neighborhood string Neighborhood.
results[].postalCode string Postal code.
results[].street string Street name.
results[].streetNumber string Street number.
results[].level string Result level. Example: street, locality, country.
results[].viewport object Map viewport with northeast and southwest points.
results[].viewport.northeast.latitude number Viewport northeast latitude.
results[].viewport.northeast.longitude number Viewport northeast longitude.
results[].viewport.southwest.latitude number Viewport southwest latitude.
results[].viewport.southwest.longitude number Viewport southwest longitude.
Errors
HTTP code Description
400 -232 latitude is outside -90..90.
400 -233 longitude is outside -180..180.
500 -237 Google Maps service is not configured.
502 -238 Google reverse geocoding request failed.
401 -100 x-api-key is missing, empty, malformed, inactive, banned, expired, IP-restricted, or not allowed for this API.
429 -221 Per-minute request limit exceeded. Response headers: x-rate-limit-limit, x-rate-limit-remaining, x-rate-limit-reset.
429 — Package credit quota cannot cover this request. Body may be { error, limit, currentUsage, requestCost } (no code field).
500 -1 Unexpected server error. message is a generic error text without technical details.
Notes
  • Success body is { data: { ... } }. Error body is { code, message }. code is an ApiResponseCode enum value (negative integer).

Sample response

{
  "data": {
    "results": [
      {
        "formattedAddress": "Moda Caddesi No:12, Kadıköy/İstanbul, Türkiye",
        "latitude": 40.98765,
        "longitude": 29.02541,
        "accuracy": "rooftop",
        "isPartialMatch": false,
        "countryCode": "TR",
        "country": "Türkiye",
        "region": "İstanbul",
        "district": "Kadıköy",
        "locality": "İstanbul",
        "neighborhood": "Moda",
        "postalCode": "34710",
        "street": "Moda Caddesi",
        "streetNumber": "12",
        "level": "street",
        "viewport": {
          "northeast": {
            "latitude": 40.9889,
            "longitude": 29.0267
          },
          "southwest": {
            "latitude": 40.9863,
            "longitude": 29.0241
          }
        }
      }
    ]
  }
}

Code samples

  
      const response = await fetch('https://api.apikodu.com/api/v1/maps/reversegeocode', {
        method: 'GET',
        headers: {
          'x-api-key': 'YOUR_API_KEY'
        }
      });

      const data = await response.json();
      console.log(data);
  
  
      import requests

      headers = {
          'x-api-key': 'YOUR_API_KEY'
      }

      response = requests.get('https://api.apikodu.com/api/v1/maps/reversegeocode', headers=headers)
      print(response.json())
  
  
      using var client = new HttpClient();
      client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");

      var response = await client.GetStringAsync("https://api.apikodu.com/api/v1/maps/reversegeocode");
      Console.WriteLine(response);
  
  
      $response = file_get_contents('https://api.apikodu.com/api/v1/maps/reversegeocode', false, stream_context_create([
          'http' => [
              'header' => "x-api-key: YOUR_API_KEY"
          ]
      ]));

      print_r(json_decode($response, true));
  
  
      curl -X GET 'https://api.apikodu.com/api/v1/maps/reversegeocode' \
        -H 'x-api-key: YOUR_API_KEY'
  

Start building in minutes

Create a free account, get your API key and send your first request in minutes.

Get started free