Elevation profile
POST /api/elevation-profileTerrain elevation for up to 100 points anywhere on land (Copernicus DEM, 90 m), and for an ordered path its distance, total climb and descent...
Details
Terrain elevation for up to 100 points anywhere on land (Copernicus DEM, 90 m), and for an ordered path its distance, total climb and descent, lowest and highest point and steepest leg in percent grade: for routing, drones, hiking, line of sight and flood siting. Cached for up to 24 hours. POST {"points":[[45.83,6.86],[45.92,7.0]]}. Weather data by Open-Meteo.com (CC BY 4.0). Elevation from the Copernicus DEM GLO-90 (European Union and ESA).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
points | array of array | yes | Up to 100 [lat, lon] pairs (or {lat, lon} objects), in path order Up to 100 items. |
Example request
curl -i -X POST https://agent402.tools/api/elevation-profile \
-H "Content-Type: application/json" \
-d '{"points":[[45.8326,6.8652],[45.9237,6.8694],[46.0207,7.7491]]}'Watch a call get paid
POST /api/elevation-profile$0.002 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"count": 3,
"points": [
{
"lat": 45.8326,
"lon": 6.8652,
"elevationM": 4792
},
{
"lat": 45.9237,
"lon": 6.8694,
"elevationM": 1041
},
{
"lat": 46.0207,
"lon": 7.7491,
"elevationM": 1613
}
],
"path": {
"distanceKm": 78.969,
"gainM": 572,
"lossM": 3751,
"minM": 1041,
"maxM": 4792,
"steepestLeg": {
"fromIndex": 0,
"toIndex": 1,
"gradePercent": -37,
"lengthKm": 10.135
}
},
"method": "Elevation of the 90 m terrain cell under each point. Distance is great-circle between consecutive points; climb and descent sum the rises and falls between them, so terrain between points is not counted.",
"source": "api.open-meteo.com elevation (Copernicus DEM GLO-90, CC BY 4.0)",
"credit": "Produced using Copernicus WorldDEM-30 (c) DLR e.V. 2010-2014 and (c) Airbus Defence and Space GmbH 2014-2018, provided under COPERNICUS by the European Union and ESA; all rights reserved. Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains.",
"attributionText": "Weather data by Open-Meteo.com (CC BY 4.0).",
"sourceUrl": "https://open-meteo.com/",
"licenseUrl": "https://creativecommons.org/licenses/by/4.0/"
}| Field | Type | Always present | In the example |
|---|---|---|---|
count | number | yes | 3 |
points | array of objects | yes | 3 items in the example |
path | object | yes | 6 fields: distanceKm, gainM, lossM, minM, maxM, steepestLeg |
method | string | yes | Elevation of the 90 m terrain cell under each point. Distance is great-circle... |
source | string | yes | api.open-meteo.com elevation (Copernicus DEM GLO-90, CC BY 4.0) |
credit | string | yes | Produced using Copernicus WorldDEM-30 (c) DLR e.V. 2010-2014 and (c) Airbus D... |
attributionText | string | yes | Weather data by Open-Meteo.com (CC BY 4.0). |
sourceUrl | string | yes | https://open-meteo.com/ |
licenseUrl | string | yes | https://creativecommons.org/licenses/by/4.0/ |
From an MCP client
catalog.call {
"slug": "elevation-profile",
"params": {
"points": [
[
45.8326,
6.8652
],
[
45.9237,
6.8694
],
[
46.0207,
7.7491
]
]
}
}Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.19.2): pays from a wallet or AGENT402_CREDITS_KEY.
Errors and behavior
- Pay $0.002 per call over x402 or MPP. Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key (
Authorization: Bearer a402_...) also pays it. - Required:
points; a rejected input answers 4xx witherror,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key. A Tempo push credential pays before the call; a failure is a refund owed.
- A bodyless
GETorHEADreturns the same 402 quote. - An
Idempotency-Keyreplays the first 200 uncharged (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.002" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/elevation-profile", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"points": [
[
45.8326,
6.8652
],
[
45.9237,
6.8694
],
[
46.0207,
7.7491
]
]
}),
});Get a wallet or run npx -y agent402-mcp@0.19.2 wallet new.
The quote (Python)
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/api/elevation-profile", method="POST", data="{\"points\":[[45.8326,6.8652],[45.9237,6.8694],[46.0207,7.7491]]}".encode(), headers={"Content-Type": "application/json"})
try:
urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]]) # the price, per chain, in base units