MekanBook geliştirici platformu
Mekanınızın menüsünü, siparişlerini, rezervasyonlarını, sadakat hesaplarını ve etkinliklerini kendi yazılımınıza, muhasebe ve CRM sistemlerinize veya otomasyon araçlarına bağlayın.
REST API
JSON, imleçli sayfalama, anahtar başına izin ve hız sınırı.
Webhooks
Olay olunca imzalı bildirim; 24 saate kadar otomatik tekrar.
MCP
Yapay zekâ asistanınız mekan verinizi salt okunur sorgulasın.
Temel adres: https://www.mekanbook.com/api/partner/v1 · Sürüm 1.0.0
POS yazılımı geliştiriyorsanız (siparişleri POS'a aktarma, kasada ödeme) ayrıca POS Connector API.
Kimlik doğrulama
Mekan sahibi veya müdürü Panel › Ayarlar › Geliştirici sayfasından anahtar oluşturur. Anahtar yalnızca bir kez gösterilir; sunucumuzda yalnızca özeti saklanır. Her isteğe ekleyin:
Authorization: Bearer mbp_xxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Anahtarı istemci tarafı (tarayıcı, mobil uygulama) koduna koymayın; sunucunuzda ortam değişkeninde tutun.
- İsteğe bağlı IP izin listesi ve anahtar başına dakikalık istek sınırı (varsayılan 120) tanımlanabilir.
- Anahtarı yenilemek eskisini hemen geçersiz kılar. Tüm anahtar işlemleri denetim kaydına yazılır.
İzinler (scope)
| Scope | Açıklama |
|---|---|
menu:read | Menüyü okuma |
menu:write | Menü fiyat ve stok güncelleme |
orders:read | Siparişleri okuma |
orders:write | Sipariş durumunu güncelleme |
reservations:read | Rezervasyonları okuma |
reservations:write | Rezervasyon oluşturma ve durum güncelleme |
loyalty:read | Sadakat hesaplarını okuma |
loyalty:write | Sadakat puanı ekleme/düşme |
customers:read | Misafir listesi (maskeli) |
events:read | Etkinlikleri okuma |
webhooks:manage | Webhook uç noktalarını yönetme |
ecommerce:read | Online mağaza: müşteri bakiyesi ve teklif |
ecommerce:write | Online mağaza: hesap bağlama, puan kazandırma/kullanma, iade |
KVKK: misafir listesi maskelidir (ad + soyadın baş harfi). Telefon ve e-posta yalnızca pazarlama izni veren misafirlerde ve kısmen gizli döner. Rezervasyon iletişim bilgisi yalnızca reservations kapsamında, mekanın kendi operasyonu için verilir.
Uç noktalar
| Yöntem | Yol | Açıklama | Scope |
|---|---|---|---|
| GET | /me | Current key and venue | |
| GET | /menu | Full menu (menus › categories › items) | menu:read |
| PATCH | /menu/items | Bulk update prices/availability (max 500). Price changes are logged. | menu:write |
| GET | /menu/items/{id} | One menu item | menu:read |
| PATCH | /menu/items/{id} | Update price and/or availability | menu:write |
| GET | /orders | Table orders (newest first) | orders:read |
| GET | /orders/{id} | One order | orders:read |
| POST | /orders/{id}/status | Move order lines to a new status (accepted → preparing → ready → served) | orders:write |
| GET | /reservations | Reservations | reservations:read |
| POST | /reservations | Create a confirmed reservation (staff channel; availability rules apply) | reservations:write |
| GET | /reservations/{id} | One reservation | reservations:read |
| POST | /reservations/{id}/status | Change reservation status (declined/cancelled_by_venue require reason; deposits are refunded automatically) | reservations:write |
| GET | /loyalty/accounts | Loyalty accounts (customer masked) | loyalty:read |
| GET | /loyalty/accounts/{id} | Loyalty account with last 50 transactions | loyalty:read |
| POST | /loyalty/accounts/{id}/adjust | Add or remove points (audited) | loyalty:write |
| GET | /customers | Guest book (masked; contact only with marketing consent) | customers:read |
| GET | /events | Published events (upcoming by default) | events:read |
| GET | /webhooks | Webhook endpoints | webhooks:manage |
| POST | /webhooks | Create endpoint. The signing secret is returned once. | webhooks:manage |
| DELETE | /webhooks/{id} | Delete endpoint | webhooks:manage |
| GET | /ecommerce/ping | Online store connection test and rules | ecommerce:read |
| POST | /ecommerce/links | Ask the customer to link their MekanBook account (code + approval link e-mailed; response never reveals whether an account exists) | ecommerce:write |
| GET | /ecommerce/links/{id} | Link request status (approved → customer_ref) | ecommerce:read |
| POST | /ecommerce/links/{id}/verify | Verify the 6-digit code the customer typed (max 5 attempts) | ecommerce:write |
| GET | /ecommerce/customers/{ref} | Balance (points, cashback, stamps, rewards) for a linked customer | ecommerce:read |
| DELETE | /ecommerce/customers/{ref} | Unlink the customer (consent withdrawn at the store) | ecommerce:write |
| POST | /ecommerce/quote | Redeemable discount for a basket (respects max %, min order, min points) | ecommerce:read |
| POST | /ecommerce/redemptions | Reserve points (deducted now, held 30 minutes). Idempotency-Key required. | ecommerce:write |
| GET | /ecommerce/redemptions/{id} | Redemption | ecommerce:read |
| POST | /ecommerce/redemptions/{id}/confirm | Confirm when the order is paid (re-deducts if the hold expired and balance allows; else 409 redemption_expired) | ecommerce:write |
| POST | /ecommerce/redemptions/{id}/cancel | Release a reserved redemption (points return to the same ledger rows) | ecommerce:write |
| POST | /ecommerce/orders | Paid order: award points once per order_ref (amount = paid, excl. shipping) | ecommerce:write |
| GET | /ecommerce/orders/{ref} | Order | ecommerce:read |
| POST | /ecommerce/orders/{ref}/refund | Refund: cumulative refunded_total; points/cashback reversed proportionally; full refund returns used points | ecommerce:write |
| POST | /ecommerce/orders/{ref}/cancel | Cancel: reverse all earned points and return used points | ecommerce:write |
| GET | /ecommerce/transactions | Recent online ledger entries for this store | ecommerce:read |
Tutarlar kuruş cinsinden tamsayıdır (24500 = 245,00 TL). Zamanlar ISO 8601 (UTC). Fiyat değişiklikleri MekanBook fiyat geçmişine ve denetim kaydına yazılır; menü mevzuatı gereği fiyat güncelleme tarihi menüde gösterilir.
Örnekler
Bir ürünün fiyatını güncelleme
curl -X PATCH https://www.mekanbook.com/api/partner/v1/menu/items/123 \
-H "Authorization: Bearer $MEKANBOOK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"price": 24500, "available": true}'
// Node 18+ (fetch yerleşik) — or: import { MekanBook } from '@mekanbook/partner'
const res = await fetch('https://www.mekanbook.com/api/partner/v1/menu/items/123', {
method: 'PATCH',
headers: { Authorization: `Bearer ${process.env.MEKANBOOK_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ price: 24500, available: true }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log((await res.json()).data);
import os, json, urllib.request
req = urllib.request.Request(
"https://www.mekanbook.com/api/partner/v1/menu/items/123",
data=json.dumps({"price": 24500, "available": True}).encode(),
method="PATCH",
headers={"Authorization": f"Bearer {os.environ['MEKANBOOK_API_KEY']}", "Content-Type": "application/json"},
)
print(json.load(urllib.request.urlopen(req))["data"])
<?php
$ch = curl_init('https://www.mekanbook.com/api/partner/v1/menu/items/123');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('MEKANBOOK_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['price' => 24500, 'available' => true]),
]);
$item = json_decode(curl_exec($ch), true)['data'];
Bugünkü rezervasyonlar
curl "https://www.mekanbook.com/api/partner/v1/reservations?from=2026-11-10T00:00&to=2026-11-10T23:59&status=confirmed" \
-H "Authorization: Bearer $MEKANBOOK_API_KEY"
Rezervasyon oluşturma
curl -X POST https://www.mekanbook.com/api/partner/v1/reservations -H "Authorization: Bearer $MEKANBOOK_API_KEY" -H "Content-Type: application/json" \
-d '{"date":"2026-11-11","time":"20:00","party":4,"name":"Ayşe Yılmaz","phone":"+905551112233"}'
API ile alınan rezervasyon personel girişi sayılır: doğrudan onaylanır, kapora istenmez; vardiya, kapasite ve kapalı gün kuralları geçerlidir.
Sayfalama, hatalar ve sınırlar
Listeler en yeniden eskiye sıralanır. limit (1–100, varsayılan 50) ve yanıttaki next_cursor değerini cursor parametresiyle gönderin; next_cursor null ise son sayfadasınız. Değişenleri çekmek için updated_since kullanın.
{ "data": [ … ], "next_cursor": "MTIzNA==" }
{ "error": { "code": "insufficient_scope", "message": "This API key lacks the 'orders:read' scope." } }
| HTTP | code | Anlamı |
|---|---|---|
| 401 | invalid_key | Anahtar yok, hatalı veya iptal edilmiş |
| 403 | plan_required | Mekanın paketi geliştirici API içermiyor |
| 403 | insufficient_scope · ip_not_allowed | İzin veya IP uygun değil |
| 404 | not_found | Kayıt bu mekana ait değil veya yok |
| 422 | validation_failed | Geçersiz alan; ayrıntı fields içinde |
| 429 | rate_limited | Hız sınırı; Retry-After kadar bekleyin |
Webhook'lar
Panel › Geliştirici sayfasından veya webhooks:manage izniyle API'den https adresinizi ve olayları seçin. Her bildirim aynı biçimdedir:
POST /your/endpoint
X-MekanBook-Event: reservation.created
X-MekanBook-Delivery: 2b1f0c3e-… ← tekrarları ayıklamak için kullanın
X-MekanBook-Timestamp: 1767225600
X-MekanBook-Signature: t=1767225600,v1=5f2c…
{"id":"2b1f0c3e-…","type":"reservation.created","created_at":"2026-12-31T19:00:00+00:00","venue_id":42,"data":{ … }}
Olaylar: order.created, order.updated, reservation.created, reservation.updated, reservation.cancelled, loyalty.earned, loyalty.redeemed, loyalty.adjusted, review.created, takeaway.created, takeaway.updated, menu.updated, ecommerce.link.created, ecommerce.link.revoked · ping (panelden deneme)
- 10 saniye içinde 2xx dönün; işi kuyruğa alıp hemen yanıtlayın.
- Başarısız teslimat 1 dk, 5 dk, 15 dk, 1 sa, 3 sa, 6 sa, 12 sa ve 24 sa sonra tekrar denenir. Art arda 50 başarısızlıkta uç nokta kapatılır; panelden yeniden açılabilir.
- Yalnızca herkese açık https adreslerine gönderilir (özel ağ ve yönlendirme izlenmez).
İmza doğrulama
İmza, ham (çözümlenmemiş) gövde ile hesaplanır: HMAC-SHA256(sır, "{t}.{gövde}"). Zaman damgası 5 dakikadan eskiyse reddedin.
import crypto from 'node:crypto';
export function verify(secret, header, rawBody) {
const m = /t=(\d+),v1=([a-f0-9]{64})/.exec(header || '');
if (!m || Math.abs(Date.now() / 1000 - Number(m[1])) > 300) return false;
const expected = crypto.createHmac('sha256', secret).update(`${m[1]}.${rawBody}`).digest('hex');
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(m[2]));
}
import hmac, hashlib, re, time
def verify(secret: str, header: str, raw_body: bytes) -> bool:
m = re.search(r"t=(\d+),v1=([a-f0-9]{64})", header or "")
if not m or abs(time.time() - int(m.group(1))) > 300:
return False
expected = hmac.new(secret.encode(), m.group(1).encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, m.group(2))
<?php
function mekanbook_verify(string $secret, string $header, string $rawBody): bool {
if (! preg_match('/t=(\d+),v1=([a-f0-9]{64})/', $header, $m) || abs(time() - (int) $m[1]) > 300) {
return false;
}
return hash_equals(hash_hmac('sha256', $m[1].'.'.$rawBody, $secret), $m[2]);
}
// $ok = mekanbook_verify(getenv('MEKANBOOK_WEBHOOK_SECRET'), $_SERVER['HTTP_X_MEKANBOOK_SIGNATURE'] ?? '', file_get_contents('php://input'));
MCP sunucusu (yapay zekâ asistanları)
Model Context Protocol destekleyen asistanlar (ör. Claude, ChatGPT ve MCP uyumlu IDE'ler) mekan verinizi salt okunur sorgulayabilir: “Bu akşam kaç kişilik rezervasyon var?”, “Menüde 300 TL altındaki mezeler?”
| URL | https://www.mekanbook.com/mcp (Streamable HTTP, POST) |
|---|---|
| Kimlik | Authorization: Bearer mbp_… — araçlar anahtarın izinlerine göre görünür |
| Protokol | 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26 |
| Araç | Açıklama | Scope |
|---|---|---|
get_menu | Returns the venue menu: categories and items with current prices (kuruş), availability and last price update. | menu:read |
list_reservations | Lists reservations for a local date (default: today) with status, party size and time. Contact details are not included. | reservations:read |
get_today_stats | Today's reservation count and covers, table orders, order total (kuruş) and open checks (venue local day). | reservations:read orders:read |
search_customers | Searches the guest book by name or the last 4 digits of a phone number. Names, phones and emails are masked. | customers:read |
list_events | Lists the venue's published upcoming events (concerts, parties) with dates. | events:read |
@__raw_block_3__{{ $mcpUrl }}",
"headers": { "Authorization": "Bearer mbp_…" }
}
}
}
Asistana yalnızca okuma izinli ayrı bir anahtar verin (ör. menu:read, reservations:read, events:read). Misafir verisi maskelidir.
SDK
JavaScript / TypeScript
Node 18+, Deno, Bun ve tarayıcı. Bağımlılık yok; tür tanımları dahil.
import { MekanBook } from './mekanbook-js/src/index.js';
const mb = new MekanBook({ apiKey: process.env.MEKANBOOK_API_KEY });
for await (const r of mb.paginate('/reservations', { status: 'confirmed' })) console.log(r.starts_at, r.party_size);
E-ticaret sadakat
Mekanın online mağazası, mekandaki aynı sadakat kartında puan kazandırır ve kullandırır. Anahtar Panel › Pazarlama › Online mağaza bölümünde oluşur (ecommerce:read, ecommerce:write). Müşteri, hesabının bağlanmasını e-postasına gelen kodla kendisi onaylar; mağaza yalnızca opak bir customer_ref görür.
WooCommerce
Hazır eklenti: ödeme sayfasında “MekanBook puanlarını kullan”, tamamlanan siparişte puan, iadede geri alma, imzalı webhook. TR/EN.
Diğer platformlar
Shopify, İkas, Ticimax, IdeaSoft, T-Soft ve kendi siteniz için hazır uygulama yok; sunucu tarafı API ve JS widget ile özel entegrasyon.
| Uç | Açıklama |
|---|---|
GET /ecommerce/ping | Bağlantı testi, kurallar |
POST /ecommerce/links · GET /ecommerce/links/{id} · POST /ecommerce/links/{id}/verify | Müşteri onaylı hesap bağlama (e-postaya kod + onay bağlantısı) |
GET|DELETE /ecommerce/customers/{ref} | Bakiye / bağlantıyı kaldır |
POST /ecommerce/quote | Sepet için kullanılabilir indirim |
POST /ecommerce/redemptions · /{id}/confirm · /{id}/cancel | Rezerve (30 dk, Idempotency-Key zorunlu) → onay / iptal |
POST /ecommerce/orders · /{ref}/refund · /{ref}/cancel | Ödenen siparişe puan; kümülatif iade tutarıyla oransal geri alma; iptal |
GET /ecommerce/transactions | Son online defter hareketleri |
curl -X POST https://www.mekanbook.com/api/partner/v1/ecommerce/redemptions \
-H "Authorization: Bearer mbp_…" -H "Idempotency-Key: cart-8f2c" -H "Content-Type: application/json" \
-d '{"customer_ref":"mbc_…","order_total":45000,"unit":"points","points":300}'
Zapier · Make · n8n
Kod yazmadan bağlamak için: webhook tetikleyicisi olarak aracın verdiği adresi Panel › Geliştirici › Webhook ekle bölümüne yazın; işlem adımlarında “HTTP isteği” modülüyle API'yi Bearer anahtarıyla çağırın.
- Zapier: Webhooks by Zapier › Catch Hook (tetikleyici) → Google E-Tablolar, Slack, e-posta…
- Make: Webhooks › Custom webhook → HTTP › Make a request. Örnek senaryo: make-blueprint.json
- n8n: Webhook düğümü → (imza doğrulama için Code düğümü) → HTTP Request. Örnek iş akışı: n8n-workflow.json
Sürüm notları
- 1.0.0 · 2026-11-26 — İlk sürüm: menü, sipariş, rezervasyon, sadakat, misafir, etkinlik uçları; webhook'lar; MCP sunucusu; JavaScript ve Python SDK.
Geriye uyumsuz değişiklikler yeni bir sürüm yolunda (/v2) yapılır; v1 en az 12 ay önceden duyurulmadan kapatılmaz. Yenilikler