सीधे मुख्य सामग्री पर जाएँ

कोड के नमूने

सबसे ज़्यादा इस्तेमाल होने वाली कॉल, चार भाषाओं में। आधिकारिक पैकेज अभी प्रकाशित नहीं हुए हैं; चाहें तो OpenAPI दस्तावेज़ से क्लाइंट बनाएँ।

OpenAPI डाउनलोड करें (JSON)

अपनी की जाँचें

GET /me

curl "https://api.opentourbase.com/api/supplier/v1/me" \
  -H "Authorization: Bearer $API_KEY"

प्रोडक्ट की सूची

GET /products

curl "https://api.opentourbase.com/api/supplier/v1/products?limit=25" \
  -H "Authorization: Bearer $API_KEY"

एक प्रोडक्ट पढ़ें

GET /products/{uuid}

curl "https://api.opentourbase.com/api/supplier/v1/products/{uuid}" \
  -H "Authorization: Bearer $API_KEY"

उपलब्धता पढ़ें

GET /options/{optionUuid}/availability

curl "https://api.opentourbase.com/api/supplier/v1/options/{optionUuid}/availability?local_date=2026-12-05" \
  -H "Authorization: Bearer $API_KEY"

बुकिंग होल्ड करें

POST /bookings

curl -X POST "https://api.opentourbase.com/api/supplier/v1/bookings" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"optionId":"{optionId}","availabilityId":"{availabilityId}","units":[{"unitId":"{unitId}","quantity":2}],"reference":"ORDER-1042"}'

बुकिंग कन्फ़र्म करें

POST /bookings/{uuid}/confirm

curl -X POST "https://api.opentourbase.com/api/supplier/v1/bookings/{uuid}/confirm" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"contact":{"fullName":"Ana Beridze","email":"ana@example.com"},"payment":{"mode":"offline"}}'

इवेंट पढ़ें

GET /events

curl "https://api.opentourbase.com/api/supplier/v1/events?after=evt_01JD3XB0V7M2A8K4R6T9W1Y3Z5" \
  -H "Authorization: Bearer $API_KEY"

वेबहुक एंडपॉइंट जोड़ें

POST /webhook-endpoints

curl -X POST "https://api.opentourbase.com/api/supplier/v1/webhook-endpoints" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/webhooks","events":["booking.confirmed","booking.cancelled"]}'

वेबहुक हस्ताक्षर जाँचें

import crypto from "node:crypto";

export function verify(rawBody, headers, secret, toleranceSec = 300) {
  const id = headers["webhook-id"], ts = headers["webhook-timestamp"], sig = headers["webhook-signature"];
  if (!id || !ts || !sig || Math.abs(Date.now() / 1000 - Number(ts)) > toleranceSec) return false;
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const expected = crypto.createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest("base64");
  return sig.split(" ").some((p) => {
    const [v, s] = p.split(",");
    return v === "v1" && s && s.length === expected.length && crypto.timingSafeEqual(Buffer.from(s), Buffer.from(expected));
  });
}
क़ीमतफ़्री में शुरू करें