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

# Find port by name or locode

This endpoint does forward geocoding: given a name or a locode, it returns ports matching the request with their name, locode, country, size, coordinates and whether the port is in an eca zone or not.

Use either `locode` or `query`, not both in the same 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": "By location type",
      "description": "By Location Type"
    }
  ],
  "servers": [
    {
      "url": "https://api.searoutes.com"
    }
  ],
  "paths": {
    "/geocoding/v2/port": {
      "get": {
        "operationId": "getGeocodingPort",
        "tags": [
          "By location type"
        ],
        "summary": "Find port by name or locode",
        "description": "This endpoint does forward geocoding: given a name or a locode, it returns ports matching the request with their name, locode, country, size, coordinates and whether the port is in an eca zone or not.\n\nUse either `locode` or `query`, not both in the same query.\n",
        "parameters": [
          {
            "name": "locode",
            "description": "A string representing the locode of the searched airport.",
            "in": "query",
            "required": false,
            "schema": {
              "example": "FRMRS",
              "type": "string"
            }
          },
          {
            "name": "query",
            "description": "A partial string used for search. For instance, part of an port name or part of a locode.",
            "in": "query",
            "required": false,
            "schema": {
              "default": "FRMRS",
              "example": "FRMRS",
              "type": "string"
            }
          },
          {
            "name": "sizes",
            "description": "A list of strings used to filter the locations by size. Permitted values are `large`, `medium`, `small`, `tiny`. If not passed, all the sizes will be taken into account.",
            "in": "query",
            "required": false,
            "schema": {
              "example": "large,medium",
              "type": "string"
            }
          },
          {
            "name": "countryCodes",
            "description": "A list of country codes (2 characters ISO) used to filter the locations 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 locations 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/port?query=DEHAM \\\n-H 'x-api-key: <your-api-key-here>'\n"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "type": "FeatureCollection",
                  "features": [
                    {
                      "type": "Feature",
                      "properties": {
                        "name": "Hamburg",
                        "locode": "DEHAM",
                        "countryCode": "DE",
                        "country": "Germany",
                        "subdivision": "HH",
                        "type": "port",
                        "isSeca": true,
                        "size": "large"
                      },
                      "geometry": {
                        "type": "Point",
                        "coordinates": [
                          9.93855,
                          53.519272
                        ]
                      }
                    }
                  ],
                  "properties": null
                }
              }
            }
          },
          "404": {
            "description": "Location not found for type port.",
            "content": {
              "application/json": {
                "example": {
                  "timestamp": 1625223863077,
                  "status": 404,
                  "error": "Not Found",
                  "errorCodes": [
                    "1040"
                  ],
                  "messages": [
                    "Location 'Bobigny' not found for type port."
                  ]
                }
              }
            }
          },
          "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/)."
      }
    }
  }
}
```