Journey Planner disambiguation

Hi devs
I am a coding student trying to use the Journey API for a personal project however when testing in postman i get many results which i can’t seem to use as its not clear what the content is.


This is the endpoint i am using:

https://api.tfl.gov.uk/Journey/JourneyResults/{from}/to/{to}

Can you help with the usage of this API as i only want to create a simple React App to perform a Journey plan.

Thanks for your help

Fabio

Hi Fabio, and welcome to the forum! I have split out your message into its own thread.

You are getting a disambiguation result because “brixton” and “stockwell” are not specific enough. In other words, “brixton” could refer to several different places. Therefore, Journey Planner returns a disambiguation result that provides possible places you may be referring to.

If you want to plan a journey between the two Tube stations, you could use the full names “Brixton Underground Station” and “Stockwell Underground Station”, for example:
https://api.tfl.gov.uk/Journey/JourneyResults/Brixton%20Underground%20Station/to/Stockwell%20Underground%20Station

Alternatively, you could do a StopPoint Search and plan the journey using the icsId or id properties. To do this, you would first make requests like:
https://api.tfl.gov.uk/StopPoint/Search/Stockwell
and then requests like:
https://api.tfl.gov.uk/Journey/JourneyResults/1000031/to/1000223
https://api.tfl.gov.uk/Journey/JourneyResults/940GZZLUBXN/to/940GZZLUSKW

Note that you can also plan journeys between coordinates and postcodes.

I hope this helps. Please ask if you have any further questions.

1 Like

oh great thanks for your explanation :smiley:

I am using the Journey API Journey Planner Search APIs: Details - Transport for London - API

But All it returns is to and from station that I have entered, it’s not planning the Journey, can any one advise what I am doing wrong?

I put the to and from station in and enter “tube” mode it returns this… it’s not planning a Journey?

HTTP response

HTTP/1.1 300 Multiple Choices

age: 0
api-entity-payload: ItineraryResult,DisambiguationResult,Mode,StopPoint,Place,Disruption,PlannedWorks,Line,LineStatus
cache-control: public, must-revalidate, max-age=150, s-maxage=300
content-encoding: gzip
content-type: application/json; charset=utf-8
date: Sun, 22 Oct 2023 09:11:25 GMT
server: cloudflare
via: 1.1 varnish
x-api: Journey
x-aspnet-version: 4.0.30319
x-backend: api
x-cache: MISS
x-cacheable: Yes. Cacheable
x-frame-options: deny
x-operation: Journey_JourneyResultsByPathFromPathToQueryViaQueryNationalSearchQueryDateQu
x-proxy-connection: unset
x-ttl: 300.000
x-ttl-rule: 0
x-varnish: 889558301

{
    "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationResult, Tfl.Api.Presentation.Entities",
    "toLocationDisambiguation": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities",
        "matchStatus": "identified"
    },
    "fromLocationDisambiguation": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities",
        "disambiguationOptions": [{
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1000337",
            "uri": "/journey/journeyresults/1000337/to/westminster(london),westminsterstation?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "HUBCST",
                "modes": ["national-rail"],
                "icsCode": "1000337",
                "stopType": "stop",
                "url": "/StopPoint/HUBCST",
                "commonName": "City of London, Cannon Street, Cannon Street Rail Station",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.511380621760004,
                "lon": -0.090292979789999991
            },
            "matchQuality": 653
        }],
        "matchStatus": "list"
    },
    "viaLocationDisambiguation": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities",
        "matchStatus": "empty"
    },
    "recommendedMaxAgeMinutes": 1440,
    "searchCriteria": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.SearchCriteria, Tfl.Api.Presentation.Entities",
        "dateTime": "2023-10-22T10:11:00",
        "dateTimeType": "Arriving"
    },
    "journeyVector": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.JourneyVector, Tfl.Api.Presentation.Entities",
        "from": "Bond Street, Bond Street Station",
        "to": "Westminster (London), Westminster Station",
        "via": "",
        "uri": "/journey/journeyresults/bond%20street,%20bond%20street%20station/to/westminster%20(london),%20westminster%20station?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy"
    }
}

Welcome @toastedmobile

The 300 means you weren’t specific enough!

I note you called /journey/journeyresults/bond%20street,%20bond%20street%20station/to/westminster%20(london),%20westminster%20station?..

