---
updatedAt: 2026-07-17T07:00:41.000Z
agentTools:
  projectIndex: https://developer.searoutes.com/llms.txt
---

# Find the closest locations

This endpoint can be used to retrieve the closest locations from a point ordered by distance or the locations around a point (inside a geographical circle with a given radius (in meters)). You can also choose the number of results. By default, the endpoint only returns the closest location.

The `coordinates` of the point (or center of the circle) must be passed as path parameter as coordinates pair `longitude,latitude`.

The query parameter `locationTypes` allows to filter the types returned. A list of values can be passed among `port,airport,zipcode,railTerminal, roadTerminal`. 
If this parameter is not passed in the query, all the types will be searched.

The query parameter `sizes` allows to filter the sizes of the locations returned for ports and airports.

For each location found, geometry (coordinates) is returned as well as a `properties` field that contains different information according to the type of the location.

For ports : `name`, `locode`, `country`, `countryName`, `size` and `distance` (in meters) from the point passed in the query.

For airports : `name`, `locode`, `size`, `iataCode`, `countryName`, `countryCode` (as a two letters code), `subdivisionName`, `city`.

For zipcodes : `name`, `countryCode`, `countryName`, `postalCode` and `distance` (in meters) from the point passed in the query.

For rail terminals and road terminals : `name`, `locode`, `countryCode`, `countryName` and `distance` (in meters) from the point passed in the query.


# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "version": "2.10.0",
    "title": "Geocoding",
    "description": "# Introduction\nGeocoding\n",
    "termsOfService": "https://searoutes.com/terms-of-service/",
    "contact": {
      "email": "support@searoutes.com",
      "url": "https://searoutes.com"
    },
    "x-logo": {
      "url": "/img/searoutes-logo-vertical-blue.svg",
      "altText": "Searoutes logo"
    }
  },
  "tags": [
    {
      "name": "Closest coordinates",
      "description": "Closest coordinates"
    }
  ],
  "servers": [
    {
      "url": "https://api.searoutes.com"
    }
  ],
  "paths": {
    "/geocoding/v2/closest/{coordinates}": {
      "get": {
        "operationId": "getGeocodingClosest",
        "tags": [
          "Closest coordinates"
        ],
        "summary": "Find the closest locations",
        "description": "This endpoint can be used to retrieve the closest locations from a point ordered by distance or the locations around a point (inside a geographical circle with a given radius (in meters)). You can also choose the number of results. By default, the endpoint only returns the closest location.\n\nThe `coordinates` of the point (or center of the circle) must be passed as path parameter as coordinates pair `longitude,latitude`.\n\nThe query parameter `locationTypes` allows to filter the types returned. A list of values can be passed among `port,airport,zipcode,railTerminal, roadTerminal`. \nIf this parameter is not passed in the query, all the types will be searched.\n\nThe query parameter `sizes` allows to filter the sizes of the locations returned for ports and airports.\n\nFor each location found, geometry (coordinates) is returned as well as a `properties` field that contains different information according to the type of the location.\n\nFor ports : `name`, `locode`, `country`, `countryName`, `size` and `distance` (in meters) from the point passed in the query.\n\nFor airports : `name`, `locode`, `size`, `iataCode`, `countryName`, `countryCode` (as a two letters code), `subdivisionName`, `city`.\n\nFor zipcodes : `name`, `countryCode`, `countryName`, `postalCode` and `distance` (in meters) from the point passed in the query.\n\nFor rail terminals and road terminals : `name`, `locode`, `countryCode`, `countryName` and `distance` (in meters) from the point passed in the query.\n",
        "parameters": [
          {
            "name": "coordinates",
            "description": "coordinates pair of the point as `longitude,latitude`. Longitude should be between -180 and 180 degrees, and latitude between -90 and 90 degrees.",
            "in": "path",
            "required": true,
            "schema": {
              "default": "9.965629577636719,53.53296196255539",
              "example": "9.965629577636719,53.53296196255539",
              "type": "string"
            }
          },
          {
            "name": "radius",
            "description": "the radius of the geographical circle used to search closest locations (in meters). If not passed, the closest locations are retrieved.",
            "in": "query",
            "required": false,
            "schema": {
              "example": 10000,
              "type": "number"
            }
          },
          {
            "name": "locationTypes",
            "description": "A list of strings used to filter the location types. Permitted values are `port, airport, zipcode, railTerminal, roadTerminal`. If not passed, all the types will be taken into account.",
            "in": "query",
            "required": false,
            "schema": {
              "example": "port,airport,railTerminal",
              "type": "string"
            }
          },
          {
            "name": "sizes",
            "description": "A list of strings used to filter the location by size. Permitted values are `large`, `medium`, `small` and `tiny`. Note that this parameter is available for ports and airports search only. If not passed, all the sizes will be taken into account.",
            "in": "query",
            "required": false,
            "schema": {
              "example": "large,medium",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "description": "The maximum number of results (between 0 and 50). If not passed, the default limit is 1.",
            "in": "query",
            "required": false,
            "schema": {
              "example": 10,
              "type": "integer"
            }
          },
          {
            "name": "countryCodes",
            "description": "A list of country codes (2 characters ISO) used to filter the location by country.",
            "in": "query",
            "required": false,
            "schema": {
              "example": "DE,FR",
              "type": "string"
            }
          },
          {
            "name": "excludeCountryCodes",
            "description": "A list of country codes (2 characters ISO) used to exclude location of some countries.",
            "in": "query",
            "required": false,
            "schema": {
              "example": "US,CA",
              "type": "string"
            }
          }
        ],
        "x-code-samples": [
          {
            "lang": "curl",
            "source": "curl -X GET \\\nhttps://api.searoutes.com/geocoding/v2/closest/-40.25390625,81.69784444971418 \\\n-H 'x-api-key: <your-api-key-here>'\n"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "type": "FeatureCollection",
                  "features": [
                    {
                      "type": "Feature",
                      "properties": {
                        "locationType": "airport",
                        "name": "Alert Airport",
                        "locode": "CAYLT",
                        "iataCode": "YLT",
                        "countryCode": "CA",
                        "countryName": "Canada",
                        "distance": 346055
                      },
                      "geometry": {
                        "type": "Point",
                        "coordinates": [
                          -62.2806015015,
                          82.5177993774
                        ]
                      }
                    }
                  ],
                  "properties": null
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "example": {
                  "timestamp": 1625224069293,
                  "status": 400,
                  "error": "Bad Request",
                  "errorCodes": [
                    "4001"
                  ],
                  "messages": [
                    "Value 'test' is of invalid type for parameter 'locationTypes'."
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Geocoding service unavailable.",
            "content": {
              "application/json": {
                "example": {
                  "timestamp": 1626167007887,
                  "status": 503,
                  "error": "Service Unavailable",
                  "errorCodes": [
                    "5010"
                  ],
                  "messages": [
                    "Geocoding service unavailable."
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header",
        "description": "Use your `x-api-key` to authenticate with our APIs. Note that your key is tied with a usage plan. You are therefore rate limited depending on your subscription. If you wish you increase your request calls, please [get in touch with us](/contact/)."
      }
    }
  }
}
```