Docs / Rates

Distance

Measures the distance between two points. A point can be coordinates or a country code.

POST/v1/geo/distance
import { Client } from "@liveapiio/liveapi";

const client = new Client({ token: process.env.LIVEAPI_TOKEN });

const distance = await client.distance({ country: "TR" }, { country: "DE" });

Request

Send Authorization: Bearer YOUR_TOKEN. The token stays on your server. Each library reads it from the environment and calls this endpoint for you.

FieldTypeDescription
fromobjectlatitude and longitude, or country. Required.
toobjectlatitude and longitude, or country. Required.

Response

A 200 response uses one call. Returns kilometers and the resolved coordinates of both points.

Errors

A failed request returns { "error": { "code", "message" } } and does not use a call.

StatusCodeWhen
400invalid_requestA required field is missing or has the wrong type.
401unauthorizedThe bearer token is missing or not recognized.

We value your privacy

We use necessary cookies to run this website. With your consent, we would also like to use analytics and marketing cookies. Read our cookie policy.