osrmroute
DocsQuickstart
Documentation

Developer automation

Use the CLI and remote MCP with your existing API key.

Postman · Quick start · Postman · API Reference · Postman · JSON ↓ · GitHub

AI Assistant

Business includes 1,000 shared AI operations per monthly billing period. No rollover or automatic overage charges.

A successful search uses 1 AI operation and 2 standard API credits.

AI Search
osrmroute search --json '{"q":"Find cafes near Berlin", "ai":true}'
AI Studio
osrmroute style-preview --json '{"prompt":"A calm dark map with blue water", "ai":true}'

OSRMRoute CLI

Install the source package from our website; Node.js 24 or newer. npm registry publication is separate.

Terminal
npm install -g https://osrmroute.com/downloads/osrmroute-cli-1.0.1.tgz
export OSRMROUTE_API_KEY="YOUR_KEY"
osrmroute geocode --json '{"q":"Berlin"}'
osrmroute search --json '{"q":"cafes near Berlin within 2 km"}'
osrmroute styles
osrmroute --help

Remote MCP

Stateless Streamable HTTP. Configure the endpoint and an Authorization Bearer header in a compatible client. No OAuth discovery or SSE subscriptions.

Normal API scopes, credit charges and limits apply. Studio requires an explicit studio scope. MCP tools cannot publish or delete resources.

Streamable HTTP
POST https://osrmroute.com/api/mcp
Authorization: Bearer $OSRMROUTE_API_KEY
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2025-06-18
initialize
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-06-18",
    "capabilities": {},
    "clientInfo": {
      "name": "example",
      "version": "1.0.0"
    }
  }
}
notifications/initialized
{"jsonrpc":"2.0","method":"notifications/initialized"}
tools/list
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
tools/call
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "natural_search",
    "arguments": {
      "q": "cafes near Berlin"
    }
  }
}