You need to pick better coding for the start end end. “bond street,bond street station” and “westminster (london),westminster station” is very messy.

Try “Bond Street” to “Westminster” as your search terms. This is a Transport API, so you can probably assume that these station names are what is expected :grin:

However, if you want be be sure of specific places, then use the NAPTAN codings.

If I enter what you are suggesting it will return multiple options for the departure and destination names…

HTTP response

HTTP/1.1 300 Multiple Choices

age: 0
api-entity-payload: ItineraryResult,DisambiguationResult,Mode,StopPoint,Place,Disruption,PlannedWorks,Line,LineStatus
cache-control: public, must-revalidate, max-age=150, s-maxage=300
content-encoding: gzip
content-type: application/json; charset=utf-8
date: Sun, 22 Oct 2023 11:25:45 GMT
server: cloudflare
via: 1.1 varnish
x-api: Journey
x-aspnet-version: 4.0.30319
x-backend: api
x-cache: MISS
x-cacheable: Yes. Cacheable
x-frame-options: deny
x-operation: Journey_JourneyResultsByPathFromPathToQueryViaQueryNationalSearchQueryDateQu
x-proxy-connection: unset
x-ttl: 300.000
x-ttl-rule: 0
x-varnish: 891019890

{
    "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationResult, Tfl.Api.Presentation.Entities",
    "toLocationDisambiguation": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities",
        "disambiguationOptions": [{
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1002085",
            "uri": "/journey/journeyresults/bondstreet/to/1002085?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "930GWMR",
                "modes": ["river-bus"],
                "icsCode": "1002085",
                "stopType": "stop",
                "url": "/StopPoint/930GWMR",
                "commonName": "Westminster (London), Westminster Pier",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.501593349370005,
                "lon": -0.12351013545
            },
            "matchQuality": 967
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.63065815579,-0.05313769015",
            "uri": "/journey/journeyresults/bond%20street/to/51.63065815579,-0.05313769015?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Enfield (London), Westminster Road",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.63065815579,
                "lon": -0.05313769015
            },
            "matchQuality": 967
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.50722746983,-0.33909686474",
            "uri": "/journey/journeyresults/bond%20street/to/51.50722746983,-0.33909686474?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Ealing, Westminster Road",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.50722746983,
                "lon": -0.33909686474
            },
            "matchQuality": 967
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.3769564194,-0.18115941848",
            "uri": "/journey/journeyresults/bond%20street/to/51.3769564194,-0.18115941848?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Sutton (London), Westminster Road",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.3769564194,
                "lon": -0.18115941848
            },
            "matchQuality": 967
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1014495",
            "uri": "/journey/journeyresults/bondstreet/to/1014495?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "490G000828",
                "modes": ["bus"],
                "icsCode": "1014495",
                "stopType": "stop",
                "url": "/StopPoint/490G000828",
                "commonName": "Westminster (London), Westminster Abbey",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.499039281680005,
                "lon": -0.13081882967
            },
            "matchQuality": 964
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1019109",
            "uri": "/journey/journeyresults/bondstreet/to/1019109?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "490G00019109",
                "modes": ["bus"],
                "icsCode": "1019109",
                "stopType": "stop",
                "url": "/StopPoint/490G00019109",
                "commonName": "Palmers Green, Westminster Drive",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.61354636447,
                "lon": -0.12106305319999999
            },
            "matchQuality": 964
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.49947837501,-0.12846681566",
            "uri": "/journey/journeyresults/bond%20street/to/51.49947837501,-0.12846681566?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "City of Westminster, Westminster Abbey",
                "placeType": "PointOfInterest",
                "additionalProperties": [],
                "lat": 51.49947837501,
                "lon": -0.12846681565999998
            },
            "matchQuality": 964
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.42989243158,-0.33081145666",
            "uri": "/journey/journeyresults/bond%20street/to/51.42989243158,-0.33081145666?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Richmond (London), Westminster Close",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.42989243158,
                "lon": -0.33081145666
            },
            "matchQuality": 964
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.44856136478,-0.41775907562",
            "uri": "/journey/journeyresults/bond%20street/to/51.44856136478,-0.41775907562?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Hounslow, Westminster Close",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.44856136478,
                "lon": -0.41775907562000003
            },
            "matchQuality": 964
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.61363174964,-0.11909516083",
            "uri": "/journey/journeyresults/bond%20street/to/51.61363174964,-0.11909516083?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Enfield (London), Westminster Drive",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.61363174964,
                "lon": -0.11909516082999999
            },
            "matchQuality": 964
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.50082347247,-0.12091947626",
            "uri": "/journey/journeyresults/bond%20street/to/51.50082347247,-0.12091947626?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Lambeth, Westminster Bridge",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.50082347247,
                "lon": -0.12091947625999999
            },
            "matchQuality": 961
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.40867901769,-0.10879621954",
            "uri": "/journey/journeyresults/bond%20street/to/51.40867901769,-0.10879621954?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Croydon (London), Westminster Avenue",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.408679017690005,
                "lon": -0.10879621954
            },
            "matchQuality": 961
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1000266",
            "uri": "/journey/journeyresults/bondstreet/to/1000266?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "HUBWSM",
                "modes": ["tube"],
                "icsCode": "1000266",
                "stopType": "stop",
                "url": "/StopPoint/HUBWSM",
                "commonName": "Westminster (London), Westminster Station",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.501399779349995,
                "lon": -0.12490128604
            },
            "matchQuality": 959
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.59140000485,0.08337496636",
            "uri": "/journey/journeyresults/bond%20street/to/51.59140000485,0.08337496636?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Redbridge (London), Westminster Gardens",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.59140000485,
                "lon": 0.083374966360000011
            },
            "matchQuality": 959
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.62816556481,0.01307504437",
            "uri": "/journey/journeyresults/bond%20street/to/51.62816556481,0.01307504437?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Walthamstow, Westminster Gardens",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.62816556481,
                "lon": 0.01307504437
            },
            "matchQuality": 959
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.52792193433,0.08986120908",
            "uri": "/journey/journeyresults/bond%20street/to/51.52792193433,0.08986120908?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Barking, Westminster Gardens",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.52792193433,
                "lon": 0.08986120908
            },
            "matchQuality": 959
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1014496",
            "uri": "/journey/journeyresults/bondstreet/to/1014496?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "490G00014496",
                "modes": ["bus"],
                "icsCode": "1014496",
                "stopType": "stop",
                "url": "/StopPoint/490G00014496",
                "commonName": "Westminster (London), Westminster Cathedral",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.496833924769994,
                "lon": -0.14086419547999998
            },
            "matchQuality": 954
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1003384",
            "uri": "/journey/journeyresults/bondstreet/to/1003384?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "490G000394",
                "modes": ["bus"],
                "icsCode": "1003384",
                "stopType": "stop",
                "url": "/StopPoint/490G000394",
                "commonName": "Westminster (London), Westminster City Hall",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.49732156699,
                "lon": -0.13702649476999998
            },
            "matchQuality": 950
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.49999417928,-0.12472845256",
            "uri": "/journey/journeyresults/bond%20street/to/51.49999417928,-0.12472845256?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "City of Westminster, Palace Of Westminster",
                "placeType": "PointOfInterest",
                "additionalProperties": [],
                "lat": 51.499994179279994,
                "lon": -0.12472845256000001
            },
            "matchQuality": 950
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.49988334633,-0.12454570003",
            "uri": "/journey/journeyresults/bond%20street/to/51.49988334633,-0.12454570003?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "City of Westminster, Palace of Westminster",
                "placeType": "PointOfInterest",
                "additionalProperties": [],
                "lat": 51.49988334633,
                "lon": -0.12454570003000001
            },
            "matchQuality": 950
        }],
        "matchStatus": "list"
    },
    "fromLocationDisambiguation": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities",
        "disambiguationOptions": [{
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1004143",
            "uri": "/journey/journeyresults/1004143/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "490G00004143",
                "modes": ["bus"],
                "icsCode": "1004143",
                "stopType": "stop",
                "url": "/StopPoint/490G00004143",
                "commonName": "Ealing, Bond Street",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.512365266740005,
                "lon": -0.30599428727
            },
            "matchQuality": 1000
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.55055144892,0.00409342095",
            "uri": "/journey/journeyresults/51.55055144892,0.00409342095/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "West Ham (London), Bond Street",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.55055144892,
                "lon": 0.00409342095
            },
            "matchQuality": 1000
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.49295397826,-0.25832624707",
            "uri": "/journey/journeyresults/51.49295397826,-0.25832624707/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Hounslow, Bond Street",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.492953978260005,
                "lon": -0.25832624707
            },
            "matchQuality": 1000
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.51228417111,-0.30598288398",
            "uri": "/journey/journeyresults/51.51228417111,-0.30598288398/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Ealing, Bond Street",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.51228417111,
                "lon": -0.30598288398
            },
            "matchQuality": 1000
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.51212175592,-0.14430595015",
            "uri": "/journey/journeyresults/51.51212175592,-0.14430595015/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Westminster (London), New Bond Street",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.51212175592,
                "lon": -0.14430595015
            },
            "matchQuality": 973
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.50905738082,-0.1410295388",
            "uri": "/journey/journeyresults/51.50905738082,-0.1410295388/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "Westminster (London), Old Bond Street",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.509057380819996,
                "lon": -0.14102953880000002
            },
            "matchQuality": 973
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1000025",
            "uri": "/journey/journeyresults/1000025/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "HUBBDS",
                "modes": ["tube", "elizabeth-line"],
                "icsCode": "1000025",
                "stopType": "stop",
                "url": "/StopPoint/HUBBDS",
                "commonName": "Bond Street, Bond Street Station",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.51396565545,
                "lon": -0.14888617303
            },
            "matchQuality": 962
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "1010526",
            "uri": "/journey/journeyresults/1010526/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
                "naptanId": "490G00010526",
                "modes": ["bus"],
                "icsCode": "1010526",
                "stopType": "stop",
                "url": "/StopPoint/490G00010526",
                "commonName": "St James (London), Old Bond Street /Royal Academy",
                "placeType": "StopPoint",
                "additionalProperties": [],
                "lat": 51.5082153846,
                "lon": -0.13953630338999998
            },
            "matchQuality": 940
        }, {
            "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.DisambiguationOption, Tfl.Api.Presentation.Entities",
            "parameterValue": "51.51306083036,-0.14511809414",
            "uri": "/journey/journeyresults/51.51306083036,-0.14511809414/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy",
            "place": {
                "$type": "Tfl.Api.Presentation.Entities.Place, Tfl.Api.Presentation.Entities",
                "url": "/Place/",
                "commonName": "City of Westminster, Carluccio's Caffe, New Bond Street",
                "placeType": "PointOfInterest",
                "additionalProperties": [],
                "lat": 51.513060830360004,
                "lon": -0.14511809414000002
            },
            "matchQuality": 935
        }],
        "matchStatus": "list"
    },
    "viaLocationDisambiguation": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.Disambiguation, Tfl.Api.Presentation.Entities",
        "matchStatus": "empty"
    },
    "recommendedMaxAgeMinutes": 1440,
    "searchCriteria": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.SearchCriteria, Tfl.Api.Presentation.Entities",
        "dateTime": "2023-10-22T12:25:00",
        "dateTimeType": "Arriving"
    },
    "journeyVector": {
        "$type": "Tfl.Api.Presentation.Entities.JourneyPlanner.JourneyVector, Tfl.Api.Presentation.Entities",
        "from": "Bond Street",
        "to": "Westminster",
        "via": "",
        "uri": "/journey/journeyresults/bond%20street/to/westminster?timeis=arriving&journeypreference=leastinterchange&mode=tube&accessibilitypreference=norequirements&walkingspeed=slow&cyclepreference=none&bikeproficiency=easy"
    }
}

