Ola Share


The API requests are responses for Ola Share category are a bit different from City Taxi (p2p) categories.


Ride Availability/Estimate


Ola Share prices are always fixed, and payment has to be done before the ride starts. They are available at a certain discount as compared to p2p rides. Fares are provided for both 1 seat and 2 seats, and user can be given a choice to choose desired number of seats.

Example Request

GET

https://devapi.olacabs.com/v1/products?pickup_lat=12.8953741&pickup_lng=77.5859018&drop_lat=12.9560643 &drop_lng=77.6514801&category=share

Headers: {
Authorization: Bearer 9b6121212f12ff12f12f1f12f1f12f2
x-app-token: fd6121212f12ff12f12f1f12f1f12fa
}

Example Response (Success)


{
    "categories": [
        {
            "id": "share",
            "display_name": "Share",
            "currency": "INR",
            "distance_unit": "kilometre",
            "time_unit": "minute",
            "eta": 1,
            "distance": "0.0",
            "ride_later_enabled": "false",
            "image": "http://d1foexe15giopy.cloudfront.net/share.png",
            "cancellation_policy": {
                "cancellation_charge": 25,
                "currency": "INR",
                "cancellation_charge_applies_after_time": 2,
                "time_unit": "minute"
            },
            "select_applicable": false,
            "fare_breakup": [
                {
                    "type": "standard_rate",
                    "fare": "Save up to 50% on Mini fares",
                    "surcharge": []
                }
            ]
        }
    ],
    "ride_estimate": [
        {
            "category": "share",
            "travel_time_min": 35,
            "travel_time_max": 57,
            "travel_time_unit": "MINUTES",
            "promotional_message": "Ola share rides are prepaid. Please pay upon boarding.",
            "fares": [
                {
                    "seats": 1,
                    "actual_cost": 130,
                    "cost": 60,			// Final  fare applicable
                    "savings": 70,
                    "peak_time_charge": "1.0x",
                    "peak_time_text": "Fare inclusive of 1.0x peak pricing",
                    "discount_string": "54% of micro rate",
                    "fare_string": "46% of micro rate"
                },
                {
                    "seats": 2,
                    "actual_cost": 130,
                    "cost": 72,
                    "savings": 58,
                    "peak_time_charge": "1.0x",
                    "peak_time_text": "Fare inclusive of 1.0x peak pricing",
                    "discount_string": "45% of micro rate",
                    "fare_string": "55% of micro rate"
                }
            ]
        }
    ]
}





Create Booking


Two additional parameters are required:

  1. seats: can have value as 1 or 2
  2. retry: to be sent as true

Example Request

POST

https://devapi.olacabs.com/v1.5/bookings/create


{
"drop_lat":"12.9592",
"drop_lng":"77.6974",
"pickup_lat":"12.9523",
"pickup_lng":"77.6432",
"category": "share",
"seats":"1",
"pickup_mode":"now",
"retry":true
}

Headers: {
Authorization: Bearer 96121212f12ff12f12f1f12f1f12f2
x-app-token: f6121212f12ff12f12f1f12f1f12fa
}

Example Response (Success)

  • If cab is available and immediately allotted:

    {
        "status": "SUCCESS",
        "booking_id": "OSN212268363"
    }
    
  • If cab is not available and retry in progress:

    {
        "status": "SUCCESS",
        "booking_id": null,
        "retry": {
            "booking_timeout": 140,
            "booking_timeout_unit": "SECONDS",
            "next_retry_time": "5"
        },
        "txn_id": "a72774a4-1a33-4df2-962c-d540fd187a70"
    }
    

    The response will not consist of booking id, and instead will contain a temporary transaction id which needs to be sent in Track Ride response. Once booking id is received, that needs to be sent in Track Ride response to get cab details.

    Example Request

    GET

    https://devapi.olacabs.com/v1/bookings/track_ride?txn_id=ff79f323-9daf-40c6-893f-cf9214ce4ab2

    Example Response (Success)

    • When driver allotment is in progress:
      
          {
             "status":"SUCCESS",
             "booking_status":"ALLOTMENT_PENDING"
          }
    • When driver allotment is successful
      
      {
             "status":"SUCCESS",
             "booking_status":"CALL_DRIVER",
             "booking_id":"OSN12345678",
             "message":"You've successfully booked 1 seat."
      }
    • When driver allotment does not happen:
      
          {
             "status":"SUCCESS",
             "booking_status":"ALLOTMENT_FAILED"
          }

Example Response (Failure)