Available MCP tools

  • estimate_fuel

    Estimate trip fuel and monetary value from user calibration. One credit; no road routing or validated error percentage.

    inputSchema
    {
      "type": "object",
      "properties": {
        "distance_km": {
          "type": "number",
          "minimum": 0,
          "maximum": 100000
        },
        "loaded_weight_t": {
          "type": "number",
          "minimum": 0.001,
          "maximum": 100
        },
        "fuel": {
          "type": "object",
          "properties": {
            "empty_weight_t": {
              "type": "number",
              "minimum": 0.001,
              "maximum": 100,
              "description": "Metric tonnes; at most three decimal places."
            },
            "full_weight_t": {
              "type": "number",
              "minimum": 0.001,
              "maximum": 100,
              "description": "Calibration fully loaded gross weight, strictly above empty weight; not a verified legal limit."
            },
            "empty_l_per_100km": {
              "type": "number",
              "minimum": 0.001,
              "maximum": 200,
              "description": "User-observed L/100 km at comparable operating conditions; at most three decimal places."
            },
            "full_l_per_100km": {
              "type": "number",
              "minimum": 0.001,
              "maximum": 200,
              "description": "Must be at least the empty rate; calibration conditions must be comparable."
            },
            "price_per_liter": {
              "type": "string",
              "maxLength": 30,
              "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$",
              "description": "Customer fuel price in the stated currency; decimal string, 0–1000000, up to six fractional digits."
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$",
              "description": "Supported ISO currency code, for example AZN, USD or EUR; no conversion is performed."
            }
          },
          "required": [
            "empty_weight_t",
            "full_weight_t",
            "empty_l_per_100km",
            "full_l_per_100km",
            "price_per_liter",
            "currency"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "distance_km",
        "loaded_weight_t",
        "fuel"
      ],
      "additionalProperties": false
    }
  • place_details

    Read source attributes by an OSM search result ID. One credit, one-hour source cache.

    inputSchema
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 24
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false
    }
  • get_route

    Route between coordinates using the selected travel profile.

    inputSchema
    {
      "type": "object",
      "properties": {
        "profile": {
          "type": "string",
          "enum": [
            "driving",
            "cycling",
            "walking"
          ]
        },
        "coordinates": {
          "type": "array",
          "minItems": 2,
          "maxItems": 25,
          "items": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "type": "number"
            }
          }
        }
      },
      "required": [
        "coordinates"
      ],
      "additionalProperties": false
    }
  • distance_matrix

    Compute road-network durations and distances between coordinates.

    inputSchema
    {
      "type": "object",
      "properties": {
        "profile": {
          "type": "string",
          "enum": [
            "driving",
            "cycling",
            "walking"
          ]
        },
        "coordinates": {
          "type": "array",
          "minItems": 2,
          "maxItems": 25,
          "items": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "type": "number"
            }
          }
        }
      },
      "required": [
        "coordinates"
      ],
      "additionalProperties": false
    }
  • reverse_geocode

    Find the nearest address.

    inputSchema
    {
      "type": "object",
      "properties": {
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        }
      },
      "required": [
        "lat",
        "lon"
      ],
      "additionalProperties": false
    }
  • autocomplete_address

    Complete a partial address.

    inputSchema
    {
      "type": "object",
      "properties": {
        "q": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "required": [
        "q"
      ],
      "additionalProperties": false
    }
  • get_timezone

    Get the timezone at a coordinate.

    inputSchema
    {
      "type": "object",
      "properties": {
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        }
      },
      "required": [
        "lat",
        "lon"
      ],
      "additionalProperties": false
    }
  • get_isochrone

    Get the area reachable within a time budget.

    inputSchema
    {
      "type": "object",
      "properties": {
        "point": {
          "type": "string",
          "description": "latitude,longitude"
        },
        "time_limit": {
          "type": "integer",
          "minimum": 60,
          "maximum": 3600
        }
      },
      "required": [
        "point",
        "time_limit"
      ],
      "additionalProperties": false
    }
  • optimize_route

    Optimize delivery stops across vehicles.

    inputSchema
    {
      "type": "object",
      "properties": {
        "vehicles": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
            "type": "object"
          }
        },
        "services": {
          "type": "array",
          "minItems": 1,
          "maxItems": 100,
          "items": {
            "type": "object"
          }
        }
      },
      "required": [
        "vehicles",
        "services"
      ],
      "additionalProperties": false
    }
  • geocode_address

    Find an address. Uses geocode credits.

    inputSchema
    {
      "type": "object",
      "properties": {
        "q": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "required": [
        "q"
      ],
      "additionalProperties": false
    }
  • natural_search

    Find cafes, restaurants, pharmacies, parking, fuel or charging stations near a place. Set ai=true for Business AI (1,000/month). Otherwise constrained English; no live availability.

    inputSchema
    {
      "type": "object",
      "properties": {
        "q": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000
        },
        "center": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "type": "number"
          }
        },
        "ai": {
          "type": "boolean"
        }
      },
      "required": [
        "q"
      ],
      "additionalProperties": false
    }
  • suggest_addresses

    Get address suggestions and owner-bound retrieval tokens.

    inputSchema
    {
      "type": "object",
      "properties": {
        "q": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "required": [
        "q"
      ],
      "additionalProperties": false
    }
  • retrieve_place

    Retrieve a suggestion snapshot within ten minutes.

    inputSchema
    {
      "type": "object",
      "properties": {
        "token": {
          "type": "string",
          "maxLength": 16384
        }
      },
      "required": [
        "token"
      ],
      "additionalProperties": false
    }
  • structured_geocode

    Search an address using separate components.

    inputSchema
    {
      "type": "object",
      "properties": {
        "housenumber": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "street": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "city": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "state": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "postcode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "countrycode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "required": [],
      "additionalProperties": false
    }
  • places_along_route

    Discover places with bounded driving detours. 14 credits; not exhaustive or live traffic.

    inputSchema
    {
      "type": "object",
      "properties": {
        "start": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "type": "number"
          }
        },
        "end": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "type": "number"
          }
        },
        "category": {
          "type": "string",
          "enum": [
            "cafe",
            "restaurant",
            "pharmacy",
            "parking",
            "fuel",
            "charging_station"
          ]
        },
        "max_detour_seconds": {
          "type": "number",
          "minimum": 0,
          "maximum": 1800
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 8
        }
      },
      "required": [
        "start",
        "end",
        "category"
      ],
      "additionalProperties": false
    }
  • static_map

    Render a PNG map. 4 credits.

    inputSchema
    {
      "type": "object",
      "properties": {
        "center": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "type": "number"
          }
        },
        "zoom": {
          "type": "integer",
          "minimum": 1,
          "maximum": 14
        },
        "width": {
          "type": "integer",
          "minimum": 128,
          "maximum": 512
        },
        "height": {
          "type": "integer",
          "minimum": 128,
          "maximum": 512
        },
        "style": {
          "type": "string",
          "enum": [
            "light",
            "dark",
            "navigation",
            "minimal"
          ]
        }
      },
      "required": [
        "center"
      ],
      "additionalProperties": false
    }
  • list_styles

    List your styles. Requires explicit studio scope.

    inputSchema
    {
      "type": "object",
      "properties": {},
      "required": [],
      "additionalProperties": false
    }
  • list_datasets

    List your datasets. Requires explicit studio scope.

    inputSchema
    {
      "type": "object",
      "properties": {},
      "required": [],
      "additionalProperties": false
    }
  • preview_style

    Preview style commands without saving or publishing. Requires studio scope. ai=true uses the Business monthly AI quota.

    inputSchema
    {
      "type": "object",
      "properties": {
        "prompt": {
          "type": "string",
          "maxLength": 1000
        },
        "design": {
          "type": "object"
        },
        "ai": {
          "type": "boolean"
        }
      },
      "required": [
        "prompt"
      ],
      "additionalProperties": false
    }
API reference
Natural Language Search · Places · Studio →

OSRMRoute Support

Talk directly to our team

HERE TO HELP

How can we help?

Send a message. Ticket replies are also sent to your verified email.

Your chats

Your chats will appear here.