@toastedmobile

A link would have done!

Naptans are your friend, as I said. You can download them for the whole of the UK from here https://beta-naptan.dft.gov.uk/Download/National/csv

Also, a good shortcut to working out the TfL names for thins is the Single Fare Finder

As I said you can see how it is responding to just putting in Bond Street and Westminster

It is not planning a journey?? I am confused how this is not making sense to you?

@toastedmobile

It’s an API, not a user-interface.

If you fail to provide a UNIQUE identifier for the start and end, the API responds with a code 300 message saying that the identifier or identifiers are not identifier .

If you want a user-interface, use Plan a journey - Transport for London which has a JavaScript overlay and other features to help provide the correct UNIQUE identifier.

It can take quite a lot of UNIQUE identifier: postcodes, latitude + comma + longitude, Naptans and unique places names (“Buckingham Palace”).

But this is a programming forum so I kind-of-thought you would be familiar with programming.

1 Like

Like briantist said, it’s an API not a UI, you need to be more specific with your request here - but just as an example:

In your request from ‘Bond Street’ to ‘Westminster’, one disambiguation option is the url /journey/journeyresults/bondstreet/to/1000266..., which is ‘bondstreet’ to the ics code of a specific stop (westminster station - much less ambiguous :slight_smile: ) - If you follow this URL you can see that once again ‘bondstreet’ is still ambiguous, so you get a list of options of start places you can replace it with, all to the specific station 1000266. In that DisambiguationResult you can see it gives the much more specific option of /journey/journeyresults/1004143/to/1000266?... - that is The icsCode of Ealing, Bond Street, to the icsCode of Westminster Station. Going to this endpoint gives you an actual ItineraryResult object back, with the journeys object being a list of possible journeys you could take.

