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

# List Station Trains

> Returns the trains arriving at and departing from one or more of your stations during a time window: timetable trains from bookings, and inbound interchange trains reported by other railroads. Each train has its direction, its time at the station, its car count, weight and length, and a `key` that identifies it across pages and calls.

Stations and window: `station_grouping_ids` lists up to 200 station ids (a station's numeric `legacyGroupingId` in Get Network Hierarchy). Each must be an active station you can see. `window_start` and `window_end` bound the train times, end exclusive.

Paging: set `page.page_size` (at most 100) and follow `page.next_token` until it is empty; send the same stations, window and sources with each token. A paged window can be up to 31 days. Without a page size you may ask for one station and at most 24 hours. Each page reads the data as it stands when it is read, so a train retimed during a walk can be missed or listed twice: de-duplicate by `key`. A page can hold fewer trains than `page_size` and still have a next token.

Errors: a paged call answers `FAILED_PRECONDITION` while paging is not yet enabled for your railroad; make an unpaged one-station call instead. A paged call answers `UNAVAILABLE` when a source fails; retry the same page with the same token. An unpaged call instead returns the other sources' trains and names the failed source in `unavailable_sources`, unless every source that ran failed, which is an error.

Permissions: with `inventoryManagement.trainWorkOrders.list`, a timetable train linked to a Trains & Jobs work order carries it in `work_order`; pass the `work_order.work_order_id` values to List Work Orders (`workOrderIds`) for the full work orders. With `inventoryManagement.consist.list`, interchange trains are listed. A caller without either permission gets fewer trains or fields, not an error.



## OpenAPI

````yaml /user-docs/api-reference/station_train.swagger.json post /t/v1/list-station-trains
openapi: 3.0.1
info:
  title: protobuf/arms/station_train.proto
  version: version not set
servers:
  - description: Production (US)
    url: https://api-lg-k-h1.arms.cedarai.com
  - description: Production (EU)
    url: https://api-lg-k-h1.arms.cedarai.se
security:
  - ApiKeyAuth: []
    AssumeUserAuth: []
tags:
  - name: StationTrainService
paths:
  /t/v1/list-station-trains:
    post:
      tags:
        - StationTrainService
      summary: List Station Trains
      description: >-
        Returns the trains arriving at and departing from one or more of your
        stations during a time window: timetable trains from bookings, and
        inbound interchange trains reported by other railroads. Each train has
        its direction, its time at the station, its car count, weight and
        length, and a `key` that identifies it across pages and calls.


        Stations and window: `station_grouping_ids` lists up to 200 station ids
        (a station's numeric `legacyGroupingId` in Get Network Hierarchy). Each
        must be an active station you can see. `window_start` and `window_end`
        bound the train times, end exclusive.


        Paging: set `page.page_size` (at most 100) and follow `page.next_token`
        until it is empty; send the same stations, window and sources with each
        token. A paged window can be up to 31 days. Without a page size you may
        ask for one station and at most 24 hours. Each page reads the data as it
        stands when it is read, so a train retimed during a walk can be missed
        or listed twice: de-duplicate by `key`. A page can hold fewer trains
        than `page_size` and still have a next token.


        Errors: a paged call answers `FAILED_PRECONDITION` while paging is not
        yet enabled for your railroad; make an unpaged one-station call instead.
        A paged call answers `UNAVAILABLE` when a source fails; retry the same
        page with the same token. An unpaged call instead returns the other
        sources' trains and names the failed source in `unavailable_sources`,
        unless every source that ran failed, which is an error.


        Permissions: with `inventoryManagement.trainWorkOrders.list`, a
        timetable train linked to a Trains & Jobs work order carries it in
        `work_order`; pass the `work_order.work_order_id` values to List Work
        Orders (`workOrderIds`) for the full work orders. With
        `inventoryManagement.consist.list`, interchange trains are listed. A
        caller without either permission gets fewer trains or fields, not an
        error.
      operationId: ListStationTrains
      parameters:
        - description: Carrier ID
          in: header
          name: Carrier
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/armsListStationTrainsRequest'
        description: The stations and time window to list trains for, with forward paging.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/armsListStationTrainsResponse'
          description: A successful response.
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
          description: An unexpected error response.
components:
  schemas:
    armsListStationTrainsRequest:
      description: The stations and time window to list trains for, with forward paging.
      example:
        page:
          nextToken: ''
          pageSize: 50
        sources:
          - STATION_TRAIN_SOURCE_TRIP_PLAN
          - STATION_TRAIN_SOURCE_INTERCHANGE_CONSIST
        stationGroupingIds:
          - 10234
          - 10871
        windowEnd: '2026-12-08T00:00:00Z'
        windowStart: '2026-12-01T00:00:00Z'
      properties:
        page:
          $ref: '#/components/schemas/armsPage'
        sources:
          description: >-
            Which kinds of train to list: STATION_TRAIN_SOURCE_TRIP_PLAN
            (timetable trains from bookings) and
            STATION_TRAIN_SOURCE_INTERCHANGE_CONSIST (inbound interchange
            trains). Empty means both; any other value is `INVALID_ARGUMENT`. A
            source you lack permission for lists nothing; it is not an error.
          items:
            $ref: '#/components/schemas/armsStationTrainSource'
          type: array
        stationGroupingId:
          description: >-
            Deprecated: use stationGroupingIds. Setting both is
            INVALID_ARGUMENT.
          format: int32
          type: integer
        stationGroupingIds:
          description: >-
            The stations to list trains at: each a station's numeric
            legacyGroupingId from Get Network Hierarchy. Up to 200 distinct
            stations; each must be an active station of your carrier that you
            can see. Unpaged requests take one station.
          items:
            format: int32
            type: integer
          type: array
        windowEnd:
          description: >-
            End of the window (UTC, exclusive). Unpaged, at most 24 hours after
            windowStart; paged, at most 31 days.
          format: date-time
          type: string
        windowStart:
          description: >-
            Start of the window (UTC, inclusive). A train is listed when its
            time at the station is in [windowStart, windowEnd).
          format: date-time
          type: string
      title: List Station Trains Request
      type: object
    armsListStationTrainsResponse:
      properties:
        page:
          $ref: '#/components/schemas/armsPage'
        trains:
          description: >-
            Sorted by time, then direction, source, trainId and key, across
            every requested station.
          items:
            $ref: '#/components/schemas/armsStationTrain'
          type: array
        unavailableSources:
          description: >-
            Unpaged requests only: requested sources that failed and contributed
            no trains. A paged request whose source fails answers UNAVAILABLE
            instead; retry the page with the same token.
          items:
            $ref: '#/components/schemas/armsStationTrainSource'
          type: array
      type: object
    rpcStatus:
      properties:
        code:
          format: int32
          type: integer
        details:
          items:
            $ref: '#/components/schemas/protobufAny'
          type: array
        message:
          type: string
      type: object
    armsPage:
      properties:
        nextToken:
          type: string
        pageSize:
          format: int64
          type: string
        prevToken:
          type: string
      type: object
    armsStationTrainSource:
      default: STATION_TRAIN_SOURCE_UNSPECIFIED
      enum:
        - STATION_TRAIN_SOURCE_UNSPECIFIED
        - STATION_TRAIN_SOURCE_TRIP_PLAN
        - STATION_TRAIN_SOURCE_INTERCHANGE_CONSIST
        - STATION_TRAIN_SOURCE_WORK_ORDER
      type: string
    armsStationTrain:
      properties:
        direction:
          $ref: '#/components/schemas/armsStationTrainDirection'
        interchangeConsist:
          $ref: '#/components/schemas/armsInterchangeConsistRef'
        key:
          description: >-
            Identifies the train across pages and calls. Opaque: do not parse
            it. De-duplicate a paged walk by key, and pass it to List Station
            Train Consists (inbound) or List Station Outbound Cars (outbound)
            for the train's cars at this station.
          type: string
        missingLengthCount:
          format: int64
          type: string
        missingWeightCount:
          format: int64
          type: string
        source:
          $ref: '#/components/schemas/armsStationTrainSource'
        stationGroupingId:
          description: 'The station the train is at: one of the requested stations.'
          format: int32
          type: integer
        time:
          description: >-
            The train's time at the station: the planned time for a timetable
            train, the interchange time for an interchange train.
          format: date-time
          type: string
        totalCarCount:
          format: int64
          type: string
        totalLength:
          $ref: '#/components/schemas/cedaraiIntLengthMeasurement'
        totalWeight:
          $ref: '#/components/schemas/cedaraiIntWeightMeasurement'
        trainId:
          type: string
        tripPlan:
          $ref: '#/components/schemas/armsPlannedTrainAtStation'
        workOrder:
          $ref: '#/components/schemas/armsStationTrainWorkOrder'
      type: object
    protobufAny:
      additionalProperties:
        type: object
      properties:
        '@type':
          type: string
      type: object
    armsStationTrainDirection:
      default: STATION_TRAIN_DIRECTION_UNSPECIFIED
      enum:
        - STATION_TRAIN_DIRECTION_UNSPECIFIED
        - STATION_TRAIN_DIRECTION_INBOUND
        - STATION_TRAIN_DIRECTION_OUTBOUND
      type: string
    armsInterchangeConsistRef:
      properties:
        archived:
          type: boolean
        consistGroupingId:
          format: int64
          type: string
        consistType:
          $ref: '#/components/schemas/armsConsistTypeCode'
        fromCarrierCode:
          type: string
        supersededConsistCount:
          format: int64
          type: string
        timeQualifier:
          $ref: '#/components/schemas/armsDateTimeQualifier'
      type: object
    cedaraiIntLengthMeasurement:
      properties:
        unit:
          type: string
        value:
          format: int32
          type: integer
      type: object
    cedaraiIntWeightMeasurement:
      properties:
        unit:
          type: string
        value:
          format: int32
          type: integer
      type: object
    armsPlannedTrainAtStation:
      properties:
        assignedCarCount:
          format: int64
          type: string
        coreDate:
          type: string
        direction:
          $ref: '#/components/schemas/armsPlannedTrainDirection'
        missingLengthCount:
          format: int64
          type: string
        missingWeightCount:
          format: int64
          type: string
        plannedTime:
          format: date-time
          type: string
        reservationCount:
          format: int64
          type: string
        runId:
          type: string
        totalCarCount:
          format: int64
          type: string
        totalLength:
          $ref: '#/components/schemas/cedaraiIntLengthMeasurement'
        totalWeight:
          $ref: '#/components/schemas/cedaraiIntWeightMeasurement'
        trainId:
          type: string
      type: object
    armsStationTrainWorkOrder:
      properties:
        arrivalInferred:
          type: boolean
        consistKey:
          description: >-
            Set when the train shows a consist: send it in place of the train's
            key to List Station Train Consists (inbound), or beside it to List
            Station Outbound Cars (outbound). Opaque.
          type: string
        consistState:
          $ref: '#/components/schemas/armsStationTrainConsistState'
        departureStationName:
          type: string
        departureTime:
          format: date-time
          type: string
        eventId:
          format: int64
          type: string
        eventTime:
          format: date-time
          type: string
        frozenAtStationGroupingId:
          format: int64
          type: string
        frozenAtStationName:
          type: string
        hasDeparted:
          type: boolean
        setoutCarCount:
          format: int64
          type: string
        status:
          $ref: '#/components/schemas/armsWorkOrderStatus'
        trainId:
          type: string
        workOrderId:
          description: The work order's id; List Work Orders takes it in workOrderIds.
          type: string
      type: object
    armsConsistTypeCode:
      default: CONSIST_TYPE_CODE_UNSPECIFIED
      enum:
        - CONSIST_TYPE_CODE_UNSPECIFIED
        - AEI
        - BAD_ORDER
        - CREW_ONLY
        - DETOUR
        - JOINT_TRACK
        - INFORMATION_ONLY
        - PASSING
        - BAD_ORDER_RELEASE
        - SWITCH
        - TRAIN
        - ACTUAL_INTERCHANGE
      type: string
    armsDateTimeQualifier:
      default: DATE_TIME_QUALIFIER_UNSPECIFIED
      enum:
        - DATE_TIME_QUALIFIER_UNSPECIFIED
        - ESTIMATED
        - ACTUAL
      type: string
    armsPlannedTrainDirection:
      default: PLANNED_TRAIN_DIRECTION_UNSPECIFIED
      enum:
        - PLANNED_TRAIN_DIRECTION_UNSPECIFIED
        - PLANNED_TRAIN_DIRECTION_INBOUND
        - PLANNED_TRAIN_DIRECTION_OUTBOUND
      type: string
    armsStationTrainConsistState:
      default: STATION_TRAIN_CONSIST_STATE_UNSPECIFIED
      enum:
        - STATION_TRAIN_CONSIST_STATE_UNSPECIFIED
        - STATION_TRAIN_CONSIST_STATE_BOOKINGS
        - STATION_TRAIN_CONSIST_STATE_TRAIN_SET_LIVE
        - STATION_TRAIN_CONSIST_STATE_ARRIVED_SNAPSHOT
        - STATION_TRAIN_CONSIST_STATE_DEPARTED_SNAPSHOT
        - STATION_TRAIN_CONSIST_STATE_EN_ROUTE_SNAPSHOT
      type: string
    armsWorkOrderStatus:
      default: PENDING
      enum:
        - PENDING
        - ACTIVE
        - CLOSED
        - CANCELLED
      type: string
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-arms-api-key
      type: apiKey
    AssumeUserAuth:
      in: header
      name: x-arms-assume-user
      type: apiKey

````

## Related topics

- [List Station Train Consists](https://docs.cedarai.com/api-reference/stationtrainservice/list-station-train-consists.md)
- [List Station Outbound Cars](https://docs.cedarai.com/api-reference/stationtrainservice/list-station-outbound-cars.md)
- [List station tracks](https://docs.cedarai.com/api-reference/list-station-tracks.md)
- [List Train Reason Codes](https://docs.cedarai.com/api-reference/workorderservice/list-train-reason-codes.md)
- [Inventory](https://docs.cedarai.com/user-docs/mobile/inventory.md)
