انتقل إلى المحتوى

    واجهة الشركاء البرمجية

    بِع فنادق لايف دريم على موقعك. ابحث وسعّر واحجز من خوادمك، والدفع من محفظة شركتك.

    البدء السريع

    ١. سجّل كشركة على لايف دريم وانتظر اعتماد حسابك.

    ٢. من حسابك افتح تبويب API واطلب الوصول. أخبرنا بما ستبنيه، ونرد خلال يوم عمل واحد.

    ٣. بعد الاعتماد أنشئ مفتاح API بالصلاحيات التي يحتاجها فقط، وانسخه — فهو يظهر مرة واحدة.

    ٤. اشحن محفظتك. الحجوزات عبر الواجهة تُدفع منها فورًا.

    ٥. نفّذ أول طلب من خادمك:

    curl https://api.lifedream.net/v1/hotels?city=Mecca \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"

    البيئات

    بيئة التجربة تشغّل الإصدار القادم من الموقع ببيانات تجريبية. اطلب منا حساب شركة تجريبيًا ورصيدًا تجريبيًا في المحفظة. المفتاح التجريبي لا يعمل في الإنتاج، والمفتاح الفعلي لا يعمل في التجربة.

    البيئةالعنوان الأساسيالمفاتيح
    الإنتاجhttps://api.lifedream.netld_live_…
    التجربةhttps://dev.lifedream.net/apild_test_…

    المصادقة وأمان المفاتيح

    أرسل المفتاح في ترويسة Authorization مع كل طلب: Authorization: Bearer ld_live_…

    الواجهة للاتصال بين الخوادم فقط. الطلبات القادمة من متصفح (أي طلب يحمل ترويسة Origin) تُرفض، ولا ترسل الواجهة ترويسات CORS، لذلك المفتاح الموضوع في صفحة ويب أو تطبيق جوال لن يعمل — وسيُسرق. احفظ المفاتيح في مخزن الأسرار على خادمك أو في متغيرات البيئة، ولا تضعها أبدًا في مستودع كود.

    المفتاح الموضوع في رابط URL يُرفض حتى لو كان صالحًا، لأن الروابط تُسجَّل في السجلات. إن حدث ذلك فاعتبر المفتاح مكشوفًا وبدّله.

    امنح كل مفتاح الصلاحيات التي يحتاجها فقط، وقيّده بعناوين IP لخوادمك متى أمكن. للتبديل: أنشئ المفتاح الجديد وفعّله، ثم ألغِ القديم من تبويب API. الإلغاء يسري من الطلب التالي.

    نحن نحفظ بصمة مشفّرة لكل مفتاح فقط، ولا يستطيع أحد في لايف دريم قراءة مفتاحك، لذا المفتاح المفقود يُستبدل ولا يُسترجع.

    الصلاحيةتسمح بـ
    search:readالفنادق والغرف والأسعار المتاحة وعروض الأسعار
    bookings:readقراءة حجوزاتك
    bookings:writeالحجز (مدفوعًا من محفظتك) والإلغاء
    wallet:readرصيد المحفظة ومعاملاتها
    webhooks:manageروابط الـ Webhooks
    marketplace:readتصفح العروض وقراءة طلباتك
    marketplace:writeالطلب والدفع والاعتماد والرفض
    special_requests:readقراءة الطلبات الخاصة
    special_requests:writeالإنشاء والتسعير والقبول والدفع

    خطوات الحجز

    ١. GET /v1/hotels — ابحث عن الفنادق بالمدينة أو النص أو التواريخ.

    ٢. GET /v1/hotels/{id}/rates — كل خطط الأسعار التي يمكنها بيع لياليك لمجموعتك، بأسعار كاملة مع الوجبات وشروط الإلغاء وترقيات الوجبات.

    ٣. POST /v1/quotes — الإجمالي الدقيق للخطة التي اخترتها مع الأسرّة الإضافية أو الترقية. اعرض هذا الإجمالي على عميلك.

    ٤. POST /v1/bookings — احجز وأرسل الإجمالي في expectedTotal. يُدفع الحجز من محفظتك فورًا ويبدأ بحالة PROCESSING.

    ٥. GET /v1/bookings/{bookingNumber} — يؤكد الفندق خلال ساعات، فتصبح الحالة CONFIRMED ويظهر hotelConfirmationNumber، ويصل أيضًا إلى بريد الضيف الذي أرسلته.

    curl -X POST https://api.lifedream.net/v1/bookings \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Idempotency-Key: order-88213" \
      -H "Content-Type: application/json" \
      -d '{
        "ratePlanId": "…",
        "checkIn": "2026-12-10",
        "checkOut": "2026-12-13",
        "adults": 2,
        "expectedTotal": 1350,
        "clientReference": "ORD-88213",
        "guest": { "name": "Ahmed Ali", "email": "reservations@your-agency.com" }
      }'

    منع التكرار (Idempotency)

    كل طلب POST يحرّك أموالًا — الحجز والإلغاء — يحتاج ترويسة Idempotency-Key بقيمة فريدة لكل عملية، مثل رقم طلبك.

    إذا انتهت مهلة الطلب فأعده بنفس المفتاح ونفس الجسم، فتحصل على النتيجة الأصلية (مع Idempotent-Replayed: true) بدل حجز ثانٍ. نفس المفتاح بجسم مختلف يُرفض برمز 422. تُحفظ المفاتيح 24 ساعة.

    إذا فشلت المحاولة الأولى من جهتنا (5xx) فإعادة الطلب بنفس المفتاح تُرد بـ 409 outcome_unknown لأن الحجز ربما تم. ابحث عنه عبر GET /v1/bookings?clientReference=… قبل المحاولة بمفتاح جديد.

    الأسعار والعملة وسرية الشركات

    كل سعر هو السعر النهائي الذي تدفعه، بعملة خطة السعر. تُخصم المحفظة بعملتها بسعر صرفنا لليوم، وتُظهر معاملة المحفظة المبلغين.

    السعر يُحسب دائمًا من جهتنا. إذا تغيّر بين عرض السعر والحجز يُرفض الحجز برمز price_changed ولا يُخصم شيء — اطلب عرض سعر جديدًا وأكّده مع عميلك.

    الشركات المتعاملة على لايف دريم تبقى مجهولة لبعضها: لا يذكر أي رد الشركة البائعة، ولا يرى أي بائع من اشترى منه.

    قاعدة الجنسية على خطة السعر للعلم فقط ولا تمنع الحجز أبدًا.

    الإلغاء والاسترداد

    كل خطة سعر وكل حجز يحمل cancellation.freeCancellationUntil — اللحظة الدقيقة التي يمكن الإلغاء المجاني قبلها: الساعة 23:59 بتوقيت القاهرة في يوم المهلة، وفي موعد أقصاه ليلة ما قبل الوصول.

    قبل تلك اللحظة، POST /v1/bookings/{bookingNumber}/cancel يلغي الحجز ويرد كامل المبلغ المدفوع إلى محفظتك فورًا. بعدها، أو في يوم الوصول، أو مع خطة غير قابلة للاسترداد، يكون الرد 409 not_refundable: تواصل مع الدعم.

    تُثبَّت الشروط على الحجز لحظة إنشائه، فأي تعديل لاحق على خطة السعر لا يغيّر ما اتفقت عليه.

    سوق العروض

    تبيع الشركات الغرف على لوحة العروض. كمشترٍ: تصفح GET /v1/marketplace/offers، ثم اطلب غرفًا على عرض (POST /v1/marketplace/offers/{id}/requests) بإجمالي ثابت، ثم ادفعه من محفظتك (POST /v1/marketplace/requests/{id}/pay مع Idempotency-Key وexpectedTotal). الدفع هو ما يحجز الغرف، ثم يعتمد البائع أو يرفض ويُرد المبلغ لمحفظتك فورًا.

    كبائع: GET /v1/marketplace/requests/incoming يعرض الطلبات المدفوعة بانتظار ردك؛ اعتمدها أو ارفضها. الأسعار التي تراها هي صافي سعرك. نشر العروض يبقى عبر الموقع حاليًا.

    الشركة الأخرى دائمًا "Customer": لا يُرجع أي رد اسمًا أو معرّفًا أو بريدًا أو رمز نسك لطرف آخر.

    حدث الـ Webhookيُرسل إلى
    marketplace.request.paidالبائع — دفع مشترٍ؛ رُد عليه
    marketplace.request.approvedالمشتري
    marketplace.request.rejectedالمشتري (مع booking.cancelled والاسترداد)

    الطلبات الخاصة

    اطلب من عدة شركات تسعير غرف: POST /v1/special-requests. تصل العروض حتى انتهاء الطلب (24 ساعة افتراضيًا)، ويعرضها GET /v1/special-requests/{id} باسم Customer 1، 2… حسب السعر. اقبل عرضًا (يحجز غرفه حتى paymentDueAt) ثم ادفعه من محفظتك عبر …/quotes/{quoteId}/pay. يمكن لعدة عروض أن تغطي طلبًا واحدًا معًا.

    للتسعير: GET /v1/special-requests/inbox ثم PUT /v1/special-requests/{id}/quote بصافي سعرك. ترى عرضك فقط، وتُبلَّغ بالبيع عند دفع صاحب الطلب — فالقبول غير المدفوع مجرد حجز مؤقت قد ينتهي.

    حدث الـ Webhookيُرسل إلى
    special_request.quote.receivedصاحب الطلب — سعّرت شركة أو عدّلت عرضها
    special_request.quote.paidالشركة المسعّرة — دُفع عرضها المقبول
    special_request.quote.rejectedالشركة المسعّرة

    الـ Webhooks

    بدل الاستعلام المتكرر، سجّل رابط HTTPS على خادمك عبر POST /v1/webhooks (صلاحية webhooks:manage)، وسنرسل إليه حدثًا بصيغة JSON عند أي تغيير. يحتوي الرد على سرّ التوقيع (whsec_…) مرة واحدة فقط — احفظه مثل كلمة المرور.

    رُد بأي رمز 2xx خلال 10 ثوانٍ. غير ذلك يُعاد إرساله بعد 30 ثانية ثم دقيقتين ثم 10 دقائق ثم ساعة ثم 6 ساعات ثم 24 ساعة. إذا فشلت عشرة أحداث متتالية في كل محاولاتها يُوقف الرابط، وتعيد تفعيله عبر PATCH /v1/webhooks/{id} {"isActive": true}. سجل آخر 30 يومًا في GET /v1/webhooks/{id}/deliveries.

    قد يصل نفس الحدث مرتين: اعتمد على id الخاص به (موجود أيضًا في ترويسة LD-Event-Id) لمنع التكرار. قد تصل الأحداث بغير ترتيبها؛ اقرأ الحالة من محتوى الحدث أو اطلب الحجز.

    يجب أن يكون الرابط HTTPS عامًا. العناوين داخل الشبكات الخاصة وlocalhost والتحويلات (redirects) مرفوضة.

    الحدثمتى
    booking.paidدُفع أحد حجوزاتك (من المحفظة أو بعد اعتماد تحويل بنكي)
    booking.confirmedأكّد الفندق الحجز وظهر hotelConfirmationNumber
    booking.cancelledأُلغي الحجز — بواسطتك أو الدعم أو رفضه البائع
    wallet.topup.approvedاعتُمد شحن المحفظة وأضيف الرصيد
    wallet.topup.rejectedرُفض شحن المحفظة مع السبب
    webhook.testيُرسل فقط عبر POST /v1/webhooks/{id}/test
    {
      "id": "evt_8c1f…",
      "type": "booking.confirmed",
      "createdAt": "2026-12-01T09:12:44.000Z",
      "data": { "booking": { "bookingNumber": "BK-2026-7TQ4M2XK", "status": "CONFIRMED", "hotelConfirmationNumber": "H-55120", "…": "same shape as GET /v1/bookings/{bookingNumber}" } }
    }

    التحقق من توقيع الـ Webhook

    كل إرسال يحمل LD-Signature: t=<ثوانٍ unix>,v1=<التوقيع>. التوقيع هو HMAC-SHA256 للنص "<t>.<الجسم الخام>" بسرّ الرابط، بصيغة hex. احسبه على الجسم الخام قبل تحليل JSON، وقارن بزمن ثابت، وارفض أي توقيت أقدم من خمس دقائق حتى لا يُعاد إرسال طلب ملتقط.

    بدّل السرّ عبر POST /v1/webhooks/{id}/rotate-secret؛ الإرسال بعد ذلك يُوقّع بالسرّ الجديد.

    // Node.js (Express): verify before trusting the body
    const crypto = require('crypto');
    app.post('/hooks/lifedream', express.raw({ type: 'application/json' }), (req, res) => {
      const header = req.get('LD-Signature') || '';
      const { t, v1 } = Object.fromEntries(header.split(',').map((p) => p.split('=')));
      const expected = crypto.createHmac('sha256', process.env.LIFEDREAM_WEBHOOK_SECRET)
        .update(`${t}.${req.body}`).digest('hex');
      const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
      if (!fresh || !v1 || v1.length !== expected.length ||
          !crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected))) {
        return res.sendStatus(400);
      }
      const event = JSON.parse(req.body);
      // Deduplicate on event.id: the same event can arrive more than once.
      res.sendStatus(204);
    });
    
    <?php // PHP
    $payload = file_get_contents('php://input');
    parse_str(str_replace(',', '&', $_SERVER['HTTP_LD_SIGNATURE'] ?? ''), $sig);
    $expected = hash_hmac('sha256', $sig['t'] . '.' . $payload, getenv('LIFEDREAM_WEBHOOK_SECRET'));
    if (abs(time() - (int) $sig['t']) > 300 || !hash_equals($expected, $sig['v1'] ?? '')) {
        http_response_code(400); exit;
    }
    $event = json_decode($payload, true);
    http_response_code(204);
    
    # Python (Flask)
    import hashlib, hmac, os, time
    from flask import request, abort
    
    @app.post('/hooks/lifedream')
    def lifedream_hook():
        sig = dict(p.split('=', 1) for p in request.headers.get('LD-Signature', '').split(','))
        body = request.get_data()
        expected = hmac.new(os.environ['LIFEDREAM_WEBHOOK_SECRET'].encode(),
                            sig['t'].encode() + b'.' + body, hashlib.sha256).hexdigest()
        if abs(time.time() - int(sig['t'])) > 300 or not hmac.compare_digest(expected, sig.get('v1', '')):
            abort(400)
        event = request.get_json()
        return '', 204

    الأخطاء

    كل الأخطاء بشكل واحد. اعتمد على code في منطقك واعرض message للمستخدم. أرسل Accept-Language: ar لتصلك الرسائل بالعربية. اذكر requestId (موجود أيضًا في ترويسة X-Request-Id) عند التواصل مع الدعم.

    الحالةالرموز
    400validation_failed, invalid_json, invalid_dates, idempotency_key_required, api_key_in_url, invalid_webhook_url
    401missing_api_key, invalid_api_key, expired_api_key, revoked_api_key, wrong_environment_api_key, company_inactive_api_key, access_revoked_api_key
    402insufficient_funds
    403insufficient_scope, ip_not_allowed, browser_not_allowed
    404not_found (مسار غير موجود), hotel_not_found, rate_plan_not_found, booking_not_found, webhook_not_found, delivery_not_found, offer_not_found, request_not_found
    409price_changed, not_available, not_refundable, already_cancelled, not_cancellable, cancel_via_support, request_in_progress, outcome_unknown, too_many_webhooks, webhook_disabled, test_pending, quote_locked
    422idempotency_key_reused
    429rate_limited
    {
      "error": {
        "code": "price_changed",
        "message": "The price is now 1390.00 USD, not 1350.00. …",
        "requestId": "req_4f1c…"
      }
    }

    حدود الطلبات

    لكل مفتاح 120 طلبًا في الدقيقة، و30 في الدقيقة للحجز والإلغاء، ولكل مفاتيح الشركة معًا 300 في الدقيقة. كل رد يحمل X-RateLimit-Limit وX-RateLimit-Remaining وX-RateLimit-Reset، والرد 429 يحمل Retry-After بالثواني. تحتاج أكثر؟ أخبرنا بما تبنيه.

    خزّن محتوى الفنادق (الأسماء والصور والمرافق) لديك ليوم واحد، أما الأسعار وعروض الأسعار فتتغير ويجب طلبها مباشرة.

    مرجع الواجهة

    مُولَّد من الواجهة الفعلية فهو محدّث دائمًا. أسماء الحقول بالإنجليزية، وكل حقل نصي له نسخة عربية يأتي معه حقل توأم ينتهي بـ Ar ‏(name / nameAr).

    Hotels

    get/v1/hotels/{id}

    Get a hotel

    Hotel content, images, amenities and room types, in English and Arabic.

    الصلاحية: search:read

    المعاملات
    nameintypeمطلوب
    idpathstring✓Hotel id
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/hotels/{id}" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/hotels/{id}/rates

    Available rates for a stay

    Every rate plan that can sell these nights to this party, priced in full. Book one with POST /v1/bookings.

    الصلاحية: search:read

    المعاملات
    nameintypeمطلوب
    idpathstring✓Hotel id
    checkInquerystring✓Check-in date, YYYY-MM-DD.
    checkOutquerystring✓Check-out date, YYYY-MM-DD. At least one night after check-in.
    adultsquerynumber✓Adults per room.
    childrenquerynumberChildren per room.
    childAgesquerynumber[]One age per child (0-17). In a query string: comma-separated, e.g. childAges=4,9.
    roomsquerynumberNumber of rooms.
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/hotels/{id}/rates" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"

    Quotes

    post/v1/quotes

    Price a stay

    The exact total a booking would be charged now, with extra beds and meal upgrades. Pass price.total as expectedTotal when booking.

    الصلاحية: search:read

    جسم الطلب
    fieldtypeمطلوب
    checkInstring✓Check-in date, YYYY-MM-DD.
    checkOutstring✓Check-out date, YYYY-MM-DD. At least one night after check-in.
    adultsnumber✓Adults per room.
    childrennumberChildren per room.
    childAgesnumber[]One age per child (0-17). In a query string: comma-separated, e.g. childAges=4,9.
    roomsnumberNumber of rooms.
    ratePlanIdstring✓A rate plan id from GET /v1/hotels/{id}/rates.
    extraBedsnumberExtra beds per room, per night. Omitted: what the party needs. Ignored by plans that do not sell extra beds.
    mealUpgradeIdstringA meal upgrade id from the rate plan, to buy a fuller board on top of its own.
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/quotes" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Content-Type: application/json" -d @body.json

    Bookings

    post/v1/bookings

    Book a stay

    Paid from your wallet at once. The booking is PROCESSING until the hotel confirms it, then CONFIRMED with a hotelConfirmationNumber.

    الصلاحية: bookings:write

    المعاملات
    nameintypeمطلوب
    Idempotency-Keyheaderstring✓Unique per operation (8-255 chars). Retrying with the same key returns the first result.
    جسم الطلب
    fieldtypeمطلوب
    checkInstring✓Check-in date, YYYY-MM-DD.
    checkOutstring✓Check-out date, YYYY-MM-DD. At least one night after check-in.
    adultsnumber✓Adults per room.
    childrennumberChildren per room.
    childAgesnumber[]One age per child (0-17). In a query string: comma-separated, e.g. childAges=4,9.
    roomsnumberNumber of rooms.
    ratePlanIdstring✓A rate plan id from GET /v1/hotels/{id}/rates.
    extraBedsnumberExtra beds per room, per night. Omitted: what the party needs. Ignored by plans that do not sell extra beds.
    mealUpgradeIdstringA meal upgrade id from the rate plan, to buy a fuller board on top of its own.
    guest.namestring✓Lead guest, as the hotel will see it.
    guest.emailstring✓Receives the booking emails, including the hotel confirmation number. Use your own address if guests should not be contacted.
    guest.phonestring
    expectedTotalnumber✓The total you were quoted (POST /v1/quotes), in the quote currency. If the price changed since, the booking is refused with price_changed and nothing is charged.
    hbVariantBREAKFAST_LUNCH | BREAKFAST_DINNERHalf board only: which two meals.
    notesstringRequests passed to the hotel (not guaranteed).
    clientReferencestringYour own id for this booking, returned on every read.
    الردود
    • 201Booked and paid.
    • 401Missing, invalid, expired or revoked API key.
    • 402insufficient_funds: top up your wallet.
    • 403Missing scope, address not allowed, or a browser request.
    • 409price_changed or not_available.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/bookings" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Idempotency-Key: <unique-per-operation>" \
      -H "Content-Type: application/json" -d @body.json
    get/v1/bookings

    List your bookings

    Newest first. Bookings made on the site are included.

    الصلاحية: bookings:read

    المعاملات
    nameintypeمطلوب
    pagequerynumber
    limitquerynumber
    statusqueryPENDING | PROCESSING | CONFIRMED | COMPLETED | CANCELLED
    clientReferencequerystringBookings with this clientReference.
    createdFromquerystringCreated at or after this instant (ISO 8601).
    createdToquerystringCreated before this instant (ISO 8601).
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/bookings" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/bookings/{bookingNumber}

    Get a booking

    الصلاحية: bookings:read

    المعاملات
    nameintypeمطلوب
    bookingNumberpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/bookings/{bookingNumber}" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/bookings/{bookingNumber}/cancel

    Cancel a booking

    Before cancellation.freeCancellationUntil, cancels and refunds the full amount to your wallet. After it, or on a non-refundable rate, the answer is 409 not_refundable and support handles it.

    الصلاحية: bookings:write

    المعاملات
    nameintypeمطلوب
    bookingNumberpathstring✓
    Idempotency-Keyheaderstring✓Unique per operation (8-255 chars). Retrying with the same key returns the first result.
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/bookings/{bookingNumber}/cancel" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Idempotency-Key: <unique-per-operation>"

    Wallet

    get/v1/wallet

    Wallet balance

    available pays for bookings; pending is top-ups awaiting review.

    الصلاحية: wallet:read

    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/wallet" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/wallet/transactions

    Wallet transactions

    Newest first. Amounts are signed, in the wallet currency.

    الصلاحية: wallet:read

    المعاملات
    nameintypeمطلوب
    pagequerynumber
    limitquerynumber
    typequeryTOPUP | BOOKING_PAYMENT | REFUND | ADJUSTMENT
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/wallet/transactions" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"

    Webhooks

    get/v1/webhooks

    List webhook endpoints

    الصلاحية: webhooks:manage

    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/webhooks" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/webhooks

    Create a webhook endpoint

    Returns the signing secret (whsec_…) once. Store it; it is never shown again.

    الصلاحية: webhooks:manage

    جسم الطلب
    fieldtypeمطلوب
    urlstring✓HTTPS URL on your server.
    eventsbooking.paid | booking.confirmed | booking.cancelled | wallet.topup.approved | wallet.topup.rejected | marketplace.request.paid | marketplace.request.approved | marketplace.request.rejected | special_request.quote.received | special_request.quote.paid | special_request.quote.rejected[]✓
    descriptionstring
    الردود
    • 201
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/webhooks" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Content-Type: application/json" -d @body.json
    patch/v1/webhooks/{id}

    Update a webhook endpoint

    Change the URL, events, description, or turn it on and off.

    الصلاحية: webhooks:manage

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    جسم الطلب
    fieldtypeمطلوب
    urlstring
    eventsbooking.paid | booking.confirmed | booking.cancelled | wallet.topup.approved | wallet.topup.rejected | marketplace.request.paid | marketplace.request.approved | marketplace.request.rejected | special_request.quote.received | special_request.quote.paid | special_request.quote.rejected[]
    descriptionstring
    isActivebooleanTurn the endpoint on or off. Turning it on clears an automatic disable.
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X PATCH "https://api.lifedream.net/v1/webhooks/{id}" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Content-Type: application/json" -d @body.json
    delete/v1/webhooks/{id}

    Delete a webhook endpoint

    الصلاحية: webhooks:manage

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X DELETE "https://api.lifedream.net/v1/webhooks/{id}" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/webhooks/{id}/rotate-secret

    Rotate the signing secret

    Returns the new secret once; deliveries from now on are signed with it.

    الصلاحية: webhooks:manage

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/webhooks/{id}/rotate-secret" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/webhooks/{id}/test

    Send a test event

    Queues a webhook.test event to this endpoint within seconds.

    الصلاحية: webhooks:manage

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 202
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/webhooks/{id}/test" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/webhooks/{id}/deliveries

    Delivery log

    Newest first, kept 30 days: status, attempts, last HTTP status and error.

    الصلاحية: webhooks:manage

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    pagequerynumber
    limitquerynumber
    statusqueryPENDING | PROCESSING | SUCCEEDED | FAILED
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/webhooks/{id}/deliveries" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/webhooks/{id}/deliveries/{deliveryId}/retry

    Retry a failed delivery

    الصلاحية: webhooks:manage

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    deliveryIdpathstring✓
    الردود
    • 202
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/webhooks/{id}/deliveries/{deliveryId}/retry" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"

    Marketplace

    get/v1/marketplace/offers

    Browse marketplace offers

    Rooms other companies are selling. Your own offers are not listed.

    الصلاحية: marketplace:read

    المعاملات
    nameintypeمطلوب
    countryquerystringCountry name in English.
    cityquerystringCity name in English.
    areaquerystring
    checkInquerystringWith checkOut: offers that cover the whole stay.
    checkOutquerystring
    starsquerynumber[]Star ratings.
    minPricequerynumber
    maxPricequerynumber
    priceCurrencyquerystringCurrency of minPrice/maxPrice.
    pagequerynumber
    limitquerynumber
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/marketplace/offers" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/marketplace/offers/{id}

    Get a marketplace offer

    الصلاحية: marketplace:read

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/marketplace/offers/{id}" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/marketplace/offers/{id}/availability

    Rooms free per night on an offer

    الصلاحية: marketplace:read

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/marketplace/offers/{id}/availability" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/marketplace/offers/{id}/requests

    Request rooms on an offer

    Creates a PENDING request at a fixed total. Pay it to hold the rooms; the seller then approves or refuses (refusal refunds your wallet).

    الصلاحية: marketplace:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓Offer id
    جسم الطلب
    fieldtypeمطلوب
    checkInstring✓Inside the offer window.
    checkOutstring✓
    roomsnumber✓
    adultsnumberAdults per room, when the offer prices by party size.
    guestNationalitystringISO 3166-1 alpha-2 of the guests.
    extraBedsnumber
    mealUpgradeIdstringA meal upgrade id from the offer.
    hbVariantBREAKFAST_LUNCH | BREAKFAST_DINNER
    buyerNotesstringShown to the seller.
    الردود
    • 201
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/marketplace/offers/{id}/requests" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Content-Type: application/json" -d @body.json
    get/v1/marketplace/requests

    Your requests as a buyer

    الصلاحية: marketplace:read

    المعاملات
    nameintypeمطلوب
    statusqueryPENDING | APPROVED | REJECTED | PAID | CANCELLED | EXPIRED
    offerIdquerystring
    pagequerynumber
    limitquerynumber
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/marketplace/requests" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/marketplace/requests/incoming

    Requests on your offers, as a seller

    Paid requests waiting for your answer, and decided ones. Prices are your net. The buyer is always "Customer".

    الصلاحية: marketplace:read

    المعاملات
    nameintypeمطلوب
    statusqueryPENDING | APPROVED | REJECTED | PAID | CANCELLED | EXPIRED
    offerIdquerystring
    pagequerynumber
    limitquerynumber
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/marketplace/requests/incoming" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/marketplace/requests/{id}

    Get a request

    role says which side you are on.

    الصلاحية: marketplace:read

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/marketplace/requests/{id}" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/marketplace/requests/{id}/cancel

    Withdraw your request

    Only before it is paid.

    الصلاحية: marketplace:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/marketplace/requests/{id}/cancel" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/marketplace/requests/{id}/pay

    Pay a request from your wallet

    expectedTotal must equal the request total.

    الصلاحية: marketplace:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    Idempotency-Keyheaderstring✓Unique per operation (8-255 chars). Retrying with the same key returns the first result.
    جسم الطلب
    fieldtypeمطلوب
    guest.namestring✓Lead guest, as the hotel will see it.
    guest.emailstring✓Receives the booking emails, including the hotel confirmation number. Use your own address if guests should not be contacted.
    guest.phonestring
    expectedTotalnumber✓The total you expect to pay, in the request or quote currency. A different price is refused with price_changed.
    notesstring
    clientReferencestringYour own id, returned on the booking.
    الردود
    • 201
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/marketplace/requests/{id}/pay" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Idempotency-Key: <unique-per-operation>" \
      -H "Content-Type: application/json" -d @body.json
    post/v1/marketplace/requests/{id}/approve

    Approve a paid request (seller)

    الصلاحية: marketplace:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    Idempotency-Keyheaderstring✓Unique per operation (8-255 chars). Retrying with the same key returns the first result.
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/marketplace/requests/{id}/approve" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Idempotency-Key: <unique-per-operation>"
    post/v1/marketplace/requests/{id}/reject

    Refuse a request (seller)

    A paid request is refunded to the buyer at once.

    الصلاحية: marketplace:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    Idempotency-Keyheaderstring✓Unique per operation (8-255 chars). Retrying with the same key returns the first result.
    جسم الطلب
    fieldtypeمطلوب
    reasonstring
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/marketplace/requests/{id}/reject" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Idempotency-Key: <unique-per-operation>" \
      -H "Content-Type: application/json" -d @body.json

    Special requests

    post/v1/special-requests

    Ask companies to quote

    Companies quote until expiresInHours; several can fill one request between them. At most 10 open requests.

    الصلاحية: special_requests:write

    جسم الطلب
    fieldtypeمطلوب
    kindEXISTING_HOTEL | NEW_HOTEL✓EXISTING_HOTEL (give hotelId, optional roomId) or NEW_HOTEL (describe it).
    hotelIdstring
    roomIdstring
    countryCodestring
    countrystring
    citystring
    areastring
    hotelNamestring
    roomTypeNamestring
    checkInDatestring✓
    checkOutDatestring✓
    numberOfRoomsnumber✓
    numberOfAdultsnumber✓Adults per room.
    numberOfChildrennumber
    childAgesnumber[]
    guestNationalitystring
    viewstring
    mealPlanRO | BB | HB | FB | AI
    hbVariantBREAKFAST_LUNCH | BREAKFAST_DINNER
    expiresInHoursnumberHow long companies may quote.
    notesstring
    currencystring
    الردود
    • 201
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/special-requests" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Content-Type: application/json" -d @body.json
    get/v1/special-requests

    Your special requests

    الصلاحية: special_requests:read

    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/special-requests" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/special-requests/inbox

    Requests you can quote on

    Other companies' open requests in your preferred countries, and ones you quoted. The requester is always "Customer".

    الصلاحية: special_requests:read

    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/special-requests/inbox" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    get/v1/special-requests/{id}

    Get a special request

    As requester: every quote, named Customer 1, 2… by price. As a quoting company: only your own quote.

    الصلاحية: special_requests:read

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl "https://api.lifedream.net/v1/special-requests/{id}" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/special-requests/{id}/cancel

    Cancel your special request

    الصلاحية: special_requests:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/special-requests/{id}/cancel" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    put/v1/special-requests/{id}/quote

    Submit or update your quote

    One quote per company; prices are your net.

    الصلاحية: special_requests:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    جسم الطلب
    fieldtypeمطلوب
    netPricePerNightnumber✓Your net price per room per night; the requester sees it with commission.
    currencystring
    roomsAvailablenumber✓Rooms you can supply, at most what is still needed.
    mealPlanRO | BB | HB | FB | AI
    hbVariantBREAKFAST_LUNCH | BREAKFAST_DINNER
    mealNetPerPersonnumber
    kitchenTypestring
    nusukHotelIdstringYour Nusuk code for the hotel; required unless one is on file.
    checkInDatestringBoth or neither; inside the request dates. Default: the whole request.
    checkOutDatestring
    viewstring
    baseOccupancynumber
    maxAdultsnumber
    extraBedNetPerNightnumber
    cancellationTypeNON_REFUNDABLE | FLEXIBLE
    freeCancellationDaysnumber
    cancellationPolicystring
    notesstring
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X PUT "https://api.lifedream.net/v1/special-requests/{id}/quote" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Content-Type: application/json" -d @body.json
    post/v1/special-requests/{id}/quotes/{quoteId}/withdraw

    Withdraw your quote

    الصلاحية: special_requests:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    quoteIdpathstring✓
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/special-requests/{id}/quotes/{quoteId}/withdraw" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY"
    post/v1/special-requests/{id}/quotes/{quoteId}/reject

    Refuse a quote (requester)

    الصلاحية: special_requests:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    quoteIdpathstring✓
    جسم الطلب
    fieldtypeمطلوب
    reasonstring
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/special-requests/{id}/quotes/{quoteId}/reject" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Content-Type: application/json" -d @body.json
    post/v1/special-requests/{id}/quotes/{quoteId}/accept

    Accept a quote (requester)

    Takes its rooms, up to what is still needed, and holds them until paymentDueAt. Pay with …/pay.

    الصلاحية: special_requests:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    quoteIdpathstring✓
    Idempotency-Keyheaderstring✓Unique per operation (8-255 chars). Retrying with the same key returns the first result.
    الردود
    • 200
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/special-requests/{id}/quotes/{quoteId}/accept" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Idempotency-Key: <unique-per-operation>"
    post/v1/special-requests/{id}/quotes/{quoteId}/pay

    Pay an accepted quote from your wallet

    Creates the booking. expectedTotal must equal the accepted price (with any extra beds or upgrade).

    الصلاحية: special_requests:write, bookings:write

    المعاملات
    nameintypeمطلوب
    idpathstring✓
    quoteIdpathstring✓
    Idempotency-Keyheaderstring✓Unique per operation (8-255 chars). Retrying with the same key returns the first result.
    جسم الطلب
    fieldtypeمطلوب
    guest.namestring✓Lead guest, as the hotel will see it.
    guest.emailstring✓Receives the booking emails, including the hotel confirmation number. Use your own address if guests should not be contacted.
    guest.phonestring
    expectedTotalnumber✓The total you expect to pay, in the request or quote currency. A different price is refused with price_changed.
    notesstring
    clientReferencestringYour own id, returned on the booking.
    extraBedsnumber
    mealUpgradeIdstringA meal upgrade id from the accepted quote.
    hbVariantBREAKFAST_LUNCH | BREAKFAST_DINNER
    الردود
    • 201
    • 401Missing, invalid, expired or revoked API key.
    • 403Missing scope, address not allowed, or a browser request.
    • 429Rate limit reached; see Retry-After.
    مثال
    curl -X POST "https://api.lifedream.net/v1/special-requests/{id}/quotes/{quoteId}/pay" \
      -H "Authorization: Bearer $LIFEDREAM_API_KEY" \
      -H "Idempotency-Key: <unique-per-operation>" \
      -H "Content-Type: application/json" -d @body.json