POST/v1/transfers/search

搜索接送服务

搜索接送报价,并获取完整 JSON 响应或渐进式流事件。

分享
POST/v1/transfers/search

API 控制台

试一试

向沙箱 API 发送真实请求并查看响应。

凭证

登录后即可从已保存的 API 密钥中选择,无需手动粘贴。

请求体

cURL 请求

cURL
bash
curl -X POST 'https://api.sandbox.travelandz.com/v1/transfers/search' \
  -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  -H 'X-Travelandz-Id: YOUR_PUBLIC_KEY:YOUR_PROFILE_CODE' \
  -H 'Content-Type: application/json' \
  -d '{"mode":"one_way","startAddress":"433 Park Ave","startCity":"New York","startZipcode":"10022","endAddress":"JFK","pickupDatetime":"2026-08-16 15:30","numPassengers":2,"currency":"USD","responseMode":"complete"}'

请填写凭证以发送请求。

响应

点击「试一试!」发送请求,响应将显示在此处。

搜索接送报价,并获取完整 JSON 响应或渐进式流事件。

认证和请求头

请求头说明
AuthorizationBearer <secret_key>。密钥只能保存在服务器端,不能写入客户端日志。
X-Travelandz-Id<public_key>:<profile_code>,持久化的 profile code 格式为 dp_<12 位字母数字>
LANG推荐的语言请求头,也支持 Accept-Language
Content-Type带 JSON body 的请求使用 application/json

请求

发送 modenumPassengers。起点和终点分别需要地址、place ID 或经纬度对。将 responseMode 设为 stream 可在报价到达时逐步接收,而不是只返回一个最终响应。round_trip 搜索还需要 returnPickupDatetimereturnFlightDatetime

请求体结构

mode
enum
one_wayround_trip
responseMode
enum
completestream
Defaults to complete.
numPassengers
number
Integer from 1 to 99.
startAddress
string
Send an address, a place ID, or a latitude/longitude pair for the origin.
startCity
string
Appended to the address to improve resolution.
startZipcode
string
Appended to the address to improve resolution.
startLat
number
Must be sent together with startLng.
startLng
number
Must be sent together with startLat.
startPlaceId
string
Alternative to an address or coordinates.
endAddress
string
Send an address, a place ID, or a latitude/longitude pair for the destination.
endCity
string
Appended to the address to improve resolution.
endZipcode
string
Appended to the address to improve resolution.
endLat
number
Must be sent together with endLng.
endLng
number
Must be sent together with endLat.
endPlaceId
string
Alternative to an address or coordinates.
pickupDatetime
string
格式: YYYY-MM-DD HH:mm
Local date and time at the origin.
flightDatetime
string
格式: YYYY-MM-DD HH:mm
flightType
enum
domesticinternational
returnPickupDatetime
string
A round_trip search requires this field or returnFlightDatetime.
returnFlightDatetime
string
A round_trip search requires this field or returnPickupDatetime.
amenities
array
amenities[]
string[]
Amenity keys to bias the search. Also accepted as a CSV string.
currency
enum
EURUSDINRCHFJPYGBPAUDCADCNYSGDNZDMXN
Lowercase values are accepted and normalized. Defaults to USD on a new search and is inherited afterwards.
campaign
string
Your own campaign context.
branch
string
Requires campaign when sent.
language
enum
en-USes-ESde-DEfr-FRpt-BRzh-CNit-IT
Legacy field. Prefer the LANG or Accept-Language header.

请求示例

完整响应

json
json
{
  "mode": "one_way",
  "startAddress": "433 Park Ave",
  "startCity": "New York",
  "startZipcode": "10022",
  "endAddress": "JFK",
  "pickupDatetime": "2026-08-16 15:30",
  "numPassengers": 2,
  "currency": "USD",
  "responseMode": "complete"
}

流式响应

json
json
{
  "mode": "one_way",
  "startAddress": "433 Park Ave, New York",
  "endAddress": "JFK",
  "pickupDatetime": "2026-08-16 15:30",
  "numPassengers": 2,
  "currency": "USD",
  "responseMode": "stream"
}

