Look up public transit travel times and routes in Norway using the Entur APIs. Use when the user asks about travel time, transit routes, how to get somewhere, or distance between locations in Norway. Triggers on "travel time from X to Y", "how long from X to Y", "reisetid fra X til Y", "transit from X to Y", "kollektivt fra X til Y", /entur, or any question about getting between two places via public transport in Norway.
Look up public transit routes and travel times anywhere in Norway via Entur's open APIs. Uses curl via Bash.
| Shortcut | Address | Coordinates |
|---|---|---|
| home, hjemme | Sandakerveien 22E, Oslo | 59.934173, 10.760459 |
| office, kontoret, HQ | Torggata 4, Oslo | 59.913795, 10.747224 |
If the user provides a known shortcut, use the hardcoded coordinates above. Otherwise, geocode with this fallback chain:
1a. Nominatim (best for addresses AND venue/business names):
curl -s 'https://nominatim.openstreetmap.org/search?q=<URL_ENCODED_QUERY>&format=json&limit=1&countrycodes=no' \
-H 'User-Agent: magnus-claude-code/1.0'
Extract: [0].lat and [0].lon. Verify display_name looks correct (not a different city).
Rate limit: max 1 request/second. For bulk lookups, add sleep 1 between calls or use a single Python script with 1s delays.
1b. Entur geocoder (fallback, best for transit stop names like "Hasle", "Jernbanetorget"):
curl -s 'https://api.entur.io/geocoder/v1/autocomplete?text=<URL_ENCODED_QUERY>&size=1&lang=no' \
-H 'ET-Client-Name: magnus-claude-code'
Extract: features[0].geometry.coordinates (returns [longitude, latitude], note the order).
1c. If both fail, ask the user for the street address.
curl -s -X POST 'https://api.entur.io/journey-planner/v3/graphql' \
-H 'ET-Client-Name: magnus-claude-code' \
-H 'Content-Type: application/json' \
-d '{"query": "{ trip( from: { coordinates: { latitude: <FROM_LAT>, longitude: <FROM_LON> } } to: { coordinates: { latitude: <TO_LAT>, longitude: <TO_LON> } } numTripPatterns: 3 ) { tripPatterns { duration walkDistance legs { mode fromPlace { name } toPlace { name } expectedStartTime expectedEndTime duration line { publicCode name } } } } }" }'
To query for a specific departure time, add dateTime: \"<ISO8601>\" inside the trip() arguments:
trip( from: {...} to: {...} dateTime: "2026-04-21T17:00:00+02:00" numTripPatterns: 3 )
Present results concisely. For each trip pattern:
duration field (in seconds, convert to minutes)walkDistance field (in meters)mode line from -> to (time)Example output format:
Option 1: 19 min (5 min walk) Walk to Torshov -> Tram 12 to Storgata (11 min) -> Walk to destination (4 min)
Option 2: 22 min (4 min walk) Walk to Torshov -> Tram 17 to Stortorvet (13 min) -> Walk to destination (5 min)
lat/lon as strings. Cast to float before using in journey planner.[lon, lat] (GeoJSON order). Journey planner expects latitude: and longitude: separately.User-Agent header. Entur requires ET-Client-Name.