GET/v1/transfers/reservations/:reservationId/vehicle/stream

Stream transfer driver and vehicle

Receive driver and vehicle assignment updates over Server-Sent Events.

Share

Receive driver and vehicle assignment updates over Server-Sent Events.

Authentication and headers

HeaderDescription
AuthorizationBearer <secret_key>. Keep the secret on the server and never write it to client logs.
X-Travelandz-Id<public_key>:<profile_code>, where the persisted profile code has the form dp_<12 alphanumeric>.
LANGPreferred locale header. Accept-Language is also supported.
Accepttext/event-stream for progressive stream responses.

Response headers

http
http
Content-Type: text/event-stream
Cache-Control: no-cache, no-transform
Connection: keep-alive

Request

This endpoint takes no body and accepts the same parameters as the snapshot endpoint. Send Accept: text/event-stream.

Request Params Schema

reservationId
stringYes
Reservation identifier returned when the booking was created.

Request Query Params Schema

currency
enum
EURUSDINRCHFJPYGBPAUDCADCNYSGDNZDMXN
No
Lowercase values are accepted and normalized. Defaults to USD on a new search and is inherited afterwards.
language
enum
en-USes-ESde-DEfr-FRpt-BRzh-CNit-IT
No
Legacy field. Prefer the LANG or Accept-Language header.

Success response

Each update event carries the same payload as the snapshot endpoint. The stream stays open until you close it.

Response Body Schema

status
stringNo
Assignment state, for example active.
driver
objectYes
driverid
stringNo
driverexternalId
stringNo
drivername
stringNo
driverphone
stringNo
driverlicenseNumber
stringNo
driverimageUrl
string
Format: URL
No
vehicle
objectYes
vehicleid
stringNo
vehicleexternalId
stringNo
vehicletype
stringNo
vehiclemanufacturer
stringNo
vehiclemodel
stringNo
vehicleplate
stringNo
vehiclecolor
stringNo
vehicledescription
stringNo
vehicleimageUrl
string
Format: URL
No

Stream events

EventDescription
updateA refreshed snapshot. Replace what you are showing with the payload of the latest event.
errorA refresh could not be completed. Carries code and message. The connection is not closed automatically; the next refresh may succeed.

Stream example

text
text
event: update
data: {"status":"active","driver":{"id":"123","externalId":"DRV456","name":"John Doe","phone":"+1234567890","licenseNumber":"AB123456"},"vehicle":{"id":"789","externalId":"VEH789","type":"Sedan","manufacturer":"Toyota","model":"Camry","plate":"XYZ1234","color":"Blue"}}

event: error
data: {"code":"transfer_provider_error","message":"Unable to load vehicle information"}

Errors

HTTPCodeMeaningRecommended action
400The body, query or path is invalid, or contains an unknown property.Fix the request using the message array.
400transfer_invalid_currencyThe currency is outside the supported list.Use a supported currency.
400transfer_invalid_languageThe requested language is not supported.Use one of the documented language values.
429transfer_provider_errorThe service is temporarily rate limited.Retry with exponential backoff.
502transfer_provider_errorThe request could not be completed.Do not assume success. Keep your identifiers and read the reservation when the operation could have been created.

Usage notes

Keep the connection open only while the traveller is looking at the live view, and close it explicitly afterwards. Handle both update and error events, and reconnect after a network interruption.

Validation that fails before the stream opens is returned as a normal JSON HTTP error. Once the stream is open, failures arrive as error events instead.

cURL example

bash
bash
curl --request GET \
  --url "https://api.sandbox.travelandz.com/v1/transfers/reservations/f390daff1fdf4cccb19b7abd825dc011/vehicle/stream?currency=USD" \
  -H "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
  -H "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
  -H "Accept: text/event-stream"