成功响应

返回 transfers[](可用于定价和预订的报价),以及包含已解析地点和结果集是否最终的 metadata。每个报价都带有不透明的 bookingToken,用于复制到 pricing。

搜索可能返回 200metadata.timedOut 为 true。这不是错误:已返回的报价有效且可预订。

响应体结构

transfers
array
transfers[]searchId
string
Send this value in pricing, booking and reservation reads.
transfers[]gdsprovider
enum
0
transfers[]resultId
string
Identifies the selected offer.
transfers[]bookingToken
string
Opaque value. Copy it into pricing and booking; never decode or modify it.
transfers[]expiresAt
string
格式: ISO 8601
The offer and its token stop being usable after this moment.
transfers[]vehicleId
string
transfers[]totalAmount
number
Indicative total for the offer in currency.
transfers[]currency
enum
EURUSDINRCHFJPYGBPAUDCADCNYSGDNZDMXN
transfers[]bookable
boolean
False when the offer cannot be booked.
transfers[]flightInfoRequired
boolean
When true, airline and flightNumber are required to book.
transfers[]extraPaxRequired
boolean
When true, extraPaxInfo is required to book.
transfers[]goodToKnowInfo
array
transfers[]goodToKnowInfo[]
string[]
Localized operational notes to show the traveller.
transfers[]supports
object
transfers[]cancellationPolicies
array
transfers[]cancellationPolicies[]notice
number
Hours of notice the policy requires.
transfers[]cancellationPolicies[]refundPercent
number
transfers[]cancellationPolicies[]refundableUntilDatetime
string
格式: ISO 8601
transfers[]cancellationPolicies[]refundAmount
number
Refundable amount in the offer currency.
transfers[]cancellationPolicies[]currency
enum
EURUSDINRCHFJPYGBPAUDCADCNYSGDNZDMXN
transfers[]steps
array
transfers[]steps[]stepType
string
Leg type, for example car.
transfers[]steps[]main
boolean
True for the primary leg of the transfer.
transfers[]steps[]description
string
transfers[]steps[]departureDatetime
string
格式: ISO 8601
transfers[]steps[]durationMinutes
number
transfers[]steps[]durationSeconds
number
transfers[]steps[]distanceMeters
number
transfers[]steps[]distanceMiles
number
transfers[]steps[]lineName
string
Present for scheduled line transport.
transfers[]steps[]lineColor
string
transfers[]steps[]provider
object
transfers[]steps[]providername
string
transfers[]steps[]providerrating
number
transfers[]steps[]vehicle
object
transfers[]steps[]vehicletype
string
Vehicle name, for example Shared Ride Van.
transfers[]steps[]vehiclecategory
string
Vehicle grouping, for example Shared or Private.
transfers[]steps[]vehiclemaxBags
number
transfers[]steps[]vehiclemaxPassengers
number
transfers[]steps[]vehiclenumVehicles
number
transfers[]steps[]vehicleimageUrl
string
格式: URL
transfers[]steps[]waitTime
object
transfers[]steps[]waitTimeincluded
boolean
transfers[]steps[]waitTimeminutesIncluded
number
transfers[]steps[]waitTimeextraWaitTimeChargeable
boolean
transfers[]steps[]amenities
array
transfers[]steps[]amenities[]key
string
Value to send in selectedAmenities.
transfers[]steps[]amenities[]name
string
Localized name.
transfers[]steps[]amenities[]description
string
transfers[]steps[]amenities[]imageUrl
string
格式: URL
transfers[]steps[]amenities[]pngImageUrl
string
格式: URL
transfers[]steps[]amenities[]inputType
enum
booleannumeric
transfers[]steps[]amenities[]included
boolean
True when the amenity is already part of the offer.
transfers[]steps[]amenities[]selectable
boolean
True when the amenity can be added to this offer.
transfers[]steps[]amenities[]selected
boolean
True when the amenity is part of the priced selection.
transfers[]steps[]startLocation
object
transfers[]steps[]startLocationformattedAddress
string
transfers[]steps[]startLocationfullAddress
string
transfers[]steps[]startLocationiataCode
string
Present for airport locations.
transfers[]steps[]startLocationicaoCode
string
transfers[]steps[]startLocationplaceId
string
Reusable place identifier; send it back to skip geocoding.
transfers[]steps[]startLocationlatitude
number
transfers[]steps[]startLocationlongitude
number
transfers[]steps[]startLocationtimezone
string
IANA timezone of the location.
transfers[]steps[]endLocation
object
transfers[]steps[]endLocationformattedAddress
string
transfers[]steps[]endLocationfullAddress
string
transfers[]steps[]endLocationiataCode
string
Present for airport locations.
transfers[]steps[]endLocationicaoCode
string
transfers[]steps[]endLocationplaceId
string
Reusable place identifier; send it back to skip geocoding.
transfers[]steps[]endLocationlatitude
number
transfers[]steps[]endLocationlongitude
number
transfers[]steps[]endLocationtimezone
string
IANA timezone of the location.
transfers[]ticketTypes
array
transfers[]ticketTypes[]id
string
Send this value in ticketTypes[].id when booking.
transfers[]ticketTypes[]name
string
transfers[]ticketTypes[]departureDatetime
string
格式: ISO 8601
transfers[]ticketTypes[]arrivalDatetime
string
格式: ISO 8601
transfers[]alternativeTimes
array
transfers[]alternativeTimes[]departureDatetime
string
格式: ISO 8601
transfers[]alternativeTimes[]arrivalDatetime
string
格式: ISO 8601
metadata
object
metadatacompleted
boolean
True when the result set is final.
metadatatimedOut
boolean
True when results were returned before every source finished. The offers already present are valid.
metadataproviderResults
array
metadataproviderResults[]gdsprovider
enum
0
metadataproviderResults[]searchId
string
metadataproviderResults[]completed
boolean
True when this source has no further offers to return.
metadataproviderResults[]timedOut
boolean
metadataproviderResults[]moreComing
boolean
True when more offers may still arrive for this searchId.
metadatastartLocation
object
metadatastartLocationformattedAddress
string
metadatastartLocationfullAddress
string
metadatastartLocationiataCode
string
Present for airport locations.
metadatastartLocationicaoCode
string
metadatastartLocationplaceId
string
Reusable place identifier; send it back to skip geocoding.
metadatastartLocationlatitude
number
metadatastartLocationlongitude
number
metadatastartLocationtimezone
string
IANA timezone of the location.
metadataendLocation
object
metadataendLocationformattedAddress
string
metadataendLocationfullAddress
string
metadataendLocationiataCode
string
Present for airport locations.
metadataendLocationicaoCode
string
metadataendLocationplaceId
string
Reusable place identifier; send it back to skip geocoding.
metadataendLocationlatitude
number
metadataendLocationlongitude
number
metadataendLocationtimezone
string
IANA timezone of the location.
metadatapickupDatetime
string
格式: ISO 8601
Resolved pickup moment in the origin timezone.
metadatanumPassengers
number

