Back to Geocoding & Reverse Geocoding

Geocoding & Reverse Geocoding API

Convert addresses to coordinates and back. Forward geocode, reverse geocode, with structured address components.

Overview

The Geocoding API provides both forward and reverse geocoding with structured address components. Submit an address to receive precise latitude/longitude coordinates, or submit coordinates to receive a formatted address with city, state, postal code, and country details.

  • Forward geocoding: address → coordinates
  • Reverse geocoding: coordinates → address
  • Structured address components (city, state, zip, country)
  • Batch processing support for high-volume workflows

Authentication

All API requests require a RapidAPI key passed via the request header. Subscribe to any plan on RapidAPI to receive your API key.

Header
X-RapidAPI-Key: your-api-key

Endpoints

POST /v1/geocode/forward

Converts a human-readable address into latitude/longitude coordinates and structured components.

POST /v1/geocode/reverse

Converts latitude/longitude coordinates into a formatted address with structured components.

Request

Forward Geocode

ParameterTypeRequiredDescription
addressstringYesStreet address, city, state, and/or postal code
countrystringNoTwo-letter country code to scope results (e.g. US, CA)

Reverse Geocode

ParameterTypeRequiredDescription
latitudenumberYesLatitude coordinate (e.g. 35.1395)
longitudenumberYesLongitude coordinate (e.g. -90.0518)
Example Request Body (Forward)
{
  "address": "191 Beale St, Memphis, TN 38103"
}
Example Request Body (Reverse)
{
  "latitude": 35.1395,
  "longitude": -90.0518
}

Response

A successful geocode returns a 200 status with a results array.

FieldTypeDescription
resultsarrayArray of geocode result objects
results[].address_componentsobjectStructured address: number, street, city, state, postal_code, etc.
results[].address_linesarrayFormatted address lines for display
results[].formatted_addressstringSingle-line formatted address
results[].locationobjectCoordinates: latitude (number), longitude (number)
results[].propertiesobjectAdditional metadata: gid, fullname, zip range
Example Response (200 OK)
{
  "results": [
    {
      "address_components": {
        "number": "191",
        "street": "Beale",
        "suffix": "St",
        "formatted_street": "Beale St",
        "city": "Memphis",
        "state_province": "TN",
        "postal_code": "38103"
      },
      "formatted_address": "191 Beale St, Memphis, TN 38103",
      "location": {
        "latitude": 35.139537,
        "longitude": -90.051832
      }
    }
  ]
}

Error Codes

StatusCodeMessageDescription
400MISSING_PARAMMissing required parameterRequired field (address or latitude/longitude) is missing
400INVALID_COORDSInvalid latitude or longitude valuesCoordinates must be valid numeric values within range
404NOT_FOUNDAddress or coordinates not foundNo results could be matched to the input
401UNAUTHORIZEDInvalid or missing API keyThe X-RapidAPI-Key header is missing or invalid
429RATE_LIMITRate limit exceededRequest limit for your plan has been reached
500INTERNAL_ERRORInternal server errorAn unexpected error occurred. Please try again.

Code Examples

cURL (Forward)

curl --request POST \
--url https://frapi-geocode-v1.p.rapidapi.com/v1/geocode/forward \
--header 'X-RapidAPI-Key: your-api-key' \
--header 'Content-Type: application/json' \
--data '{"address": "191 Beale St, Memphis, TN 38103"}'

Python (Reverse)

import requests url = "https://frapi-geocode-v1.p.rapidapi.com/v1/geocode/reverse" headers = { "X-RapidAPI-Key": "your-api-key", "Content-Type": "application/json" } data = { "latitude": 35.1395, "longitude": -90.0518 } response = requests.post(url, json=data, headers=headers) print(response.json())

JavaScript (Forward)

const url = 'https://frapi-geocode-v1.p.rapidapi.com/v1/geocode/forward'; const options = { method: 'POST', headers: { 'X-RapidAPI-Key': 'your-api-key', 'Content-Type': 'application/json' }, body: JSON.stringify({ address: '191 Beale St, Memphis, TN 38103' }) }; const response = await fetch(url, options); const data = await response.json(); console.log(data);

Rate Limits

Request limits depend on your subscription tier. Exceeding your limit returns a 429 status.

TierRequests / MonthRate Limit
Starter (Free)50010 req/min
Pro10,00060 req/min
Enterprise100,000300 req/min

Try It Out

Test the API right in your browser. No API key required.