Lyft API
  1. User
Lyft API
  • Restricted
  • Public
    • Cost estimates
      GET
    • Available drivers nearby
      GET
    • Pickup ETAs
      GET
    • Types of rides
      GET
  • User
    • The user's general info
      GET
    • List rides
      GET
    • Request a Lyft
      POST
    • Get the ride detail of a given ride ID
      GET
    • Cancel a ongoing requested ride
      POST
    • Update the destination of the ride
      PUT
    • Add the passenger's rating, feedback, and tip
      PUT
    • Get the receipt of the rides.
      GET
  • Sandbox
    • Preset Prime Time percentage
      PUT
    • Propagate ride through ride status
      PUT
    • Preset types of rides for sandbox
      PUT
    • Driver availability for processing ride request
      PUT
  1. User

Get the ride detail of a given ride ID

GET
/rides/{id}
User
Get the status of a ride along with information about the driver, vehicle and price of a given ride ID
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://api.lyft.com/rides/'
响应示例响应示例
200 - 示例 1
{
    "beacon_color": "#FFFFFF",
    "destination": {
        "address": "987 Second St, Anytown, CA",
        "lat": 36.9453452,
        "lng": -123.8642521
    },
    "distance_miles": 16.2,
    "driver": {
        "first_name": "Joe",
        "image_url": "http://example.com/lyft.png",
        "phone_number": "+15554445111",
        "rating": "4.9"
    },
    "dropoff": {
        "address": "987 Second St, Anytown, CA",
        "lat": 36.9453452,
        "lng": -123.8642521,
        "time": "2015-09-24T23:28:25+00:00"
    },
    "duration_seconds": 1620,
    "line_items": [
        {
            "amount": 500,
            "currency": "USD",
            "type": "Ride"
        },
        {
            "amount": 250,
            "currency": "USD",
            "type": "Prime Time"
        },
        {
            "amount": 155,
            "currency": "USD",
            "type": "Service fee"
        }
    ],
    "location": {
        "address": "987 Second St, Anytown, CA",
        "lat": 36.9453452,
        "lng": -123.8642521
    },
    "origin": {
        "address": "123 Main St, Anytown, CA",
        "lat": 36.9442175,
        "lng": -123.8679133
    },
    "passenger": {
        "first_name": "Jane",
        "phone_number": "+15554445000",
        "user_id": "776630198662493392"
    },
    "pickup": {
        "address": "123 Main St, Anytown, CA",
        "lat": 36.9442175,
        "lng": -123.8679133,
        "time": "2015-09-24T23:27:25+00:00"
    },
    "price": {
        "amount": 905,
        "currency": "USD",
        "description": "Total ride price"
    },
    "primetime_percentage": "50%",
    "requested_at": "2015-09-24T23:26:25+00:00",
    "ride_id": 123456789,
    "ride_profile": "personal",
    "ride_type": "lyft",
    "status": "droppedOff",
    "vehicle": {
        "color": "black",
        "image_url": "http://example.com/lyft.png",
        "license_plate": "AAAAAAA",
        "make": "Audi",
        "model": "A4"
    }
}

请求参数

Path 参数
id
string 
必需
The ID of the ride

返回响应