响应体结构 (responseMode=stream)

transfers
array
transfers[]searchId
string
Send this value in pricing, booking and reservation reads.
transfers[]gdsprovider
enum
0
transfers[]resultId
string
Identifies the selected offer.
transfers[]bookingToken
string
Opaque value. Copy it into pricing and booking; never decode or modify it.
transfers[]expiresAt
string
格式: ISO 8601
The offer and its token stop being usable after this moment.
transfers[]vehicleId
string
transfers[]totalAmount
number
Indicative total for the offer in currency.
transfers[]currency
enum
EURUSDINRCHFJPYGBPAUDCADCNYSGDNZDMXN
transfers[]bookable
boolean
False when the offer cannot be booked.
transfers[]flightInfoRequired
boolean
When true, airline and flightNumber are required to book.
transfers[]extraPaxRequired
boolean
When true, extraPaxInfo is required to book.
transfers[]goodToKnowInfo
array
transfers[]goodToKnowInfo[]
string[]
Localized operational notes to show the traveller.
transfers[]supports
object
transfers[]cancellationPolicies
array
transfers[]cancellationPolicies[]notice
number
Hours of notice the policy requires.
transfers[]cancellationPolicies[]refundPercent
number
transfers[]cancellationPolicies[]refundableUntilDatetime
string
格式: ISO 8601
transfers[]cancellationPolicies[]refundAmount
number
Refundable amount in the offer currency.
transfers[]cancellationPolicies[]currency
enum
EURUSDINRCHFJPYGBPAUDCADCNYSGDNZDMXN
transfers[]steps
array
transfers[]steps[]stepType
string
Leg type, for example car.
transfers[]steps[]main
boolean
True for the primary leg of the transfer.
transfers[]steps[]description
string
transfers[]steps[]departureDatetime
string
格式: ISO 8601
transfers[]steps[]durationMinutes
number
transfers[]steps[]durationSeconds
number
transfers[]steps[]distanceMeters
number
transfers[]steps[]distanceMiles
number
transfers[]steps[]lineName
string
Present for scheduled line transport.
transfers[]steps[]lineColor
string
transfers[]steps[]provider
object
transfers[]steps[]providername
string
transfers[]steps[]providerrating
number
transfers[]steps[]vehicle
object
transfers[]steps[]vehicletype
string
Vehicle name, for example Shared Ride Van.
transfers[]steps[]vehiclecategory
string
Vehicle grouping, for example Shared or Private.
transfers[]steps[]vehiclemaxBags
number
transfers[]steps[]vehiclemaxPassengers
number
transfers[]steps[]vehiclenumVehicles
number
transfers[]steps[]vehicleimageUrl
string
格式: URL
transfers[]steps[]waitTime
object
transfers[]steps[]waitTimeincluded
boolean
transfers[]steps[]waitTimeminutesIncluded
number
transfers[]steps[]waitTimeextraWaitTimeChargeable
boolean
transfers[]steps[]amenities
array
transfers[]steps[]amenities[]key
string
Value to send in selectedAmenities.
transfers[]steps[]amenities[]name
string
Localized name.
transfers[]steps[]amenities[]description
string
transfers[]steps[]amenities[]imageUrl
string
格式: URL
transfers[]steps[]amenities[]pngImageUrl
string
格式: URL
transfers[]steps[]amenities[]inputType
enum
booleannumeric
transfers[]steps[]amenities[]included
boolean
True when the amenity is already part of the offer.
transfers[]steps[]amenities[]selectable
boolean
True when the amenity can be added to this offer.
transfers[]steps[]amenities[]selected
boolean
True when the amenity is part of the priced selection.
transfers[]steps[]startLocation
object
transfers[]steps[]startLocationformattedAddress
string
transfers[]steps[]startLocationfullAddress
string
transfers[]steps[]startLocationiataCode
string
Present for airport locations.
transfers[]steps[]startLocationicaoCode
string
transfers[]steps[]startLocationplaceId
string
Reusable place identifier; send it back to skip geocoding.
transfers[]steps[]startLocationlatitude
number
transfers[]steps[]startLocationlongitude
number
transfers[]steps[]startLocationtimezone
string
IANA timezone of the location.
transfers[]steps[]endLocation
object
transfers[]steps[]endLocationformattedAddress
string
transfers[]steps[]endLocationfullAddress
string
transfers[]steps[]endLocationiataCode
string
Present for airport locations.
transfers[]steps[]endLocationicaoCode
string
transfers[]steps[]endLocationplaceId
string
Reusable place identifier; send it back to skip geocoding.
transfers[]steps[]endLocationlatitude
number
transfers[]steps[]endLocationlongitude
number
transfers[]steps[]endLocationtimezone
string
IANA timezone of the location.
transfers[]ticketTypes
array
transfers[]ticketTypes[]id
string
Send this value in ticketTypes[].id when booking.
transfers[]ticketTypes[]name
string
transfers[]ticketTypes[]departureDatetime
string
格式: ISO 8601
transfers[]ticketTypes[]arrivalDatetime
string
格式: ISO 8601
transfers[]alternativeTimes
array
transfers[]alternativeTimes[]departureDatetime
string
格式: ISO 8601
transfers[]alternativeTimes[]arrivalDatetime
string
格式: ISO 8601
metadata
object
metadatacompleted
boolean
True when the result set is final.
metadatatimedOut
boolean
True when results were returned before every source finished. The offers already present are valid.
metadataproviderResults
array
metadataproviderResults[]gdsprovider
enum
0
metadataproviderResults[]searchId
string
metadataproviderResults[]completed
boolean
True when this source has no further offers to return.
metadataproviderResults[]timedOut
boolean
metadataproviderResults[]moreComing
boolean
True when more offers may still arrive for this searchId.
metadatastartLocation
object
metadatastartLocationformattedAddress
string
metadatastartLocationfullAddress
string
metadatastartLocationiataCode
string
Present for airport locations.
metadatastartLocationicaoCode
string
metadatastartLocationplaceId
string
Reusable place identifier; send it back to skip geocoding.
metadatastartLocationlatitude
number
metadatastartLocationlongitude
number
metadatastartLocationtimezone
string
IANA timezone of the location.
metadataendLocation
object
metadataendLocationformattedAddress
string
metadataendLocationfullAddress
string
metadataendLocationiataCode
string
Present for airport locations.
metadataendLocationicaoCode
string
metadataendLocationplaceId
string
Reusable place identifier; send it back to skip geocoding.
metadataendLocationlatitude
number
metadataendLocationlongitude
number
metadataendLocationtimezone
string
IANA timezone of the location.
metadatapickupDatetime
string
格式: ISO 8601
Resolved pickup moment in the origin timezone.
metadatanumPassengers
number
error
string
Present on an error event.
errorCode
string
Present on an error event.

