> ## Documentation Index
> Fetch the complete documentation index at: https://mtaapi.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get NJ Transit rail departures

> Get upcoming realtime rail departures for a station, including train status, delay, track, and optional stop lists.



## OpenAPI

````yaml /openapi.json get /api/v1/nj-transit/rail/departures
openapi: 3.1.2
info:
  title: MTA API
  description: Managed, API-key protected access to MTA realtime and static data.
  version: 0.1.0
servers:
  - url: https://www.mtaapi.dev
    description: Production
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: subway
    description: Subway realtime data
  - name: bus
    description: BusTime realtime data
  - name: path
    description: PATH realtime arrivals for New Jersey stations
  - name: nj-transit-rail
    description: NJ Transit RailData realtime data
  - name: nyc-ferry
    description: NYC Ferry GTFS and GTFS-Realtime data
  - name: citi-bike
    description: Citi Bike GBFS station and service data
  - name: lirr
    description: Long Island Rail Road GTFS and GTFS-Realtime data
  - name: metro-north
    description: Metro-North Railroad GTFS and GTFS-Realtime data
  - name: alerts
    description: Service alerts
  - name: stops
    description: Route-aware static GTFS stop lookup
  - name: system
    description: Health and database status
paths:
  /api/v1/nj-transit/rail/departures:
    get:
      tags:
        - nj-transit-rail
      summary: Get NJ Transit rail departures
      description: >-
        Get upcoming realtime rail departures for a station, including train
        status, delay, track, and optional stop lists.
      operationId: getApiV1Nj-transitRailDepartures
      parameters:
        - name: station
          in: query
          required: true
          schema:
            minLength: 1
            description: >-
              NJ Transit RailData station code, such as NY for New York Penn
              Station.
            type: string
        - name: line
          in: query
          required: false
          schema:
            minLength: 1
            description: >-
              Optional RailData line code for the 19-record schedule endpoint,
              such as NEC/NJCL line codes where available.
            type: string
        - name: includeStops
          in: query
          required: false
          schema:
            description: >-
              Include stop lists for each train. When true, the backend uses
              RailData getTrainSchedule.
            type: boolean
        - name: limit
          in: query
          required: false
          schema:
            minimum: 1
            maximum: 50
            type: number
        - name: includeRaw
          in: query
          required: false
          schema:
            type: boolean
      responses:
        '200':
          description: Response for status 200
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  required:
                    - mode
                    - route
                    - station
                    - departureTime
                    - minutes
                    - realtime
                    - source
                  properties:
                    mode:
                      const: nj-transit-rail
                      type: string
                    route:
                      type: object
                      required:
                        - id
                      properties:
                        id:
                          type: string
                        gtfsId:
                          type: string
                        shortName:
                          type: string
                        longName:
                          type: string
                        type:
                          type: number
                        color:
                          type: string
                        textColor:
                          type: string
                    station:
                      type: object
                      required:
                        - id
                        - name
                        - mode
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        shortName:
                          type: string
                        mode:
                          const: nj-transit-rail
                          type: string
                        raw: {}
                    destination:
                      type: string
                    departureTime:
                      type: string
                    minutes:
                      type: number
                    track:
                      type: string
                    trainId:
                      type: string
                    tripId:
                      type: string
                    status:
                      type: string
                    delaySeconds:
                      type: number
                    lastUpdated:
                      type: string
                    lat:
                      type: number
                    lon:
                      type: number
                    stops:
                      type: array
                      items:
                        type: object
                        required:
                          - station
                        properties:
                          station:
                            type: object
                            required:
                              - id
                              - name
                              - mode
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                              shortName:
                                type: string
                              mode:
                                const: nj-transit-rail
                                type: string
                              raw: {}
                          arrivalTime:
                            type: string
                          departureTime:
                            type: string
                          status:
                            type: string
                          departed:
                            type: boolean
                          pickupOnly:
                            type: boolean
                          dropoffOnly:
                            type: boolean
                    realtime:
                      type: boolean
                    source:
                      type: string
                    raw: {}
      x-codeSamples:
        - lang: typescript
          label: mta-js
          source: >-
            import { MTA } from "mta-js";

            const mta = new MTA({ apiKey: process.env.MTA_API_KEY });

            const data = await mta.njTransit.rail.departures({ station: "NY",
            limit: 10 });
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.