🟢200成功
application/json
Detailed ride information including ride status, driver information, passenger information, vehicle information, location information and price
Body
Detail information about a ride
beacon_color
string 
可选
Hex color code of the driver AMP device.
can_cancel
array[string]
可选
枚举值:
driverpassengerdispatcher
canceled_by
string 
可选
The role of user who canceled the ride (if applicable)
cancellation_price
object 
可选
The cost of cancellation if there would be a penalty
示例值:
{"amount":500,"currency":"USD","description":"Total cost"}
amount
integer <int32>
必需
Total price of the ride
currency
string 
必需
The ISO 4217 currency code for the amount (e.g. USD)
description
string 
必需
The description for the cost
token
string 
可选
Token used to confirm the fee when cancelling a request
token_duration
integer <int32>
可选
How long, in seconds, before the token expires
>= 0
destination
object 
可选
The requested location for passenger drop off
示例值:
{"address":"123 Main St, Anytown, CA","eta_seconds":200,"lat":36.9442175,"lng":-123.8679133}{"address":"123 Main St, Anytown, CA","lat":36.9442175,"lng":-123.8679133}{"lat":36.9442175,"lng":-123.8679133}
eta_seconds
integer <int32>
可选
Estimated seconds for a driver to pickup or reach destination based on ride status
lat
number <double>
必需
The latitude component of a location
lng
number <double>
必需
The longitude component of a location
address
string 
可选
A human readable address at/near the given location
distance_miles
number <float>
可选
The distance, in miles, that this ride traveled. This field is only present after drop-off
driver
object (DriverDetail) 
可选
示例值:
{"first_name":"Joe","image_url":"http://example.com/lyft.png","phone_number":"+15554445000","rating":"4.9","user_id":"123456789"}
first_name
string 
必需
The driver's first name
image_url
string 
必需
The driver's image url
phone_number
string <phone>
必需
The driver's contact phone number. Must be E.164 formatted.
rating
string 
必需
The driver's rating based in 0-5 scale
user_id
string 
必需
The driver's id
dropoff
object 
可选
The actual location of passenger drop off
示例值:
{"address":"123 Main St, Anytown, CA","lat":36.9442175,"lng":-123.8679133,"time":"2015-09-24T23:26:25+00:00"}{"address":"123 Main St, Anytown, CA","lat":36.9442175,"lng":-123.8679133}{"lat":36.9442175,"lng":-123.8679133}
time
string <date-time>
可选
Server time when the location object is created
lat
number <double>
必需
The latitude component of a location
lng
number <double>
必需
The longitude component of a location
address
string 
可选
A human readable address at/near the given location
duration_seconds
integer <int32>
可选
Duration of the ride in seconds from pickup to drop-off. This field is only present after drop-off.
feedback
string 
可选
The written feedback the user left for this ride
generated_at
string <date-time>
可选
The request timestamp in date and time
line_items
array[object (LineItem) {3}] 
可选
The break down of cost
amount
integer <int32>
必需
The line item amount
currency
string 
必需
The currency for the amount
type
string 
必需
The line item display name for a charge item
location
object 
可选
The current location info of the ride
示例值:
{"bearing":134.8789520264,"lat":37.776157,"lng":-122.393817}{"lat":36.9442175,"lng":-123.8679133}
lat
number <double>
必需
The latitude component of a location
lng
number <double>
必需
The longitude component of a location
bearing
number <double>
可选
Bearing of the driver's car in degrees
origin
object 
可选
The requested location for passenger pickup
示例值:
{"address":"123 Main St, Anytown, CA","eta_seconds":200,"lat":36.9442175,"lng":-123.8679133}{"address":"123 Main St, Anytown, CA","lat":36.9442175,"lng":-123.8679133}{"lat":36.9442175,"lng":-123.8679133}
eta_seconds
integer <int32>
可选
Estimated seconds for a driver to pickup or reach destination based on ride status
lat
number <double>
必需
The latitude component of a location
lng
number <double>
必需
The longitude component of a location
address
string 
可选
A human readable address at/near the given location
passenger
object (PassengerDetail) 
可选
示例值:
{"first_name":"Jane","image_url":"https://public-api.lyft.com/static/images/user.png","last_name":"Doe","rating":4.9}{"first_name":"Jane","image_url":"https://public-api.lyft.com/static/images/user.png","rating":4.9}
first_name
string 
必需
The passenger's first name
image_url
string 
必需
The passenger's profile image
rating
string 
必需
The passenger's rating
last_name
string 
可选
The passenger's last name
user_id
string 
可选
The passenger's lyft user id
pickup
object 
可选
The actual location of passenger pickup
示例值:
{"address":"123 Main St, Anytown, CA","lat":36.9442175,"lng":-123.8679133,"time":"2015-09-24T23:26:25+00:00"}{"address":"123 Main St, Anytown, CA","lat":36.9442175,"lng":-123.8679133}{"lat":36.9442175,"lng":-123.8679133}
time
string <date-time>
可选
Server time when the location object is created
lat
number <double>
必需
The latitude component of a location
lng
number <double>
必需
The longitude component of a location
address
string 
可选
A human readable address at/near the given location
price
object 
可选
The total price for the current ride
示例值:
{"amount":500,"currency":"USD","description":"Total cost"}
amount
integer <int32>
必需
Total price of the ride
currency
string 
必需
The ISO 4217 currency code for the amount (e.g. USD)
description
string 
必需
The description for the cost
pricing_details_url
string 
可选
The web view showing the pricing structure for the geographic area where the ride was taken
primetime_percentage
string 
可选
The Prime Time percentage applied to the base price
rating
integer <int32>
可选
The rating the user left for this ride, from 1 to 5
requested_at
string <date-time>
可选
The ride requested timestamp in date and time
ride_id
string 
可选
The unique ID of this ride
ride_profile
enum<string> 
可选
Indicates whether the ride was requested from the business profile or personal profile of the user.
枚举值:
personalbusiness
ride_type
enum<string> 
可选
The ID of the ride type
枚举值:
lyftlyft_linelyft_pluslyft_premierlyft_luxlyft_luxsuvother
route_url
string 
可选
The web view showing the passenger, driver, and route for this ride. This field will only be present for rides created through this API, or that have been shared through the "Share my Route" feature
status
enum<string> 
可选
The status of the ride
枚举值:
pendingacceptedarrivedpickedUpdroppedOffcanceledscheduledunknown
vehicle
object (VehicleDetail) 
可选
示例值:
{"color":"black","image_url":"http://example.com/lyft.png","license_plate":"AAAAAAA","license_plate_state":"CA","make":"Audi","model":"A4","year":2016}
color
string 
必需
The vehicle's color
image_url
string 
必需
The vehicle's image url
license_plate
string 
必需
The vehicle's license plate
license_plate_state
string 
必需
The vehicle's license plate state
make
string 
必需
The vehicle's maker
model
string 
必需
The vehicle's model
year
integer <int32>
必需
The vehicle's model year
🟠403禁止访问
🟠404记录不存在

【Lyft】API开发者 微信交流群

用微信扫右侧二维码,加入【Lyft】API开发者 交流群,互助沟通

扫码加入交流群
上一页
Request a Lyft
下一页
Cancel a ongoing requested ride
Built with