响应示例

json
json
{
  "transfers": [
    {
      "searchId": "5c8563a5d31d4c33a3a1eafbbfe59c4b",
      "gdsprovider": 0,
      "resultId": "763475651c06f5ac31ea587084dc0629",
      "bookingToken": "opaque_offer_token_generated_by_travelandz",
      "expiresAt": "2026-08-05T21:20:00.000Z",
      "totalAmount": 49.84,
      "currency": "USD",
      "bookable": true,
      "flightInfoRequired": true,
      "extraPaxRequired": false,
      "goodToKnowInfo": [],
      "cancellationPolicies": [
        {
          "notice": 48,
          "refundPercent": 100,
          "refundableUntilDatetime": "2026-08-14T14:40:00-04:00",
          "refundAmount": 49.84,
          "currency": "USD"
        }
      ],
      "supports": {},
      "steps": [
        {
          "stepType": "car",
          "main": true,
          "departureDatetime": "2026-08-16T14:40:00-04:00",
          "durationMinutes": 26,
          "distanceMeters": 25749,
          "provider": {
            "name": "GO Airlink NYC",
            "rating": 5
          },
          "vehicle": {
            "type": "Shared Ride Van",
            "category": "Shared",
            "maxBags": 4,
            "maxPassengers": 11,
            "numVehicles": 1
          },
          "waitTime": {
            "included": false,
            "minutesIncluded": 0,
            "extraWaitTimeChargeable": false
          },
          "amenities": []
        }
      ],
      "ticketTypes": [],
      "alternativeTimes": [
        {
          "departureDatetime": "2026-08-16T14:40:00-04:00",
          "arrivalDatetime": "2026-08-16T15:06:10-04:00"
        },
        {
          "departureDatetime": "2026-08-16T13:40:00-04:00",
          "arrivalDatetime": "2026-08-16T14:06:10-04:00"
        }
      ]
    }
  ],
  "metadata": {
    "completed": true,
    "timedOut": false,
    "providerResults": [
      {
        "gdsprovider": 0,
        "searchId": "5c8563a5d31d4c33a3a1eafbbfe59c4b",
        "completed": true,
        "timedOut": false,
        "moreComing": false
      }
    ],
    "startLocation": {
      "formattedAddress": "433 Park Ave, New York, NY 10022, USA",
      "fullAddress": "433 Park Ave, New York",
      "placeId": "EiU0MzMgUGFyayBBdmUsIE5ldyBZb3JrLCBOWSAxMDAyMiwgVVNB",
      "latitude": 40.7607634,
      "longitude": -73.971212,
      "timezone": "America/New_York"
    },
    "endLocation": {
      "formattedAddress": "John F Kennedy International Airport",
      "fullAddress": "John F Kennedy International Airport",
      "iataCode": "JFK",
      "icaoCode": "KJFK",
      "latitude": 40.639751,
      "longitude": -73.778926,
      "timezone": "America/New_York"
    },
    "pickupDatetime": "2026-08-16T15:30:00-04:00",
    "numPassengers": 2
  }
}

