Skip to content

A gRPC API that exposes various information about the PATH transit system.

License

Notifications You must be signed in to change notification settings

mrazza/path-data

Repository files navigation

PATH Data API Build Code Coverage

This repository contains the contract and server-side implementation of an API that exposes data about the Port Authority Trans-Hudson Rapid Transit System.

This software is not endorsed nor supported by the Port Authority of New York and New Jersey.

Using This Software

Prefer to use the publically exposed API (below) rather than running this software yourself. See this article for more information.

Public APIs

The APIs provided by this service can be found at:

List Stations

HTTP: https://path.api.razza.dev/v1/stations

{
  "stations": [
    {
      "station": "NEWARK",
      "id": "26733",
      "name": "Newark",
      "coordinates": {
        "latitude": 40.73454,
        "longitude": -74.16375
      },
      "platforms": [
        // ...
      ],
      "entrances": [
        // ...
      ],
      "timezone": "America/New_York"
    },
    // ...
  ]
}

Get Station

HTTP: https://path.api.razza.dev/v1/stations/{station_name} where {station_name} is one of:

newark
harrison
journal_square
grove_street
exchange_place
world_trade_center
newport
hoboken
christopher_street
ninth_street
fourteenth_street
twenty_third_street
thirty_third_street

HTTP: https://path.api.razza.dev/v1/stations/harrison

{
  "station": "HARRISON",
  "id": "26729",
  "name": "Harrison",
  "coordinates": {
    "latitude": 40.73942,
    "longitude": -74.15587
  },
  "platforms": [
    {
      "id": "781720",
      "name": "Harrison",
      "coordinates": {
        "latitude": 40.73942,
        "longitude": -74.15587
      }
    },
    {
      "id": "781721",
      "name": "Harrison",
      "coordinates": {
        "latitude": 40.73942,
        "longitude": -74.15587
      }
    }
  ],
  "entrances": [
    {
      "id": "782492",
      "name": "Harrison",
      "coordinates": {
        "latitude": 40.739,
        "longitude": -74.1558
      }
    },
    {
      "id": "782493",
      "name": "Harrison",
      "coordinates": {
        "latitude": 40.7395,
        "longitude": -74.1559
      }
    }
  ],
  "timezone": "America/New_York"
}

Realtime Arrivals

HTTP: https://path.api.razza.dev/v1/stations/<station_name>/realtime

{
  "upcomingTrains": [
    {
      "lineColors": [
        "#65C100"
      ],
      "projectedArrival": "2019-04-13T01:56:00Z",
      "lastUpdated": "2019-04-13T01:52:05Z",
      "status": "ON_TIME",
      "headsign": "Hoboken",
      "route": "HOB_WTC",
      "routeDisplayName": "World Trade Center - Hoboken",
      "direction": "TO_NJ"
    },
    {
      "lineColors": [
        "#65C100"
      ],
      "projectedArrival": "2019-04-13T02:11:00Z",
      "lastUpdated": "2019-04-13T01:52:05Z",
      "status": "ON_TIME",
      "headsign": "Hoboken",
      "route": "HOB_WTC",
      "routeDisplayName": "World Trade Center - Hoboken",
      "direction": "TO_NJ"
    },
    {
      "lineColors": [
        "#D93A30"
      ],
      "projectedArrival": "2019-04-13T02:01:00Z",
      "lastUpdated": "2019-04-13T01:52:05Z",
      "status": "ON_TIME",
      "headsign": "Newark",
      "route": "NWK_WTC",
      "routeDisplayName": "World Trade Center - Newark",
      "direction": "TO_NJ"
    },
    {
      "lineColors": [
        "#D93A30"
      ],
      "projectedArrival": "2019-04-13T02:16:00Z",
      "lastUpdated": "2019-04-13T01:52:05Z",
      "status": "ON_TIME",
      "headsign": "Newark",
      "route": "NWK_WTC",
      "routeDisplayName": "World Trade Center - Newark",
      "direction": "TO_NJ"
    }
  ]
}

List Routes

HTTP: https://path.api.razza.dev/v1/routes/

{
  "routes": [
    {
      "route": "JSQ_33_HOB",
      "id": "1024",
      "name": "Journal Square - 33rd Street (via Hoboken)",
      "color": "ff9900",
      "lines": [
        {
          "displayName": "33rd Street (via Hoboken) - Journal Square",
          "headsign": "Journal Square via Hoboken",
          "direction": "TO_NJ"
        },
        {
          "displayName": "Journal Square - 33rd Street (via Hoboken)",
          "headsign": "33rd via Hoboken",
          "direction": "TO_NY"
        }
      ]
    },
    // ...
  ]
}

Get Route

HTTP: https://path.api.razza.dev/v1/routes/NWK_WTC

{
  "route": "NWK_WTC",
  "id": "862",
  "name": "Newark - World Trade Center",
  "color": "d93a30",
  "lines": [
    {
      "displayName": "World Trade Center - Newark",
      "headsign": "Newark",
      "direction": "TO_NJ"
    },
    {
      "displayName": "Newark - World Trade Center",
      "headsign": "World Trade Center",
      "direction": "TO_NY"
    }
  ]
}

Demo

You can query the API via your web browser by navigating to a valid endpoint. For example the 9th street station realtime data.

A simple web app using the realtime arrival data can be found here.

Versioning

New fields and features will continue to be added to v1 of the API. No fields will be removed and no breaking changes will be made to v1. Any breaking changes will result in a version number increment and the previous API version will run along side the new version for at least 30 days. There are a number of external consumers of this API including Transit and Citymapper.

Other sources

Project to convert this data into GTFS Realtime format: https://github.com/jamespfennell/path-train-gtfs-realtime

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages