The train visits API endpoint allows querying for train visits. You can optionally pass in a page and/or per parameter.

Supported Formats

json

Errors

Code Description
400 Bad Request.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/train_visits.json" -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=ADD TOKEN HERE"
{
  "actions": {
    "index": { "method": "GET", "url": "https://app.octopi.co/api/v1/train_visits.json" },
    "next":  { "method": "GET", "url": "https://app.octopi.co/api/v1/train_visits.json?page=2" },
    "previous": { "method": "GET", "url": "https://app.octopi.co/api/v1/train_visits.json?page=1" },
    "last": { "method": "GET", "url": "https://app.octopi.co/api/v1/train_visits.json?page=6" }
  },
  "train_visits": [
    {
      "id": 1,
      "visit_number": "ABC123",
      "visit_type": "inbound",
      "carrier": { "name": "Rail" },
      "notes": null,
      "estimated_time_of_arrival": "2026-05-01T10:00:00Z",
      "actual_time_of_arrival": null,
      "operation_started_at": null,
      "operation_completed_at": null,
      "created_at": "2026-04-01T08:00:00Z",
      "updated_at": "2026-04-01T08:00:00Z"
    }
  ]
}

Params

Param name Description
page
optional

The page number to be fetched. This value defaults to 1.

Validations:

  • Must be a number.

per
optional

The number of items to be displayed. This value defaults to 10 and accepts a maximum of 100.

Validations:

  • Must be a number.

visit_number
optional

Filter by visit number. Visit numbers are stored uppercase; this filter is case-sensitive.

Validations:

  • Must be a String

visit_type
optional

Filter by visit type. Valid values are ‘inbound’ or ‘outbound’.

Validations:

  • Must be a String