流事件

事件说明
provider_search_created搜索已被接受。若已有报价,会随事件一并返回。
provider_poll_result更新后的报价集合。请用最新事件的负载替换当前展示的内容。
provider_done某个来源已结束提供报价。
error流无法继续。包含 errorerrorCode
done最终合并结果。收到后请关闭连接。

流示例

text
text
event: provider_search_created
data: {"transfers":[],"metadata":{"completed":false,"timedOut":false,"providerResults":[{"gdsprovider":0,"searchId":"5c8563a5d31d4c33a3a1eafbbfe59c4b","moreComing":true}]}}

event: provider_poll_result
data: {"transfers":[{"searchId":"5c8563a5d31d4c33a3a1eafbbfe59c4b","resultId":"763475651c06f5ac31ea587084dc0629","totalAmount":49.84,"currency":"USD"}],"metadata":{"completed":false,"timedOut":false,"providerResults":[{"gdsprovider":0,"moreComing":true}]}}

event: provider_done
data: {"transfers":[{"searchId":"5c8563a5d31d4c33a3a1eafbbfe59c4b","resultId":"763475651c06f5ac31ea587084dc0629","totalAmount":49.84,"currency":"USD"}],"metadata":{"completed":true,"timedOut":false,"providerResults":[{"gdsprovider":0,"completed":true,"moreComing":false}]}}

