توثيق API — موعد EMM

REST فوق HTTPS بمصادقة مفتاح API. الإصدار 1.0.0 · openapi.json · خادم MCP · ملخص للنماذج

المصادقة

أنشئ مفتاحاً من صفحة المفاتيح (تسجيل الدخول مطلوب). أرسله في كل طلب:

Authorization: Bearer emm_booking_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# أو
X-API-Key: emm_booking_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • بلا مفتاح أو مفتاح غير صالح/ملغى → 401
  • مفتاح بلا صلاحية للعملية → 403
  • الصلاحيات: read للقوائم والقراءة، write للإنشاء والتعديل، admin للحذف.

الحدود والصيغة

  • الحد: 60 طلباً/دقيقة لكل مفتاح؛ بعدها 429 مع ترويسة Retry-After بالثواني.
  • النجاح: {"ok":true,"data":…} · الخطأ: {"ok":false,"error":{"code":"…","message":"…"}}
  • القوائم: ?limit=N (من 1 إلى 200، الافتراضي 50) و?offset=N؛ النتيجة data.items وdata.total.
  • المبالغ نص بالريال بمنزلتين ("200.00")، العملة SAR، التواريخ ISO-8601 بتوقيت +03:00.
  • لا تُحصَّل مدفوعات عبر الـ API: التأمين يدفعه العميل من صفحة الموعد عبر StreamPay.

نقاط الاتصال

GEThttps://booking.emm.sa/api/v1/me

الهوية والخطة والحدود / Identity, plan, quotas

يتحقق من المفتاح ويعيد المستخدم والخطة الحالية والحدود الشهرية. Checks a key; returns user, current plan and monthly quotas. · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/me" \
  -H "Authorization: Bearer $EMM_KEY"
{"plan":{"currency":"SAR","deposits":false,"features":["مزوّد خدمة واحد","30 حجز شهرياً","صفحة حجز عامة بالعربية","تأكيد عبر واتساب","تقويم اليوم والأسبوع"],"id":"starter","limits":{"monthly_bookings":30,"providers":1},"name":"ابدأ","period":"month","price":"0.00"},"quotas":{"monthly_bookings":{"limit":30,"month":"2026-12","used":4}},"service":"booking","user":{"email":"user@example.com"}}

GEThttps://booking.emm.sa/api/v1/plan

الخطة الحالية وكل الخطط / Current plan and catalogue

الخطة الحالية مع الاستهلاك، وكل الخطط بأسعارها وحدودها. Current plan with usage plus every plan (SAR/month). · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/plan" \
  -H "Authorization: Bearer $EMM_KEY"

GEThttps://booking.emm.sa/api/v1/settings

إعدادات النشاط / Business settings

بيانات النشاط وساعات العمل لكل يوم وطول الفترة والتأمين. Business identity, per-weekday hours, slot length, deposit rule. · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/settings" \
  -H "Authorization: Bearer $EMM_KEY"
{"business":{"address":"الرياض","currency":"SAR","name":"عيادة النور","phone":"+966551234567","public_url":"https://booking.emm.sa/b/clinic","slot_min":30,"slug":"clinic","timezone":"Asia/Riyadh","type":"clinic"},"deposit":{"mode":"none","value":"0.00"},"hours":[{"close":"22:00","enabled":true,"open":"10:00","weekday":0}]}

PUThttps://booking.emm.sa/api/v1/settings

تحديث الإعدادات / Update settings

تحديث جزئي: name, phone, address, slot_min (15|30|60), deposit_mode (none|fixed|percent) + deposit_value, hours[]. Partial update; hours replace all 7 weekdays. · الصلاحية: write

curl -X PUT "https://booking.emm.sa/api/v1/settings" \
  -H "Authorization: Bearer $EMM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"عيادة النور","slot_min":30,"deposit_mode":"fixed","deposit_value":20,"hours":[{"weekday":0,"open":"10:00","close":"22:00","enabled":true},{"weekday":1,"open":"10:00","close":"22:00","enabled":true},{"weekday":2,"open":"10:00","close":"22:00","enabled":true},{"weekday":3,"open":"10:00","close":"22:00","enabled":true},{"weekday":4,"open":"10:00","close":"22:00","enabled":true},{"weekday":5,"open":"10:00","close":"22:00","enabled":false},{"weekday":6,"open":"10:00","close":"22:00","enabled":false}]}'
{"business":{"address":"الرياض","currency":"SAR","name":"عيادة النور","phone":"+966551234567","public_url":"https://booking.emm.sa/b/clinic","slot_min":30,"slug":"clinic","timezone":"Asia/Riyadh","type":"clinic"},"deposit":{"mode":"none","value":"0.00"},"hours":[{"close":"22:00","enabled":true,"open":"10:00","weekday":0}]}

