> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.sare.africa/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.sare.africa/_mcp/server.

# Reverse Geocode

POST http://localhost:8080/api/v3/geolocation/reverse-geocode
Content-Type: application/json

Public (geolocation/reverse-geocode whitelisted).

Reference: https://apidocs.sare.africa/sare-core-api/integrations/geolocation/reverse-geocode

## Request

### Body (application/json)

This endpoint expects an object.

- `latitude` (double, required)
- `longitude` (double, required)
- `locationType` (string, required)
- `formattedAddr` (string, required)

## Response

### 200

OK

- `code` (integer, required)
- `data` (object, required)
  - `county` (string, required)
  - `address` (string, required)
- `message` (string, required)

## Examples

**Request**

```json
{
  "latitude": -1.286389,
  "longitude": 36.817223,
  "locationType": "ROOFTOP",
  "formattedAddr": "Nairobi, Kenya"
}
```

**Response**

```json
{
  "code": 200,
  "data": {
    "county": "Nairobi",
    "address": "Nairobi, Kenya"
  },
  "message": "Success"
}
```

**SDK Code**

```python Integrations_Geolocation_Reverse Geocode_example
import requests

url = "http://localhost:8080/api/v3/geolocation/reverse-geocode"

payload = {
    "latitude": -1.286389,
    "longitude": 36.817223,
    "locationType": "ROOFTOP",
    "formattedAddr": "Nairobi, Kenya"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Integrations_Geolocation_Reverse Geocode_example
const url = 'http://localhost:8080/api/v3/geolocation/reverse-geocode';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"latitude":-1.286389,"longitude":36.817223,"locationType":"ROOFTOP","formattedAddr":"Nairobi, Kenya"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Integrations_Geolocation_Reverse Geocode_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/api/v3/geolocation/reverse-geocode"

	payload := strings.NewReader("{\n  \"latitude\": -1.286389,\n  \"longitude\": 36.817223,\n  \"locationType\": \"ROOFTOP\",\n  \"formattedAddr\": \"Nairobi, Kenya\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Integrations_Geolocation_Reverse Geocode_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v3/geolocation/reverse-geocode")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"latitude\": -1.286389,\n  \"longitude\": 36.817223,\n  \"locationType\": \"ROOFTOP\",\n  \"formattedAddr\": \"Nairobi, Kenya\"\n}"

response = http.request(request)
puts response.read_body
```

```java Integrations_Geolocation_Reverse Geocode_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v3/geolocation/reverse-geocode")
  .header("Content-Type", "application/json")
  .body("{\n  \"latitude\": -1.286389,\n  \"longitude\": 36.817223,\n  \"locationType\": \"ROOFTOP\",\n  \"formattedAddr\": \"Nairobi, Kenya\"\n}")
  .asString();
```

```php Integrations_Geolocation_Reverse Geocode_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8080/api/v3/geolocation/reverse-geocode', [
  'body' => '{
  "latitude": -1.286389,
  "longitude": 36.817223,
  "locationType": "ROOFTOP",
  "formattedAddr": "Nairobi, Kenya"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Integrations_Geolocation_Reverse Geocode_example
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v3/geolocation/reverse-geocode");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"latitude\": -1.286389,\n  \"longitude\": 36.817223,\n  \"locationType\": \"ROOFTOP\",\n  \"formattedAddr\": \"Nairobi, Kenya\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Integrations_Geolocation_Reverse Geocode_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "latitude": -1.286389,
  "longitude": 36.817223,
  "locationType": "ROOFTOP",
  "formattedAddr": "Nairobi, Kenya"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v3/geolocation/reverse-geocode")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```