@datafire/lyft
Client library for LyftInstallation and Usage
npm install --save @datafire/lyft
let lyft = require('@datafire/lyft').create({
access_token: "",
refresh_token: "",
client_id: "",
client_secret: "",
redirect_uri: ""
});
.then(data => {
console.log(data);
});
Description
Drive your app to success with Lyft's APIActions
oauthCallback
Exchange the code passed to your redirect URI for an accesstokenlyft.oauthCallback({
"code": ""
}, context)
Input
- input
object
string
Output
- output
object
string
refreshtoken string
tokentype string
scope string
expiration string
oauthRefresh
Exchange a refreshtoken for an accesstokenlyft.oauthRefresh(null, context)
Input
This action has no parametersOutput
- output
object
string
refreshtoken string
tokentype string
scope string
expiration string
GetCost
Estimate the cost of taking a Lyft between two points.lyft.GetCost({
"start_lat": 0,
"start_lng": 0
}, context)
Input
- input
object
string
(values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv): ID of a ride type
startlat required number
: Latitude of the starting location
startlng required number
: Longitude of the starting location
endlat number
: Latitude of the ending location
endlng number
: Longitude of the ending locationOutput
- output
object
array
* items [CostEstimate](#costestimate)
GetDrivers
The drivers endpoint returns a list of nearby drivers' lat and lng at a given location.lyft.GetDrivers({
"lat": 0,
"lng": 0
}, context)
Input
- input
object
number
: Latitude of a location
lng required number
: Longitude of a locationOutput
- output
object
array
* items [NearbyDriversByRideType](#nearbydriversbyridetype)
GetETA
The ETA endpoint lets you know how quickly a Lyft driver can come get youlyft.GetETA({
"lat": 0,
"lng": 0
}, context)
Input
- input
object
number
: Latitude of a location
lng required number
: Longitude of a location
destinationlat number
: Latitude of destination location
destinationlng number
: Longitude of destination location
ridetype string
(values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv): ID of a ride typeOutput
- output
object
array
* items [Eta](#eta)
GetProfile
The v1 of this endpoint returns the user's ID, v2 will return more general info about the user. We require authentication for this endpoint, so we extract the user ID from the access token.lyft.GetProfile(null, context)
Input
This action has no parametersOutput
- output Profile
GetRides
Get a list of past & current rides for this passenger.lyft.GetRides({
"start_time": ""
}, context)
Input
- input
object
string
: Restrict to rides starting after this point in time. The earliest supported date is 2015-01-01T00:00:00+00:00
endtime string
: Restrict to rides starting before this point in time. The earliest supported date is 2015-01-01T00:00:00+00:00
limit integer
: The maximum number of rides to return. The default limit is 10 if not specified. The maximum allowed value is 50, an integer greater that 50 will return at most 50 results.Output
- output
object
array
* items [RideDetail](#ridedetail)
NewRide
Request a Lyft come pick you up at the given location.lyft.NewRide({
"request": {
"ride_type": "",
"origin": {}
}
}, context)
Input
- input
object
Output
- output RideRequest
GetRide
Get the status of a ride along with information about the driver, vehicle and price of a given ride IDlyft.GetRide({
"id": ""
}, context)
Input
- input
object
string
: The ID of the rideOutput
- output RideDetail
CancelRide
Cancel a ongoing ride which was requested earlier by providing the ride id.lyft.CancelRide({
"id": ""
}, context)
Input
- input
object
string
: The ID of the ride
request CancellationRequestOutput
Output schema unknownSetRideDestination
Add or update the ride's destination. Note that the ride must still be active (not droppedOff or canceled), and that destinations on Lyft Line rides can not be changed.lyft.SetRideDestination({
"id": "",
"request": {}
}, context)
Input
- input
object
string
: The ID of the ride
request required LocationOutput
- output Location
SetRideRating
Add the passenger's 1 to 5 star rating of the ride, optional written feedback, and optional tip amount in minor units and currency. The ride must already be dropped off, and ratings must be given within 24 hours of drop off. For purposes of display, 5 is considered the default rating. When this endpoint is successfully called, payment processing will begin.lyft.SetRideRating({
"id": "",
"request": null
}, context)
Input
- input
object
string
: The ID of the ride
request required RatingRequestOutput
Output schema unknownGetRideReceipt
Get the receipt information of a processed ride by providing the ride id. Receipts will only be available to view once the payment has been processed. In the case of canceled ride, cancellation penalty is included if applicable.lyft.GetRideReceipt({
"id": ""
}, context)
Input
- input
object
string
: The ID of the rideOutput
- output RideReceipt
GetRideTypes
The ride types endpoint returns information about what kinds of Lyft rides you can request at a given location.lyft.GetRideTypes({
"lat": 0,
"lng": 0
}, context)
Input
- input
object
number
: Latitude of a location
lng required number
: Longitude of a location
ridetype string
(values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv): ID of a ride typeOutput
- output
object
array
* items [RideType](#ridetype)
SetPrimeTime
Preset a Prime Time percentage in the region surrounding the specified location. This Prime Time percentage will be applied when requesting cost, or when requesting a ride in sandbox mode.lyft.SetPrimeTime({
"request": null
}, context)
Input
- input
object
Output
Output schema unknownSetRideStatus
Propagate a sandbox-ride through various ride statuslyft.SetRideStatus({
"id": "",
"request": null
}, context)
Input
- input
object
string
: The ID of the ride
request required SandboxRideStatusOutput
- output SandboxRideUpdate
SetRideTypes
The sandbox-ridetypes endpoint allows you to preset the ridetypes in the region surrounding the specified latitude and longitude to allow testing different scenarioslyft.SetRideTypes({
"request": null
}, context)
Input
- input
object
Output
- output SandboxRideType
SetRideTypeAvailability
Set driver availability for the provided ridetype in the city/region surrounding the specified locationlyft.SetRideTypeAvailability({
"ride_type": "",
"request": null
}, context)
Input
- input
object
string
(values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv)
request required SandboxDriverAvailabilityOutput
Output schema unknownDefinitions
ApiError
- ApiError
object
: Details about why a request failed, such as missing or invalid parameters
string
: A "slug" that serves as the error code (eg. "badparameter")
errordescription string
: A user-friendly description of the error (appropriate to show to an end-user)
errordetail array
* items [ErrorDetail](#errordetail)
CancellationCost
- CancellationCost
object
integer
: Total price of the ride
currency required string
: The ISO 4217 currency code for the amount (e.g. USD)
description required string
: The description for the cost
token string
: Token used to confirm the fee when cancelling a request
tokenduration integer
: How long, in seconds, before the token expiresCancellationCostError
- CancellationCostError
object
integer
: Total price of the ride
currency required string
: The ISO 4217 currency code for the amount (e.g. USD)
description required string
: The description for the cost
token string
: Token used to confirm the fee when cancelling a request
tokenduration integer
: How long, in seconds, before the token expires
error string
: A "slug" that serves as the error code (eg. "badparameter")
errordescription string
: A user-friendly description of the error (appropriate to show to an end-user)
errordetail array
* items [ErrorDetail](#errordetail)
CancellationRequest
- CancellationRequest
object
string
: Token affirming the user accepts the cancellation fee. Required if a cancellation fee is in effect.Charge
- Charge
object
integer
: The line item amount
currency required string
: The currency for the amount
paymentmethod required string
: The payment method display name.Cost
- Cost
object
integer
: Total price of the ride
currency required string
: The ISO 4217 currency code for the amount (e.g. USD)
description required string
: The description for the costCostEstimate
- CostEstimate
object
: A non-guaranteed estimate of price
string
: A token that confirms the user has accepted current Prime Time and/or fixed price charges. See 'Request a Lyft' for more details
currency string
: The ISO 4217 currency code for the amount (e.g. 'USD')
displayname string
: A human readable description of the ride type
estimatedcostcentsmax integer
: Estimated upper bound for trip cost, in minor units (cents). Estimates are not guaranteed, and only provide a reasonable range based on current conditions.
estimatedcostcentsmin integer
: Estimated lower bound for trip cost, in minor units (cents). Estimates are not guaranteed, and only provide a reasonable range based on current conditions.
estimateddistancemiles number
: Estimated distance for this trip
estimateddurationseconds integer
: Estimated time to get from the start location to the end.
isvalidestimate boolean
: The validity of the cost estimate returned
primetimeconfirmationtoken string
: This token is needed when requesting rides. (Deprecated)
primetimepercentage string
: Current Prime Time Percentage. Prime Time adds a percentage to ride costs, prior to other applicable fees. When ride requests greatly outnumber available drivers, our system will automatically turn on Prime Time.
ridetype RideTypeEnumCurrentRideLocation
- CurrentRideLocation
object
number
: The latitude component of a location
lng required number
: The longitude component of a location
bearing number
: Bearing of the driver's car in degreesDriverDetail
- DriverDetail
object
string
: The driver's first name
imageurl required string
: The driver's image url
phonenumber required string
: The driver's contact phone number. Must be E.164 formatted.
rating required string
: The driver's rating based in 0-5 scale
userid required string
: The driver's idErrorDetail
- ErrorDetail
object
: An object with a single key-value pair, where the key is the name of the invalid parameter, and the value is a description of the error.
string
: description of the errorEta
- Eta
object
: Estimated Time of Arrival
string
: A human readable description of the ride type
etaseconds integer
: Estimated seconds for a driver to arrive
etasecondsmax integer
: Estimated upper bound of seconds for a driver to arrive
isvalidestimate boolean
: The validity of the ETA estimate returned
ridetype RideTypeEnumLatLng
- LatLng
object
number
: The latitude component of a location
lng required number
: The longitude component of a locationLineItem
- LineItem
object
integer
: The line item amount
currency required string
: The currency for the amount
type required string
: The line item display name for a charge itemLocation
- Location
object
number
: The latitude component of a location
lng required number
: The longitude component of a location
address string
: A human readable address at/near the given locationNearbyDriver
- NearbyDriver
object
array
: the lastest recorded driver locations up to 5 sorted in chronological order.* items [LatLng](#latlng)
NearbyDriversByRideType
- NearbyDriversByRideType
object
array
: list of nearby drivers group by ride type sorted by eta* items [NearbyDriver](#nearbydriver)
ridetype string
: driver's ride type. if driver is eligable for several ride types, he will be duplicated.PassengerDetail
- PassengerDetail
object
string
: The passenger's first name
imageurl required string
: The passenger's profile image
rating required string
: The passenger's rating
lastname string
: The passenger's last name
userid string
: The passenger's lyft user idPickupDropoffLocation
- PickupDropoffLocation
object
number
: The latitude component of a location
lng required number
: The longitude component of a location
address string
: A human readable address at/near the given location
time string
: Server time when the location object is createdPricingDetails
- PricingDetails
object
integer
: The base charge of the trip
cancelpenaltyamount integer
: The charge amount if cancel penalty is involved
costminimum integer
: The minimum charge for the trip
costpermile integer
: The cost per mile
costperminute integer
: The cost per minute
currency string
: The ISO 4217 currency code for the amount (e.g. USD)
trustandservice integer
: Service feeProfile
- Profile
object
: Represents the general information about a user.
string
: The first name of this user
hastakenaride required boolean
: Indicates whether this user has taken at least one Lyft ride
id required string
: The unique ID of this user
lastname required string
: The last name of this userRatingRequest
- RatingRequest
object
: Rating and optional feedback and tip
string
: The passenger's written feedback about this ride
rating required integer
: The passenger's rating of this ride from 1 to 5
tip object
: Tip amount in minor units and tip currency* amount `integer`: A tip for the driver in cents. To be charged to the user's default charge account.
* currency `string`: The currency in which you want to tip. e.g. USD
Ride
- Ride
object
: Represents a requested, ongoing, or finished Lyft ride
string
: A token that confirms the user has accepted current Prime Time and/or fixed price charges
destination object
: The requested location for passenger drop off* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
origin required object
: The requested location for passenger pickup* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
primetimeconfirmationtoken string
: A token that confirms the user has accepted current primetime charges (Deprecated)
ridetype required RideTypeEnumRideDetail
- RideDetail
object
: Detail information about a ride
string
: Hex color code of the driver AMP device.
cancancel array
* items `string` (values: driver, passenger, dispatcher): The array of actors who may cancel the ride at this point
canceledby string
: The role of user who canceled the ride (if applicable)
cancellationprice object
: The cost of cancellation if there would be a penalty* amount **required** `integer`: Total price of the ride
* currency **required** `string`: The ISO 4217 currency code for the amount (e.g. USD)
* description **required** `string`: The description for the cost
* token `string`: Token used to confirm the fee when cancelling a request
* token_duration `integer`: How long, in seconds, before the token expires
destination object
: The requested location for passenger drop off* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
* eta_seconds `integer`: Estimated seconds for a driver to pickup or reach destination based on ride status
distancemiles number
: The distance, in miles, that this ride traveled. This field is only present after drop-off
driver DriverDetail
dropoff object
: The actual location of passenger drop off* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
* time `string`: Server time when the location object is created
durationseconds integer
: 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
generatedat string
: The request timestamp in date and time
lineitems array
: The break down of cost* items [LineItem](#lineitem)
location object
: The current location info of the ride* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* bearing `number`: Bearing of the driver's car in degrees
origin object
: The requested location for passenger pickup* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
* eta_seconds `integer`: Estimated seconds for a driver to pickup or reach destination based on ride status
passenger PassengerDetail
pickup object
: The actual location of passenger pickup* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
* time `string`: Server time when the location object is created
price object
: The total price for the current ride* amount **required** `integer`: Total price of the ride
* currency **required** `string`: The ISO 4217 currency code for the amount (e.g. USD)
* description **required** `string`: The description for the cost
pricingdetailsurl string
: The web view showing the pricing structure for the geographic area where the ride was taken
primetimepercentage string
: The Prime Time percentage applied to the base price
rating integer
: The rating the user left for this ride, from 1 to 5
requestedat string
: The ride requested timestamp in date and time
rideid string
: The unique ID of this ride
rideprofile object
: Indicates whether the ride was requested from the business profile or personal profile of the user.
ridetype RideTypeEnumWithOther
routeurl 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 RideStatusEnum
vehicle VehicleDetailRideLocation
- RideLocation
object
number
: The latitude component of a location
lng required number
: The longitude component of a location
address string
: A human readable address at/near the given location
etaseconds integer
: Estimated seconds for a driver to pickup or reach destination based on ride statusRideProfileEnum
- RideProfileEnum
string
(values: personal, business): The payment profile which the user has picked for the ride
RideReceipt
- RideReceipt
object
: Receipt information of a processed ride.
array
: The break down of charge method* items [Charge](#charge)
lineitems array
: The break down of line items* items [LineItem](#lineitem)
price object
: The total price for the current ride* amount **required** `integer`: Total price of the ride
* currency **required** `string`: The ISO 4217 currency code for the amount (e.g. USD)
* description **required** `string`: The description for the cost
requestedat string
: The ride requested timestamp in date and time
rideid string
: The unique ID of this ride
rideprofile object
: Indicates whether the ride was requested from the business profile or personal profile of the user.RideRequest
- RideRequest
object
: Minimal set of ride details
object
: The requested location for passenger drop off* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
origin object
: The requested location for passenger pickup* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
passenger PassengerDetail
rideid string
: The ID of the requested ride
status RideStatusEnumRideRequestError
- RideRequestError
object
: Details about why a request failed, such as missing or invalid parameters
string
: A token that confirms the user has accepted current Prime Time and/or fixed price charges
error required string
: A "slug" that serves as the error code (eg. "badparameter")
errordescription string
: A user-friendly description of the error (appropriate to show to an end-user)
errordetail array
* items [ErrorDetail](#errordetail)
erroruri string
: When a user must go through another flow before requesting a ride, this URI specifies which flow to use (e.g. an account challenge flow in a web view)
primetimeconfirmationtoken string
: A token that confirms the user has accepted current Prime Time charges (Deprecated)
primetimemultiplier number
: Current Prime Time multiplier (eg. if primetimepercentage is 100%, primetimemultiplier will be 2.0)
primetimepercentage string
: Current Prime Time percentage
tokenduration string
: Validity of the token in secondsRideStatusEnum
- RideStatusEnum
string
(values: pending, accepted, arrived, pickedUp, droppedOff, canceled, scheduled, unknown): The status of the ride
RideType
- RideType
object
string
: A human readable description of the ride type
imageurl string
: The URL of an image representing this ride type
pricingdetails PricingDetails
ridetype RideTypeEnum
scheduledpricingdetails PricingDetails
seats integer
: The maximum number of seats available for rides requested with this ride typeRideTypeEnum
- RideTypeEnum
string
(values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv): The ID of the ride type
RideTypeEnumWithOther
- RideTypeEnumWithOther
string
(values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv, other): The ID of the ride type
SandboxDriverAvailability
- SandboxDriverAvailability
object
boolean
: The availability of driver in a region
lat required number
: The latitude component of a location
lng required number
: The longitude component of a locationSandboxPrimetime
- SandboxPrimetime
object
number
: The latitude component of a location
lng required number
: The longitude component of a location
primetimepercentage required string
: The Prime Time to be applied as a string, e.g., '25%'SandboxRideStatus
- SandboxRideStatus
object
SandboxRideType
- SandboxRideType
object
number
: The latitude component of a location
lng required number
: The longitude component of a location
ridetypes required array
* items [RideTypeEnum](#ridetypeenum)
SandboxRideUpdate
- SandboxRideUpdate
object
: Response when a sandbox ride is propagated through ride status
string
: The ID of the ride
status RideStatusEnumTip
- Tip
object
integer
: A tip for the driver in cents. To be charged to the user's default charge account.
currency string
: The currency in which you want to tip. e.g. USDTipParams
- TipParams
object
integer
: A tip for the driver in cents. To be charged to the user's default charge account.
currency string
: The currency in which you want to tip. e.g. USDUserDetail
- UserDetail
object
string
: The passenger's first name
imageurl required string
: The passenger's profile image
rating required string
: The passenger's ratingVehicleDetail
- VehicleDetail
object
string
: The vehicle's color
imageurl required string
: The vehicle's image url
licenseplate required string
: The vehicle's license plate
licenseplatestate required string
: The vehicle's license plate state
make required string
: The vehicle's maker
model required string
: The vehicle's model
year required integer
: The vehicle's model year