---
title: "Distance"
method: GET
path: "/distance"
tags: ["Credit methods"]
---

# Distance

`GET /distance`

## Request

- Base URL: `https://api.vesselfinder.com`
- URL: `https://api.vesselfinder.com/distance`
- Auth: API key in query parameter `userkey`

Calculates the shortest sea route between two points and returns it as a GeoJSON
`Feature` with a `LineString` geometry. All gateways (canals, straits, passages) are
closed by default; open them with `gateways`. XML is not supported.

## Query parameters

- `errormode` 409
- `from` string, required
- `to` string, required
- `gateways` string
- `ECA` 'allow' | 'deny' | 'minimize'
- `EPSG3857` 0 | 1

## Response `200`

Route as a GeoJSON Feature.

- union
  - RouteFeature: GeoJSON Feature (RFC 7946).
    - `type` 'Feature', required
    - `geometry` object, required
      - `type` 'LineString'
      - `coordinates` array[]: `[lon, lat]` pairs (or EPSG:3857 `[x, y]` with `EPSG3857=1`).
        - number[]
    - `properties` object, required
      - `Crossing` string[]: Straits
      - `Distance` integer: Route length
      - `DistanceECA` integer: Length inside ECA zones
  - Error: Returned with HTTP 200 (default error mode) when parameters are invalid, the account is expired or blocked, or credits are insufficient. In XML: `<error>ERROR DESCRIPTION</error>`.
    - `error` string, required

## Other responses

- `409`: Error, returned only when `errormode=409` is set.

---

[API](https://skmtc.dev/vesselfinder/apis/vesselfinder-api.md) - [All operations](https://skmtc.dev/vesselfinder/apis/vesselfinder-api/llms.txt) - [OpenAPI document](https://skmtc.dev/vesselfinder/apis/vesselfinder-api/revisions/da7c595e3467?raw)
