Get all tube stoppoints naptan

https://api.tfl.gov.uk/StopPoint/Mode/tube
I’m using the above link for naptanId to feed into my other endpoints to get other data such as live crowding but I’ve noticed that most of these naptanId codes aren’t useful. Is there a way to get simple naptanId for all tube stations?

example: 0400ZZLUAMS0 - Amersham Underground Station
https://api.tfl.gov.uk/crowding/0400ZZLUAMS0/Live gets no results

Hello, and welcome to the forum!

The data returned by that first URL contains many types of StopPoint, including station entrances and platforms, for which crowding data are not available.

What you could do is filter the StopPoints and only look at those with a stopType of NaptanMetroStation:

stopPointsResponse.stopPoints.filter(
  stopPoint => stopPoint.stopType == "NaptanMetroStation")

I have filtered down to NaptanMetroEntrance codes only. But they are still not helpful when I plug them into the crowding endpoint.
4900ZZLUACT1
4900ZZLUADE1
4900ZZLUALD1
400ZZLUAMS0
4900ZZLUAGL1
4900ZZLUACY1

Apologies. I meant NaptanMetroStation rather than NaptanMetroEntrance. I’ve fixed my code. :slight_smile:

1 Like

Perfect, thanks a lot!