Create a Flexible Ride
Changed onCreates a new Flexible Ride.
❗️ Prerequisites
Before creating a flexible ride, you should call the /estimates endpoint and use the returned product.id as product_id in this request. This should also give you an estimate on how much the journey could cost at claim time, but is not guaranteed for this use case, as the cost is set at claim time.
Flexible Ride states
After created, a Flexible Ride can end up in these states:
- pending - Initial state.
- claimed - It was claimed by a user and a journey was created for it.
- failed - A non recoverable error ocurred during the claiming process (e.g overbudget).
- cancelled - It was cancelled by the owner.
- expired - After the expiration time was reached.
Of note is that all states besides pending are final. A Flexible Ride can be modified and claimed while it's pending, but it becomes read only after it is changed to any other state.
📘 Expiration
Take into account that if you set a claimable_since time, the calculation of the expiration time for the Flexible Ride will take it into consideration (expires_at will be set N seconds after claimable_since)
⚠️ Sandbox Testing
In the sandbox environment, pickup locations must be within central Madrid (approximately 40.4361°, -3.7014°). See Sandbox Environment for details.
Request
- Base URLhttps://cabify-sandbox.com
- URLhttps://cabify-sandbox.com/api/v4/flexible_rides
- AuthHTTP bearer
Request body
Example request
{
"claimable_since": "2022-08-04T19:28:18.375Z",
"expires_in_seconds": 3600,
"label_slug": "apiV4",
"max_price": {
"amount": 100,
"currency": "EUR"
},
"message": "driver message",
"product_id": "75dd566797369d1f0927102e5356ce59",
"reason": "reservation",
"requester_id": "0dfc7c0bbbd300e6f9212827106e8911",
"rider": {
"email": "riderEmail@example.com",
"locale": "ES",
"mobile": {
"mobile_cc": "34",
"mobile_num": "123456789"
},
"name": "Jhon Doe"
},
"rider_metadata": {},
"sender_name": "sender",
"stops": [
{
"addr": "Calle de la cruz",
"city": "Madrid",
"contact": {
"mobile_cc": "34",
"mobile_num": "123456789",
"name": "Jhon Doe",
"stop_action": "pickup"
},
"country": "ES",
"id": "123",
"loc": [
40.4169335,
-3.7061872
],
"name": "Work",
"num": "1428"
}
]
}Response
Success
Example response
{
"claimable_since": "2022-08-04T19:28:18.375Z",
"expires_at": "2022-08-04T19:28:18.375Z",
"id": "0dfc7c0bbbd300e6f9212827106e8911",
"inserted_at": "2022-02-17T09:30:34.831Z",
"journey_id": "96fc6f24-142b-11ed-bba7-56a6f40ef0bf",
"label_slug": "apiV4",
"max_price": {
"amount": 100,
"currency": "EUR"
},
"message": "driver message",
"product_id": "75dd566797369d1f0927102e5356ce59",
"public_url": "/fr/5ceg7v77qm8x28c9",
"reason": "reservation",
"requester_id": "0dfc7c0bbbd300e6f9212827106e8911",
"rider": {
"email": "riderEmail@example.com",
"locale": "ES",
"mobile": {
"mobile_cc": "34",
"mobile_num": "123456789"
},
"name": "Jhon Doe"
},
"rider_metadata": {},
"sender_name": "sender",
"status": "pending",
"stops": [
{
"addr": "Calle de la cruz",
"city": "Madrid",
"contact": {
"mobile_cc": "34",
"mobile_num": "123456789",
"name": "Jhon Doe",
"stop_action": "pickup"
},
"country": "ES",
"id": "123",
"loc": [
40.4169335,
-3.7061872
],
"name": "Work",
"num": "1428"
}
],
"updated_at": "2022-08-04T19:28:18.375Z"
}Changes
- info
endpoint added
- info