Some failure scenarios applicable only in the case of Ola Share bookings are:

  • No Share cabs available in user’s route`
    
    {
        "status": "FAILURE",
        "message": "Currently, there are no cabs headed towards your destination"
    }
  • Others
    
    {
        "status": "FAILURE",
        "message": "Please enter an appropriate destination to share your ride."
    }


Ride Cancellation


Example Request

POST

https://devapi.olacabs.com/v1/bookings/cancel


{
  "booking_id":"OSN123456789",
  "reason":"My reason is not listed"
}

Headers: {
  Authorization: Bearer 96121212f12ff12f12f1f12f1f12f2
  x-app-token: fd6121212f12ff12f12f1f12f1f12fa
}
          

Example Response (Success)


{
    "status": "SUCCESS",
    "request_type": "BOOKING_CANCEL",
    "header": "SUCCESS",
    "text": "Your booking with id OSN123456789 has been cancelled successfully."
}

Example Response (Failure)


{
  "status": "FAILURE",
  "request_type": "BOOKING_CANCEL",
  "reason": "CANCELLATION_NOT_ALLOWED",
  "header": "Uh-oh!",
  "text": "The ride cannot be cancelled now."
}

Ride Tracking


GET /v1/bookings/track_ride

You can track the status of your booking via this API.

Booking states

CALL_DRIVER -> CLIENT_LOCATED -> INVOICE -> IN_PROGRESS ->COMPLETED

Example Request

GET

https://devapi.olacabs.com/v1/bookings/track_ride?booking_id=OSN123456789

Response for call driver


{
    "status": "SUCCESS",
    "request_type": "TRACK_RIDE",
    "booking_id": "OSN123456789",
    "pickup_location": {
        "lat": 12.88321,
        "lng": 77.5211603
    },
    "drop_location": {
        "lat": 12.9560643,
        "lng": 77.65366879999999
    },
    "driver_name": "Rahul Kumar",
    "driver_number": "9000000000",
    "driver_image_url": "http://s3-ap-southeast-1.amazonaws.com/ola-ims-drivers/development/drivers/10109204/original_small_image_1.jpg",
    "vehicle_type": "Accord",
    "vehicle_number": "KA01SJ0009",
    "vehicle_color": "White",
    "price_details": {
        "fare": 342,
        "service_tax": 0,
        "discount_percentage": 43,
        "discount_value": 263.94,
        "toll_charges": 72
    },
    "bearing": 0,
    "speed": 1,
    "driver_rating": 0,
    "share_ride_url": "https://www.olacabs-dev.in/track/olashare/73340fba44069",
    "duration": {
        "value": 0,
        "unit": "MINUTE"
    },
    "distance": {
        "value": 527,
        "unit": "METER"
    },
    "driver_lat": 12.8818917,
    "driver_lng": 77.5246589,
    "passengers": [
        {
            "name": "Debashis deb"
        }
    ],
    "route": [
        {
            "name": "Shashank Jaiswal",
            "state": "pickup",
            "lat": 12.8832,
            "lng": 77.5212
        },
        {
            "name": "Debashis deb",
            "state": "pickup",
            "lat": 12.8832,
            "lng": 77.5212
        },
        {
            "name": "Debashis deb",
            "state": "drop",
            "lat": 12.9561,
            "lng": 77.6537
        },
        {
            "name": "Shashank Jaiswal",
            "state": "drop",
            "lat": 12.9561,
            "lng": 77.6537
        }
    ],
    "promotional_message": "Ola share rides are prepaid. Please pay upon boarding.",
    "booking_status": "CALL_DRIVER"
}

Response for client located state


{
    "status": "SUCCESS",
    "request_type": "TRACK_RIDE",
    "booking_id": "OSN123456789",
    "pickup_location": {
        "lat": 12.8949678,
        "lng": 77.58599199999999
    },
    "drop_location": {
        "lat": 12.9560643,
        "lng": 77.65366879999999
    },
    "driver_name": "Rahul Kumar",
    "driver_number": "9000000000",
    "driver_image_url": "http://s3-ap-southeast-1.amazonaws.com/ola-ims-drivers/development/drivers/10109204/original_small_image_1.jpg",
    "vehicle_type": "Accord",
    "vehicle_number": "KA01SJ0009",
    "vehicle_color": "White",
    "price_details": {
        "fare": 65,
        "service_tax": 0,
        "discount_percentage": 70,
        "discount_value": 155.33,
        "toll_charges": 6.6
    },
    "bearing": 0,
    "speed": 0,
    "driver_rating": 0,
    "share_ride_url": "https://www.olacabs-dev.in/track/olashare/005aff6944069",
    "duration": {
        "value": 3,
        "unit": "MINUTE"
    },
    "distance": {
        "value": 267,
        "unit": "METER"
    },
    "driver_lat": 12.8968157,
    "driver_lng": 77.5861901,
    "passengers": [],
    "route": [
        {
            "name": "Shashank Jaiswal",
            "state": "pickup",
            "lat": 12.895,
            "lng": 77.586
        },
        {
            "name": "Shashank Jaiswal",
            "state": "drop",
            "lat": 12.9561,
            "lng": 77.6537
        }
    ],
    "promotional_message": "Ola share rides are prepaid. Please pay upon boarding.",
    "otp": {
        "start_trip": {
            "text": "OTP to start ride",
            "value": "9083"
        }
    },
    "booking_status": "CLIENT_LOCATED"
}

Response for Invoice


{
    "status": "SUCCESS",
    "request_type": "TRACK_RIDE",
    "booking_id": "OSN123456789",
    "pickup_location": {
        "lat": 12.8949678,
        "lng": 77.58599199999999
    },
    "drop_location": {
        "lat": 12.9560643,
        "lng": 77.65366879999999
    },
    "driver_name": "Rahul Kumar",
    "driver_number": "9000000000",
    "driver_image_url": "http://s3-ap-southeast-1.amazonaws.com/ola-ims-drivers/development/drivers/10109204/original_small_image_1.jpg",
    "vehicle_type": "Accord",
    "vehicle_number": "KA01SJ0009",
    "vehicle_color": "White",
    "price_details": {
        "fare": 65,
        "service_tax": 0,
        "discount_percentage": 70,
        "discount_value": 155.33,
        "toll_charges": 6.6
    },
    "bearing": 0,
    "speed": 0,
    "driver_rating": 0,
    "share_ride_url": "https://www.olacabs-dev.in/track/olashare/005aff6944069",
    "duration": {
        "value": 0,
        "unit": "MINUTE"
    },
    "distance": {
        "value": 270,
        "unit": "METER"
    },
    "driver_lat": 12.8968279,
    "driver_lng": 77.5861944,
    "passengers": [],
    "route": [
        {
            "name": "Shashank Jaiswal",
            "state": "pickup",
            "lat": 12.895,
            "lng": 77.586
        },
        {
            "name": "Shashank Jaiswal",
            "state": "drop",
            "lat": 12.9561,
            "lng": 77.6537
        }
    ],
    "promotional_message": "Ola share rides are prepaid. Please pay upon boarding.",
    "otp": {
        "start_trip": {
            "text": "OTP to start ride",
            "value": "9083"
        }
    },
    "booking_status": "INVOICE"
}

Response for in progress state


{
    "status": "SUCCESS",
    "request_type": "TRACK_RIDE",
    "booking_id": "OSN123456789",
    "pickup_location": {
        "lat": 12.8949678,
        "lng": 77.58599199999999
    },
    "drop_location": {
        "lat": 12.9560643,
        "lng": 77.65366879999999
    },
    "driver_name": "Rahul Kumar",
    "driver_number": "9000000000",
    "driver_image_url": "http://s3-ap-southeast-1.amazonaws.com/ola-ims-drivers/development/drivers/10109204/original_small_image_1.jpg",
    "vehicle_type": "Accord",
    "vehicle_number": "KA01SJ0009",
    "vehicle_color": "White",
    "price_details": {
        "fare": 65,
        "service_tax": 0,
        "discount_percentage": 70,
        "discount_value": 155.33,
        "toll_charges": 6.6
    },
    "bearing": 0,
    "speed": 0,
    "driver_rating": 0,
    "share_ride_url": "https://www.olacabs-dev.in/track/olashare/005aff6944069",
    "duration": {
        "value": 0,
        "unit": "MINUTE"
    },
    "distance": {
        "value": 267,
        "unit": "METER"
    },
    "driver_lat": 12.896818,
    "driver_lng": 77.5861908,
    "passengers": [],
    "route": [
        {
            "name": "Shashank Jaiswal",
            "state": "pickup",
            "lat": 12.895,
            "lng": 77.586
        },
        {
            "name": "Shashank Jaiswal",
            "state": "drop",
            "lat": 12.9561,
            "lng": 77.6537
        }
    ],
    "promotional_message": "Ola share rides are prepaid. Please pay upon boarding.",
    "booking_status": "IN_PROGRESS"
}

Response for completed state


{
    "status": "SUCCESS",
    "request_type": "TRACK_RIDE",
    "booking_id": "OSN123456789",
    "pickup_location": {
        "lat": 12.8949678,
        "lng": 77.58599199999999
    },
    "drop_location": {
        "lat": 12.9560643,
        "lng": 77.65366879999999
    },
    "driver_name": "Rahul Kumar",
    "driver_number": "9000000000",
    "driver_image_url": "http://s3-ap-southeast-1.amazonaws.com/ola-ims-drivers/development/drivers/10109204/original_small_image_1.jpg",
    "vehicle_type": "Accord",
    "vehicle_number": "KA01SJ0009",
    "vehicle_color": "White",
    "price_details": {
        "fare": 65,
        "service_tax": 0,
        "discount_percentage": 70,
        "discount_value": 155.33,
        "toll_charges": 6.6
    },
    "booking_status": "COMPLETED"
}