event: done
data: {"transfers":[{"searchId":"5c8563a5d31d4c33a3a1eafbbfe59c4b","resultId":"763475651c06f5ac31ea587084dc0629","totalAmount":49.84,"currency":"USD"}],"metadata":{"completed":true,"timedOut":false,"providerResults":[{"gdsprovider":0,"completed":true,"moreComing":false}]}}

错误

HTTP代码含义建议操作
400请求体、查询参数或路径无效,或包含未知属性。根据 message 数组修正请求。
400transfer_invalid_currency该货币不在支持列表中。使用受支持的货币。
400transfer_invalid_language请求的语言不受支持。使用文档中列出的语言值之一。
429transfer_provider_error服务暂时被限流。使用指数退避重试。
502transfer_provider_error请求无法完成。不要假定成功。保留标识符,并在该操作可能已创建时查询预订。
400transfer_location_not_found无法解析起点或终点。补充城市或邮编,或改用 place ID 或经纬度对。
503当前无法确认价格。稍后重试。不要预订,也不要向旅客收费。

使用说明

如果在流打开前所有来源都失败,请求会以普通 JSON HTTP 错误失败;如果流已开始,则以 error 事件返回失败。不再需要流连接时请显式关闭。

请持久化旅客所选报价的 searchIdresultIdbookingToken:pricing、预订和预订查询都需要它们。

cURL 示例

bash
bash
curl --request POST \
  --url "https://api.sandbox.travelandz.com/v1/transfers/search" \
  -H "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
  -H "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
  -H "Content-Type: application/json" \
  --data '{
  "mode": "one_way",
  "startAddress": "433 Park Ave",
  "startCity": "New York",
  "startZipcode": "10022",
  "endAddress": "JFK",
  "pickupDatetime": "2026-08-16 15:30",
  "numPassengers": 2,
  "currency": "USD",
  "responseMode": "complete"
}'