Obviously you shouldn’t actually follow these urls if you’re making a client - as briantist said it’s an API, and it’s best to just call the endpoint with specific ids so you get back what you want right away. So in your client, you can allow the user to enter any place, you can use a geocoding api to convert that address into a coordinate, and use coordinates as your to and from ids. Or they could select from a list of stop points, and you can use the Naptan ids of the stop points as your to/from.

As-is, you’re not being specific enough and the API is actually telling you that

EDIT: actually right on the front page of the forum is the same question explaining this Journey Planner disambiguation

Hi Brian,

I am familiar with programming but it is useless if the test system doesn’t give a clear explanation on what data needs to be entered and has you guessing and hunting around for information.

Also please read my conversation from the start properly. My initial message shows me entering information that was returned in the disambiguation results when I entered “Bond Street” and “Westminster” only.

But you then suggest I enter “Bond Street” and “Westminster” only, which results in the suggestions results in my second message which means your suggestion did not produce a journey plan either.

How is this helpful. Don’t be condescending please help me understand how to use the test page, as TFL don’t provide a clear road map to documentation for the API. Otherwise your response defeats the purpose of this forum. Even If I was new to coding (which I am not) the point of this forum is to help others, not respond with an inflated sense of superiority.

At the moment the test page seems to make it look like I have to write an API of my own to interface with TFLs API instead of just being able to use the API. What’s the point of having a page to test the API with if they don’t make it clear how to use it.

