Receive driver and vehicle assignment updates over Server-Sent Events.
Authentication and headers
| Header | Description |
|---|---|
Authorization | Bearer <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>. |
LANG | Preferred locale header. Accept-Language is also supported. |
Accept | text/event-stream for progressive stream responses. |
Response headers
http
Content-Type: text/event-stream
Cache-Control: no-cache, no-transform
Connection: keep-aliveRequest
This endpoint takes no body and accepts the same parameters as the snapshot endpoint. Send Accept: text/event-stream.
Request Params Schema
reservationIdReservation identifier returned when the booking was created.
Request Query Params Schema
currencyLowercase values are accepted and normalized. Defaults to
USD on a new search and is inherited afterwards.languageLegacy 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
statusAssignment state, for example
active.driverdriveriddriverexternalIddrivernamedriverphonedriverlicenseNumberdriverimageUrlvehiclevehicleidvehicleexternalIdvehicletypevehiclemanufacturervehiclemodelvehicleplatevehiclecolorvehicledescriptionvehicleimageUrlStream events
| Event | Description |
|---|---|
update | A refreshed snapshot. Replace what you are showing with the payload of the latest event. |
error | A refresh could not be completed. Carries code and message. The connection is not closed automatically; the next refresh may succeed. |
Stream example
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
| HTTP | Code | Meaning | Recommended action |
|---|---|---|---|
400 | The body, query or path is invalid, or contains an unknown property. | Fix the request using the message array. | |
400 | transfer_invalid_currency | The currency is outside the supported list. | Use a supported currency. |
400 | transfer_invalid_language | The requested language is not supported. | Use one of the documented language values. |
429 | transfer_provider_error | The service is temporarily rate limited. | Retry with exponential backoff. |
502 | transfer_provider_error | The 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
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"