GEThttps://booking.emm.sa/api/v1/providers

مزوّدو الخدمة / Service providers

قائمة مزوّدي الخدمة مع خدماتهم. Lists providers with their services (ids are needed to create a booking). · المعاملات: limit offset · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/providers?limit=50&offset=0" \
  -H "Authorization: Bearer $EMM_KEY"

POSThttps://booking.emm.sa/api/v1/providers

إضافة مزوّد / Add provider

يضيف مزوّد خدمة ضمن حد الخطة. Adds a provider within the plan limit (409 quota_exceeded). · الصلاحية: write

curl -X POST "https://booking.emm.sa/api/v1/providers" \
  -H "Authorization: Bearer $EMM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"نورة"}'
{"active":true,"id":1,"name":"نورة"}

PATCHhttps://booking.emm.sa/api/v1/providers/{id}

تعديل مزوّد / Rename provider

يعيد تسمية مزوّد. Renames a provider. · المعاملات: id* · الصلاحية: write

curl -X PATCH "https://booking.emm.sa/api/v1/providers/{id}" \
  -H "Authorization: Bearer $EMM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"نورة أحمد"}'
{"active":true,"id":1,"name":"نورة"}

DELETEhttps://booking.emm.sa/api/v1/providers/{id}

حذف مزوّد / Delete provider

يحذف مزوّداً بلا مواعيد قادمة (409 إن وُجدت). Deletes a provider without upcoming bookings (409 otherwise). · المعاملات: id* · الصلاحية: admin

curl -X DELETE "https://booking.emm.sa/api/v1/providers/{id}" \
  -H "Authorization: Bearer $EMM_KEY"
{"data":{"deleted":true},"ok":true}

GEThttps://booking.emm.sa/api/v1/services

الخدمات / Services

قائمة الخدمات (اختياري حسب provider_id). Lists services, optionally filtered by provider_id. · المعاملات: limit offset provider_id · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/services?limit=50&offset=0&provider_id=" \
  -H "Authorization: Bearer $EMM_KEY"

POSThttps://booking.emm.sa/api/v1/services

إضافة خدمة / Add service

خدمة باسم ومدة (دقائق) وسعر بالريال. Service with name, duration_min and price in SAR. · الصلاحية: write

curl -X POST "https://booking.emm.sa/api/v1/services" \
  -H "Authorization: Bearer $EMM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"كشف","provider_id":1,"duration_min":30,"price":"200.00"}'
{"currency":"SAR","duration_min":30,"id":2,"name":"كشف","price":"200.00","provider_id":1}

PATCHhttps://booking.emm.sa/api/v1/services/{id}

تعديل خدمة / Update service

تعديل بيانات الخدمة أو مزوّدها (يجب أن يتبع نفس النشاط). Update a service or move it to another provider of the same business. · المعاملات: id* · الصلاحية: write

curl -X PATCH "https://booking.emm.sa/api/v1/services/{id}" \
  -H "Authorization: Bearer $EMM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"كشف","provider_id":1,"duration_min":45,"price":"250.00"}'
{"currency":"SAR","duration_min":30,"id":2,"name":"كشف","price":"200.00","provider_id":1}

DELETEhttps://booking.emm.sa/api/v1/services/{id}

حذف خدمة / Delete service

يحذف الخدمة. Deletes a service. · المعاملات: id* · الصلاحية: admin

curl -X DELETE "https://booking.emm.sa/api/v1/services/{id}" \
  -H "Authorization: Bearer $EMM_KEY"
{"data":{"deleted":true},"ok":true}

GEThttps://booking.emm.sa/api/v1/bookings

الحجوزات / Bookings

حجوزات في نطاق تاريخي (from/to بتاريخ ISO، الافتراضي اليوم→+30 يوماً) مع فلتر status وprovider_id. Bookings in a date range with status/provider filters. · المعاملات: from to status provider_id limit offset · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/bookings?from=&to=&status=&provider_id=&limit=50&offset=0" \
  -H "Authorization: Bearer $EMM_KEY"

POSThttps://booking.emm.sa/api/v1/bookings

حجز نيابةً عن عميل / Create booking on behalf of a customer

ينشئ حجزاً كصفحة الحجز: الوقت يجب أن يكون حراً (409 slot_taken). Creates a booking for a walk-in/phone customer. · الصلاحية: write