You are suggesting that I have to use another API to return the specific station ID to be able to do an accurate point to point journey plan station to station. I should be able to enter the place name (indicating the station) and return the journey plan, because TFLs API should link the place to a station ID. But if the case is that I need to resolve the station name to an ID then how can I use the test page I have referenced above to do a journey plan example. Because the page suggests I should just be able to enter a name and it will produce a journey plan.

I have tried to use the exact names in the Stops.csv, but it still sends back results telling me there are multiple choices to the names I have used. What’s point in it having a naming reference but when I use the names it references, it’s still decides I am being ambiguous.

Please give me an example of how I can simply use names to refer to the stations I am testing and it result in giving me a journey plan. Because It is not making sense.

Thanks for your reply Tom, I will look over the links you have referenced, but just to clarify the thread, if you look at my first message in the thread I have not entered just “Bond Street” to “Westminster”, I have entered more specific information in the from/to fields, but it didn’t give me a journey plan it still decided I was being ambiguous. I only entered “Bond Street” to “Westminster” and posted the response to show Brian what it does when I do that because Brian suggested I use “Bond Street” to “Westminster” (unless I misunderstood him) I had already tried “Bond Street” to “Westminster” before posting on this forum. But then I tried entering one of the suggestions it had returned in the results but it still had not worked, so I posted that result in my first message here and asked the question.

@toastedmobile

Perhaps someone from TfL might be interested in taking your suggestions onboard?

Try @jamesevans @LeonByford

I’m only able to tell you how it works now.

Hi, welcome to the forum and thanks for your feedback.

I’ve taken the liberty of merging your thread into a previous one and putting your HTTP responses in code blocks.

Unless you a station/stop’s ID, you may receive a disambiguation result when attempting to plan a journey. This occurs where the from/to/via could refer to multiple possible locations. These possibilities are returned in the disambiguation result, enabling the user to select an option and re-plan the journey using the selected location.

