Authentication & signing

Open API uses request headers for the channel identity and signature. Generate a new timestamp, nonce, and signature for every request.

Request headers

Header Required Description
yapi-version Yes Version, for example 1.0.0
yapi-merchant Yes Merchant keyword assigned to the channel
yapi-timestamp Yes Current timestamp in milliseconds
yapi-nonce Yes Random string; do not reuse it for the same timestamp
yapi-sign Yes Lowercase hexadecimal MD5 signature
yapi-verify No Set to false only in development to skip signature verification; omit it or set it to true in production

Use 1.0.0 for v1 and 2.0.0 for v2 in yapi-version. yapi-merchant is the channel keyword, and secret is the private credential stored for the channel.

Signature parameters

Signature algorithm

Join the four values with + and calculate the MD5 digest:

merchant + "+" + secret + "+" + timestamp + "+" + nonce
const crypto = require('crypto')

const sign = crypto
  .createHash('md5')
  .update(`${merchant}+${secret}+${timestamp}+${nonce}`)
  .digest('hex')

Request example

curl -X POST "https://dev-yapi.ytripos.com/v2/hotel/search" \
  -H "Content-Type: application/json" \
  -H "yapi-version: 2.0.0" \
  -H "yapi-merchant: your-merchant" \
  -H "yapi-timestamp: 1613465391602" \
  -H "yapi-nonce: CLgL1Rm4" \
  -H "yapi-sign: <md5-result>" \
  -d '{"stay":{"checkIn":"2026-04-15","checkOut":"2026-04-16"}}'

Keep the client and server clocks synchronized. The server validates the signature, timestamp window, and nonce uniqueness. Generate a new timestamp, nonce, and signature when retrying a request.