API reference / Risk & Location

Reverse geocode

Address, city, state and pincode for a latitude and longitude.

POST/v1/geo/reverse-geocode
Authentication
Bearer token
Scope
kyc:verify

Request body

FieldTypeRequiredDescription
latitudenumberYesLatitude from -90 to 90; a numeric string is also accepted.
longitudenumberYesLongitude from -180 to 180; a numeric string is also accepted.

Sample code

Set your key in the GRAPPI_API_KEY environment variable. Sample values are placeholders.

curl -sS -X POST 'https://grappi.ai/v1/geo/reverse-geocode' \
  -H "Authorization: Bearer $GRAPPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "latitude": 19.076,
  "longitude": 72.8777
}'

Sample response

{
  "request_id": "req_01HZY3K8M2",
  "result": {
    "address": "12 Example Lane, Pune, Maharashtra 411001, India",
    "city": "Pune",
    "state": "Maharashtra",
    "state_code": "MH",
    "country": "India",
    "country_code": "IN",
    "zipcode": "411001",
    "latitude": "18.5204",
    "longitude": "73.8567",
    "confidence_score": 0.92
  }
}

Response fields

FieldTypeDescription
addressstringFull address of the place.
citystringCity.
statestringState.
state_codestringState code.
countrystringCountry.
country_codestringTwo-letter country code.
zipcodestringPincode.
latitudestringLatitude of the matched place.
longitudestringLongitude of the matched place.
confidence_scorenumberHow confident the match is.

Errors

Every failure has the same shape. A call that fails on our side or at the data source is refunded to your wallet; a "no record found" answer is charged. See the error reference.