The Journey Planner on the TfL website works the same way. For example, you can try planning a journey from “bond street” to “westminster”:
https://tfl.gov.uk/plan-a-journey/results?InputFrom=bond+street&InputTo=westminster
Because there are multiple possibilities, the website asks you to select the specific from/to locations. Once you do this, the journey is planned, and you receive your journey options.

In terms of how the website uses the API, it first makes a request to:
https://api.tfl.gov.uk/Journey/JourneyResults/bond%20street/to/westminster
The disambiguation options are presented to the user, then when the user selects a stations, the parameterValue property of that option is used to make a second request:
https://api.tfl.gov.uk/Journey/JourneyResults/1000025/to/1000266
This then returns the actual journey results.

Although, as others have mentioned earlier, you can use other APIs (whether from TfL or other sources) to obtain a station/stop’s ID, using the disambiguation feature means you can use Journey Planner on its own (you may just need to make two requests).

By the way, if you’re only interested in Tube stations, you could use the full name of the station, and in most cases this would return an actual journey result on your first request. For example:
https://api.tfl.gov.uk/Journey/JourneyResults/Bond%20Street%20Underground%20Station/to/Westminster%20Underground%20Station

However, my recommendation would be to support disambiguation results in your application, or only make Journey Planner requests using station/stop IDs (the latter being what TfL Go does).

Hi Leon,

As I have already mentioned. I did use “Bond Street” to “Westminster” in my first test before posting on here. The results it returned gave me more specific options to use. But when I used these more specific options it still did not give me a journey plan. So it is not working the way you describe. And those are the results of the second request I made that I posted in my first message on the forum

And what is the point of having a journey planner that needs to have 2 requests fired at it to get a journey plan. Given that the initial limit is 300 requests per minute per feed, means that in order to get a result I would have to fire 2 requests for one query means my limit would end up being 150 requests per minute.

I used the Stops.csv as well to use more specific information, even using just “Bond Street Station” to “Westminster Station” which are names contained in the Stops.CSV. But it still returns response 300 - multiple choices, meaning it still thinks I am being ambiguous.

Using what you have suggested “Bond Street Underground Station” to “Westminster Underground Station” has produced a Journey plan now.

However, the response 300 - multiple choices response does not give the above as an option when I enter “Bond street” to “Westminster” and nor does it give it as a suggestion if I enter “Bond Street Station” to “Westminster Station” so again it is not working as intelligently as it would suggest it should do

To to clarify again: use the Naptan codes not the English language names.

When making the second request, please ensure you use either the parameterValue or uri properties of the DisambiguationOption object (i.e. not the commonName property). If you still experience issues even when using the parameterValue or uri properties, please let us know.

A second request is only necessary if the initial request was ambiguous. Using station/stop IDs will make your requests unambiguous and help keep the number of requests down. That said, if you run into rate limiting issues, do let us know and we can work with you to find a solution.

1 Like

Hi Leon,

Thanks for the help, however do you know why even though I have registered and got a login; when i login it takes me to the home page and says register for API key. If I click on register the page just reloads back to the home page still logged in, but I have no API keys in my profile when I go to subscriptions.

Hi, once you are signed in, you will need to go to the Products section of the portal:

There, select the “500 Requests per min” option.

In the “Your new product subscription name”, please enter the name of your app (or a short description of what you’re using the API for) and press Subscribe.

Once you’ve done this, you can go to your Profile where you should be able to access your subscription keys:

I hope this helps. Please let us know if you run into any issues.

Thanks Leon, I now have an API key… but I am forever frustrated on how difficult it is to navigate APIs like this. I went to the Swagger UI. Even If I click try it on “Gets a list of all of the available journey planner modes” there is no fields to enter any data, so you would think cool this should not be a difficult test. But I click on it; it takes a while to respond and then it returns no data, it returns the below

##### REQUEST URL

https://api.digital.tfl.gov.uk/Journey/Meta/Modes

##### RESPONSE BODY

no content

##### RESPONSE CODE

0

##### RESPONSE HEADERS

{
“error”: “no response from server”
}

================================

If I fill out the fields for Perform a “Journey Planner search from the parameters specified in simple types” it responds with the same message like above but obviously showing a different URL.

Seriously It should not be this difficult just to get an example query response.