API: Get All Fares

Request

Retrieve all fares with a GET request:

GET /fares

Available Query Parameters:

Parameter Type Description Example
page Integer Number of page (min: 1) 1
per_page Integer Number of items per page (max: 1000) 10
search String Fare amount, route start district name and route end district name to search District 1

Sample Response:


{
  "status": "success",
  "message": "Fares retrieved successfully",
  "data" : [
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "route_id": 1,
                "start_id": 1,
                "end_id": 2,
                "start_name": "District 1",
                "end_name": "District 2",
                "distance": 244,
                "duration": "5:30",
                "route_status": 1,
                "seat_plan_id": 1,
                "seat_plan_name": "AC Business",
                "coach_type": 1,
                "seat_type": "Business Class",
                "from_date": "2024-01-01",
                "to_date": "2024-12-31",
                "amount": 1500,
                "status": 1,
                "created_by": 1,
                "updated_by": 1,
                "created_at": "2024-01-01T12:00:00",
                "updated_at": "2024-01-01T12:00:00"
            },
        ],
        "first_page_url": "http://127.0.0.1:8000/api/fares?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "http://127.0.0.1:8000/api/fares?page=1",
        "links": [
        {
            "url": null,
            "label": "« Previous",
            "active": false
        },
        {
            "url": "http://127.0.0.1:8000/api/fares?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "Next »",
            "active": false
        }
        ],
        "next_page_url": null,
        "path": "http://127.0.0.1:8000/api/fares",
        "per_page": 10,
        "prev_page_url": null,
        "to": 1,
        "total": 1
  ]
}
                

Response Fields:

  • route_id - ID of the route
  • start_id, end_id - Start and end district IDs
  • start_name, end_name - Start and end district names
  • distance - Route distance in kilometers
  • duration - Estimated travel time
  • seat_plan_id - ID of the seat plan
  • seat_plan_name - Name of the seat plan
  • coach_type - Type of coach (1 = AC, 2 = Non-AC)
  • seat_type - Class of seat (Suite Class, Business Class, Sleeper, Economy)
  • amount - Fare amount in smallest currency unit
  • from_date, to_date - Validity period of the fare

Seat Types and Pricing:

Available Seat Types
  • Suite Class - Premium luxury
  • Business Class - Enhanced comfort
  • Sleeper - Long journey comfort
  • Economy - Budget-friendly
Coach Types
  • Type 1 (AC) - Air-conditioned coaches
  • Type 2 (Non-AC) - Standard coaches

Notes:

  • Fares are returned with complete route and seat plan information
  • Amount is specified in the smallest currency unit
  • Date ranges define fare validity periods
  • Only active fares (not soft-deleted) are returned