---
title: "List countries with at least one routable port"
method: GET
path: "/api/v1/ports/countries"
tags: ["grandline"]
---

# List countries with at least one routable port

`GET /api/v1/ports/countries`

## Request

- Base URL: `https://grandline.luzomi.com`
- URL: `https://grandline.luzomi.com/api/v1/ports/countries`
- Auth: none declared

Drives the country dropdown on either side of the distance calculator.

Without `from_port_id` (used by the From side), returns every country that
has at least one port flagged `routable_origin` in the cache.

With `from_port_id` (used by the To side after From is chosen), returns
only countries that have at least one port flagged `routable_dest`
AND that has a cached row paired with the given origin.

## Query parameters

- `from_port_id` integer, nullable: Optional. If set, only return countries that have at least one port reachable as a destination from this origin port_id. Used by the To-side dropdown to suppress dead-end picks.

## Response `200`

Successful Response

- CountryRow[]
  - `iso2` string, required
  - `name` string, required
  - `port_count` integer, required

## Other responses

- `400`: Validation error with extra context
- `404`: Resource not found
- `422`: Validation Error
- `429`: Rate-limit exceeded — see X-RateLimit-* headers

---

[API](https://skmtc.dev/luzomi/apis/grandline-api.md) · [All operations](https://skmtc.dev/luzomi/apis/grandline-api/llms.txt) · [OpenAPI document](https://skmtc.dev/luzomi/apis/grandline-api/revisions/4ce06aea012b?raw)