curl -X POST "https://booking.emm.sa/api/v1/bookings" \
  -H "Authorization: Bearer $EMM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"service_id":2,"start":"2026-12-10T14:30","customer_name":"أحمد العلي","customer_phone":"0551234567"}'
{"created_at":"2026-12-02T09:00:00+03:00","customer":{"name":"أحمد العلي","phone":"+966551234567"},"deposit":{"amount":"0.00","currency":"SAR","paid_manually":false,"status":"none"},"end":"2026-12-10T15:00:00+03:00","id":7,"provider":{"id":1,"name":"نورة"},"ref_code":"BK-7K3M9Q","service":{"currency":"SAR","duration_min":30,"id":2,"name":"كشف","price":"200.00"},"start":"2026-12-10T14:30:00+03:00","status":"pending","status_ar":"بانتظار التأكيد"}

POSThttps://booking.emm.sa/api/v1/slots/block

حجب فترة / Block a slot

يحجز فترة لمزوّد (إجازة/اجتماع) فلا تظهر للعملاء. Blocks a provider's time range so customers cannot book it. · الصلاحية: write

curl -X POST "https://booking.emm.sa/api/v1/slots/block" \
  -H "Authorization: Bearer $EMM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider_id":1,"start":"2026-12-10T14:30","end":"2026-12-10T16:00","note":"اجتماع"}'
{"created_at":"2026-12-02T09:00:00+03:00","customer":{"name":"أحمد العلي","phone":"+966551234567"},"deposit":{"amount":"0.00","currency":"SAR","paid_manually":false,"status":"none"},"end":"2026-12-10T15:00:00+03:00","id":7,"provider":{"id":1,"name":"نورة"},"ref_code":"BK-7K3M9Q","service":{"currency":"SAR","duration_min":30,"id":2,"name":"كشف","price":"200.00"},"start":"2026-12-10T14:30:00+03:00","status":"pending","status_ar":"بانتظار التأكيد"}

GEThttps://booking.emm.sa/api/v1/bookings/{id}

تفاصيل حجز / Booking

حجز واحد بالمعرّف (ref_code داخل البيانات). One booking by id. · المعاملات: id* · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/bookings/{id}" \
  -H "Authorization: Bearer $EMM_KEY"

POSThttps://booking.emm.sa/api/v1/bookings/{id}/actions

تغيير حالة / Transition

action: confirm | cancel | no_show | complete (confirm يُرفض قبل دفع التأمين). confirm / cancel / no_show / complete; confirm is refused while a deposit is unpaid. · المعاملات: id* · الصلاحية: write

curl -X POST "https://booking.emm.sa/api/v1/bookings/{id}/actions" \
  -H "Authorization: Bearer $EMM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action":"cancel"}'
{"created_at":"2026-12-02T09:00:00+03:00","customer":{"name":"أحمد العلي","phone":"+966551234567"},"deposit":{"amount":"0.00","currency":"SAR","paid_manually":false,"status":"none"},"end":"2026-12-10T15:00:00+03:00","id":7,"provider":{"id":1,"name":"نورة"},"ref_code":"BK-7K3M9Q","service":{"currency":"SAR","duration_min":30,"id":2,"name":"كشف","price":"200.00"},"start":"2026-12-10T14:30:00+03:00","status":"pending","status_ar":"بانتظار التأكيد"}

GEThttps://booking.emm.sa/api/v1/availability

الأوقات المتاحة / Availability

المواعيد المتاحة لنطاق تاريخي (≤ 31 يوماً) لخدمة أو مزوّد. Free slots per day for a service or provider. · المعاملات: service_id provider_id duration_min from to · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/availability?service_id=&provider_id=&duration_min=&from=&to=" \
  -H "Authorization: Bearer $EMM_KEY"

GEThttps://booking.emm.sa/api/v1/public-page

صفحة الحجز العامة / Public booking page

ما يراه العميل في /b/{slug}: الخدمات والمزوّدون والساعات. What the customer sees on /b/{slug}. · الصلاحية: read

curl -X GET "https://booking.emm.sa/api/v1/public-page" \
  -H "Authorization: Bearer $EMM_KEY"

MCP

نفس المفتاح، POST إلى https://booking.emm.sa/mcp (JSON-RPC 2.0, Streamable HTTP): initialize ← notifications/initialized ← tools/list ← tools/call. الأدوات: booking_capabilities, booking_pricing, booking_providers, booking_settings, booking_availability, booking_list, booking_create, booking_confirm, booking_cancel, booking_block. مثال كامل في دليل الوكلاء.