Conciar API 快速入門
建立金鑰、送出第一個請求,並了解 Connect API 與公開訂位 API 的驗證、錯誤處理與速率限制。
技術文件以英文撰寫。
Two APIs
Connect API
Your own customer app, website backend or integration: locations, the restaurant menu and takeaway orders, customer sign-in and loyalty, the webshop catalogue, cart, checkout and subscriptions.
Needs an API key.
https://api.conciar.com/connect/v1Public booking API
Table reservations for a restaurant: availability, booking (with deposit or card guarantee), the guest's own reservation, ticketed events and gift cards.
No key: a restaurant is addressed by its guid or handle.
https://api.conciar.com/public/v11. Create an API key
- Sign in to my.conciar.com as an admin or manager.
- Open Management → API Keys and choose New API Key.
- Give it a name. You get a pair: a publishable key (
pk_…) and a secret key (cnct_…). - Copy both straight away: they are shown once. Conciar only stores a hash, so a lost key can't be shown again; create a new one.
Publishable pk_…
Safe to ship inside a customer app. It only opens the endpoints a customer needs (marked “Publishable or secret key” in the reference); anything else answers 403 PUBLISHABLE_KEY_NOT_ALLOWED.
Secret cnct_…
Opens every endpoint, including the cart, webshop orders and shipping lookups. Keep it on your server; never put it in an app or web page.
Revoking or deleting either half of a pair revokes or deletes both. Keys belong to your organization and work with any of its active sales channels.
The Connect API sends no CORS headers, so browsers block calls from JavaScript on another domain. Call it from a server or a native app.
2. Pick a sales channel
Each location or shop you sell through is a sales channel. Its channel token (cnct_ch_…) goes in the X-Sales-Channel header of every /store call; it decides the menu or catalogue, prices, currency, language and payment methods.
Find it in my.conciar under Settings → Sales channels (“Channel token”), or let your app call GET /locations, which lists every active channel with its sales_channel_token.
Connect request headers
| Header | When | Value |
|---|---|---|
X-Api-Key | Every call | Your publishable (pk_…) or secret (cnct_…) key. |
X-Sales-Channel | Every /store call and /app/init | The channel token (cnct_ch_…). |
Accept-Language | Optional | e.g. nl or zh-TW. Defaults to the channel language. |
X-Currency | Optional | e.g. EUR or USD. Defaults to the channel currency. |
Authorization | Customer calls | Bearer <access_token> from /auth/otp/verify. |
Idempotency-Key | Optional, placing a restaurant order | 1–64 characters; a retry returns the first order. |
X-Order-Token | Guest reading, paying or cancelling a restaurant order | The order_token from placing it. |
3. Make a first request
List your locations with the publishable key. Everything in these examples is made up; use your own key.
curl "https://api.conciar.com/connect/v1/locations" \
-H "Accept: application/json" \
-H "X-Api-Key: pk_your_publishable_key"{
"data": {
"timezone": "Europe/Amsterdam",
"locations": [
{
"sales_channel_token": "cnct_ch_your_channel_token",
"name": "Bistro Example",
"is_test": false,
"address": "Example Street 1, 1000 AA Example City",
"is_open_now": true,
"…": "…"
}
]
}
}Then follow a whole flow in the code examples, or look up any endpoint in the API reference.
Signed-in customers
Customers sign in with a 6-digit code sent by email (POST /auth/otp/request, then POST /auth/otp/verify). Verifying returns an access_token, valid for 6 months.
Send it as Authorization: Bearer … next to the API key. The /store/customer endpoints need it; on restaurant orders it is optional and turns a guest order into a member order that earns stamps and points.
Errors
Errors are JSON. Check the HTTP status first. The body has a message; many Connect errors also have "status": false and a code such as ITEM_UNAVAILABLE in message, with errors keyed by field. The public booking API answers {"status": false, "code": "…"}.
| 401 | API key required. / Invalid or expired API key. — or, on customer calls, Unauthenticated. (no or a bad bearer token). |
|---|---|
| 403 | PUBLISHABLE_KEY_NOT_ALLOWED — this endpoint needs the secret key. |
| 404 | Not found — including a missing X-Sales-Channel header, or a channel token that is unknown, inactive or from another organization. |
| 409 | A conflict, e.g. a reused Idempotency-Key. |
| 422 | Validation failed or the request cannot be done (errors per field, or a code). |
| 429 | Too many requests — see rate limits. |
| 503 | The sales channel is in maintenance mode ({"maintenance": true, …}). |
Rate limits
- Connect API: 300 requests per minute per IP address overall. Some endpoints have their own, lower limit, shown in the reference. Most of those count per key, and for a publishable key per key and IP address, so one busy app doesn't use up the limit for everyone.
- Restaurant orders also have a per-store limit (60 new orders and 120 payment or cancel calls per minute by default), whichever key or IP calls.
- Sign-in codes: 5 requests per minute per IP, and at most one code per minute and five per hour for the same address (
429 OTP_COOLDOWNwithretry_after). - Public booking API: per restaurant and IP address, 120 reads and 10 bookings or other changes per minute; gift cards 60 reads and 6 purchases per minute.
Over the limit you get 429 {"message": "Too Many Attempts."} with a Retry-After header. Responses carry X-RateLimit-Limit and X-RateLimit-Remaining.
No code: the booking widget
To take reservations on a website without building anything, embed the Conciar booking widget. It uses the public booking API. Replace the guid with your restaurant's.
<div class="conciar-widget"
data-widget-type="restaurant-reservation"
data-guid="YOUR_RESTAURANT_GUID"
data-lang="auto"></div>
<script src="https://widget.conciar.com/conciar-widget.iife.js" defer></script>data-lang is a language code such as en or nl, or auto for the visitor's browser language.