CRADالمطوّرون
العربية

Set up your integration

Obtain the environment details, choose browser or backend calls, and connect your existing booking interface.

قبل الاستخدام الفعلي — افحص القدرات المنشورة والصلاحيات وجاهزية ربطك.

تحقّق من القدرات المنشورة وصلاحيات المفتاح وجاهزية النشاط في بيئتك. أمثلة HTTP مسجّلة من اختبارات معزولة؛ وصفها local-unreleased لا يعني أن API غير عامل ولا يُثبت جاهزية ربطك. في مسار العميل يُتحقق من الهاتف بقالب واتساب أعدّه النشاط؛ SMS غير مدعوم. التسجيل بواسطة مسؤول مخوّل عملية منفصلة دون رمز.

Start with an approved environment

The canonical API base is https://api.crad.ai; append the documented /v1 path. Existing integrations keep the same API key, site/integration IDs and original operation UUIDs. Older connectWebsiteBff bundles require the compatibility base https://api.crad.ai/functions/v1/website-booking until the SDK is updated. Changing the address does not require key reissuance or retrying a write.

This reference describes a versioned HTTP contract. Confirm the capabilities deployed for your environment, the key's current grants and business readiness before use. Recorded examples demonstrate isolated behavior and retain local-unreleased/unknown provenance; those labels do not mean the API is offline or certify an external installation. An HTTP integration does not require a CRAD UI component or package download.

API V1.0 names the reviewed compatibility baseline for /v1, published with OpenAPI version 1.0.0. The wire contractVersion remains the integer 1. Preserve the response shape for requests that do not opt in; additive capability fields require explicit documented negotiation. Missing optional feature flags do not establish support or grant permission. Breaking payload or meaning changes require a separately published /v2 contract; no /v2 endpoint is advertised here.

Customer self-service phone verification uses a WhatsApp authentication template created by the business and explicitly selected by its owner for each supported language. SMS is not supported or required. The published contract describes locally tested behavior; arrange an approved environment and confirm its actual verification readiness before use.

An unavailable WhatsApp connection stops new verification sends. It does not revoke existing, unexpired phone proof or stop otherwise permitted website actions. Proof expiry, authorization and site intake rules still apply. An issued, unexpired code can still be submitted while disconnected.

Request the following handoff from CRAD and the business owner. There is no public self-service credential-creation endpoint in this HTTP reference. Keep local demonstration values separate from the values supplied for an approved test or production environment.

Requested itemWhat you need before implementation
API basehttps://api.crad.ai is the official API base. The SDK uses it by default; append the documented /v1 path.
Public identityGET /v1/management and, with integration permissions, GET /v1/integration derive siteId and integrationId from the same API key. These UUIDs are public identifiers; no manual server configuration is required.
Customer verificationThe business’s configured WhatsApp authentication template, supported verification languages, actual connection/readiness and an approved test-phone procedure. Historical codes and masked tokens are not usable credentials.
Backend data accessOne server API key (CRAD_API_KEY), its explicit integration scopes, expiry and secure handoff. Request only the customer or booking data operations your backend needs.
Business administrationThe same API key with explicit management permissions: contacts:record for entry; contacts:read plus explicit write/block/sync permissions for business customers; separate approval for notes/custom fields; hours/block scopes and resource grants for schedules. Legacy wbi_ keys do not provide management rights. The same wbm_ API key can carry both scope groups after explicit approval.
Embedding, if usedThe approved booking URL and verified exact parent origin. Iframe permission is separate from custom-UI customer API access.
Acceptance and supportThe environment’s verification/delivery limitations and the contact to resolve setup, grant or provider failures. Documentation examples are not an environment attestation.

Current activity totals for your admin

Request explicit reports:read and check reportsOverviewRead in management metadata before calling the current activity overview from your backend. This grants counts for the whole business, including every provider and unassigned appointments. Provider selection and calendar grants do not limit these totals; older keys gain no access automatically.

Use the returned server asOf, business timezone and UTC periods when labelling today, this Sunday-based week and tomorrow. Counts come from one observation and exclude cancelled and null-status appointments. Remaining today includes only strictly future PENDING, CONFIRMED or NOW appointments. This overview endpoint has no customer details, monetary totals, monthly breakdown, provider filters or report sync stream. Use the separate monthly operation below for a full month. An error is not a zero count.

Show the full monthly operational report in your admin

Use GET /v1/management/reports/monthly with explicit reports:read and installed reportsMonthlyRead support. This is whole-business authority, independent of provider/calendar grants. Optional month=YYYY-MM selects a complete business-local month; omission selects the server current month. Use the returned asOf, timezone and half-open UTC period rather than constructing month boundaries in the browser.

The response covers every matching appointment in one database observation, without calendar pagination limits. It includes status counts, zero-filled days and service/provider breakdowns, with no customer details. Counts describe physical records: replacement rescheduling retains a cancelled predecessor and creates a successor. Each belongs to its current start month. Cancelled and missed remain separate.

Only COMPLETED appointments contribute treatment value, grouped by currency. Accepted terms preserve historical treatment names and prices. Legacy rows use their stored appointment price with unknown currency; null prices are unpriced, not free. Never infer currency from today's catalogue or sum different currency buckets. These totals are not cash received, payment reporting or financial accounting.

This is a fresh no-store read, not a report change feed or a calculation from the local calendar window. No ETag or operation UUID is required. A failed request is not a zero report; show the error or clearly dated prior report without treating it as current. Installed support and a published contract do not grant the key access or attest deployment.

Put each credential in the right place

Public customer calls support browser origins and use explicit bearer authority, not cookies. Machine and companion credential requests reject an Origin header. Keep those keys on your server. A backend-for-frontend must validate its own account, CSRF and rate limits, then construct upstream requests from an allowlist; do not forward browser cookies, arbitrary authorization or client-selected integration authority.

A companion key needs bookings:write:customer for the booking flow, including catalog, quote, availability and accepted-booking reads, committed-operation recovery and notifications. customers:write is the registration/account-mapping grant. Saved intent/request retrieval has separate endpoint rules; do not assume every recovery read uses the same scope check.

Sessions are bound to their site and integration. A session created with a companion key remains subject to that key’s current authority. After key revocation, create a new session and obtain fresh phone proof. Key rotation preserves integration identity and accepted operation receipts; it does not revive a revoked session.

CallerHeaderAuthority
Customer browserAuthorization: Bearer wbs_<64hex>An in-memory visitor session, upgraded by CRAD phone verification. Website account login does not replace phone proof.
Your backend forwarding a customer actionCustomer bearer plus X-CRAD-Integration-Key: ${CRAD_API_KEY}A companion credential for the same integration. It does not replace the customer session or phone proof; the endpoint checks its required scopes.
Your backend reading or syncing integration dataAuthorization: Bearer ${CRAD_API_KEY}Only explicit integration scopes and mapped data. Your backend must authorize its own account before exposing a customer projection.
Your staff administration backendAuthorization: Bearer ${CRAD_API_KEY}The same server API key with explicit management scopes and allowed resources. No customer identity or phone-proof authority.

Make the first read

Use GET /v1/management with CRAD_API_KEY to discover its identity, permissions and resource grants. GET /v1/integration gives the integration-scoped view of the same key when explicitly permitted. A booking-only key may have no management scopes. Catalog is an anonymous read; inspect its published services, providers, timezone and booking capabilities before building the selection form.

An anonymous catalog reports site-wide intake and may have no default hosted integrationId. Use your supplied headless integrationId when creating its session. Re-read capabilities with that session to observe its integration’s intake readiness. A supported feature flag is not a scope grant, tenant activation or delivery guarantee. GET /v1/integration currently reports environment as unknown.

For an admin-only integration, your backend can first GET /v1/management with its management bearer. Check the returned site/integration IDs, expiry, scopes and resources before enabling actions in your admin. No public booking site, WhatsApp connection or customer session is required. This read uses normal request quota and updates last-use telemetry; it creates no business records. Installed capabilities do not mean this key has each permission.

Read-only cURL template
curl --request GET "https://api.crad.ai/v1/sites/${SITE_ID}/catalog" \
  --header "Accept: application/json"

Continue owner-only settings in CRAD

When management metadata includes capabilities.ownerSettingsContinuations:true, use the returned ownerSettings URLs to open the matching CRAD settings in a separate tab. Older installations may omit both fields. All four URLs are present in the new contract; their presence is not an eligibility or readiness claim. Keep the Management key on your backend.

CRAD asks the actual current owner of that business to sign in before mounting the destination. Admin, provider, platform-only and different-business accounts cannot use this owner continuation. The integration destination also rechecks the exact current integration; a missing or revoked integration does not select another one.

Opening a link does not save a policy, approve a grant, switch businesses, subscribe a device, reconnect WhatsApp, enroll the business or activate its bot. The owner reviews and explicitly acts in CRAD. Do not pass proposed permissions, connection tokens, arbitrary return URLs or automatic-success callbacks. When the owner returns, re-read current metadata and grants.

whatsappUrl is always present, including when ownerSetup.state is not_available. Initial setup availability is a separate question: an established self-service business may have no initial setup record. The panel checks its current owner-managed connection mode after sign-in and refuses unsupported legacy connections without changing them. Website intake remains independent from the bot and WhatsApp switches; there is no SMS fallback.

Check reads issued metadata only. Owners and superadmins can reveal keys saved with encrypted recovery through their authenticated CRAD settings; the public website API cannot reveal them. Older hash-only keys cannot be recovered and require explicit revocation and replacement if lost. Resolve an earlier uncertain settings operation before changing its intent; a missing read result does not cancel the original operation. The separate business-policy APIs below support explicitly delegated intake and notification settings; opening a continuation does not grant those scopes.

Returned URLOwner destination and explicit action
websiteUrlWebsite booking and notification settings; explicitly save a policy or pause intake.
integrationUrlThe current integration’s credentials, resource permissions, field/history sharing and transfers; explicitly issue, revoke or approve.
deviceUrlPersonal notifications on the current owner device; explicitly allow browser notifications and subscribe.
whatsappUrlThe existing supported owner-managed WhatsApp connection; explicitly sign in, connect or renew through Meta.

Manage website and notification policies from your own admin

Keep three independent controls in your admin: website booking intake, WhatsApp appointment updates for customers, and booking-event alerts for business owners. Use explicit whole-business website-intake, website-notifications and owner-alerts read/write scopes. Provider and calendar selections do not narrow these policies; an old key gains no new permission.

Read the policy and preserve its complete quoted ETag before editing. PATCH sends changes plus an optional externalActorRef, the same ETag as If-Match and one saved operation UUID as Idempotency-Key. After an uncertain response, read that policy’s operations/{operationId}. This lookup changes nothing. Keep the original body, UUID and version for an explicit retry after not_found; a missing lookup does not cancel a late request. receipt.state is the accepted snapshot and current is the latest policy.

Website intake settings expose the localized display name, default language and draft/enabled/paused status. Pause instead of reverting an enrolled site to draft. Explicit enabling can enroll website booking only after the existing activation checks pass; it cannot configure deployment, bypass prerequisites, pause all channels or change the bot switch. Existing bookings stay saved when intake is paused. A site-wide setting applies to all website integrations, not only the caller’s site frontend.

Customer notification policy selects enabled, purposes and dailyLimit. Enabling requires the current supported template/connection prerequisites. Saving this policy also enables the existing website notification-consent authority, even when enabled:false; it never grants customer consent or reverses a STOP request. A ready template is not proof of delivery. Disabling blocks dispatch at the next preflight; already-started attempts cannot be recalled. Eligible pending jobs may resume after re-enabling while their original deadlines and consent remain valid; delivery is not guaranteed.

Owner alerts select enabled for website booking created/changed/cancelled events. They go only to current owners’ already-subscribed devices. This setting does not register a browser, change its permission, expose device endpoints or control WhatsApp disconnection alerts. Disabling suppresses queued jobs; enabling does not recreate suppressed jobs.

The intake health and owner-alert metrics endpoints are bounded read-only diagnostics. Respect truncated and sample limits; they are not a complete audit export. Owner device counts reveal no device identifiers. Personal device enrollment and Meta sign-in continue in CRAD through the owner settings links.

Show connection health without repeating setup

Use explicit whole-business whatsapp-connection:read and whatsapp-connection:check permissions. The check permission requires read. Provider/calendar selections do not narrow this authority; installed capability flags do not grant it. Keep the key on your backend.

GET saved status makes no Meta request. Show the saved connection state, health.checkedAt, health.result and botActive separately. configured describes the manual-check runtime gate, not business verification. connection:null does not prove a legacy channel is absent. Neither healthy evidence nor saved template approval guarantees message delivery.

For an explicit check, save a UUID Idempotency-Key, the full quoted ETag as If-Match and the exact request before POST health-checks. The body is {} or an optional externalActorRef. Only if status returns a permitted reconciliation action, POST subscription-reconciliations with its exact reconciliationAttemptId as attemptId. This checks the latest eligible UNKNOWN subscription, never sends a new subscribe request and never advances contacts/history setup.

HTTP 200 can mean pending, committed or expired. Only committed has an immutable accepted receipt; current is the latest authorized saved state. After a lost response, read operations/{operationId}. This lookup makes no Meta request or database write and remains available under current authority if runtime configuration or binding changes. not_found does not cancel a late request.

Each UUID dispatches at most once. Pending replay never calls Meta again; an unresolved lease is reported expired after 60 seconds. A new deliberate observation uses a fresh ETag and UUID after cooldown. Native manual checks share the same active lease, 60-second cooldown and five starts per 15 minutes. Respect action flags and retryAt; do not poll the POST or invent a replacement operation automatically.

Use the returned ownerSettings.whatsappUrl for actual connection, renewal or permission consent. These APIs neither extend token expiry nor activate a bot, send messages, reveal provider credentials or automatically reconnect a disconnected business.

Connect your booking screens

  1. Create a session

    Send the approved integrationId and keep the returned customer bearer in memory. Treat bookingEnabled as current intake advice, not a slot reservation.

    Create a visitor session
  2. Quote and choose a time

    Create a quote for a published service and supported provider/removal choice. Read availability for a localDate in the business timezone. Prices are integer ILS minor units; submit a returned startAt timestamp with its explicit offset.

    Create a quoteFind available times
  3. Verify the phone

    After an explicit customer action, send an E.164 phone, language and persisted challenge-request UUID. Submit its challengeId and six-digit code. Store the successful response’s sessionToken as the current in-memory bearer and use its returned proof/session expiry timestamps. A successful repeat does not renew proof expiry or rotate the bearer. A verified session cannot switch phones.

    Request a WhatsApp verification codeVerify a phone number
  4. Prepare and review

    Persist a new booking-intent request UUID before POST. Send the quote, slot, name, language and explicit WhatsApp preference. Present the returned quote/summary and cancellation policy. Changed terms require a fresh review.

    Prepare a booking
  5. Commit the reviewed intent

    Only after confirmation, send intentId with Idempotency-Key set to that intent’s returned operationId. The earlier request UUID is not the commit key. Show success from the authoritative receipt and retain the booking reference.

    Submit a booking request
  6. Manage an accepted booking

    Read current booking details and allowedActions. For a change, use its acknowledged version in a new action intent, review the old/new time or cancellation, then commit that intent’s operation ID. Recovery must not silently confirm a saved review.

    Retrieve a bookingFind rescheduling timesPrepare a booking changeCancel a bookingReschedule a booking

Keep identity and readiness separate

Registering an externalCustomerId requires current phone proof and a companion integration credential with customers:write. For a session created with a companion key, registration must send a valid customers:write companion again even without externalCustomerId. Derive the account ID on your authenticated backend. Registration is not account login or messaging consent. A booking externalReference similarly comes from your backend and requires bookings:write:customer; it is not a customer identity or authorization token.

Known booking access requires current same-site, same-phone proof through an authorized integration. Saved intent/request recovery also requires the original integration. A paused intake does not by itself remove authorized management of accepted bookings. Never use recoveryIntegrationId to admit a new booking.

A separately authorized administrator can record a contact by name and phone through the management API without a customer OTP. This creates or links a canonical contact and an owner-reviewed integration mapping; it does not create customer proof, permission to book, WhatsApp consent or a message.

Business customer reads, guarded basic edits, phone correction, blocking and directory synchronization have separate Management operations and explicit scopes. These do not authorize appointment administration: the Business calendar guide describes its separate scopes and owner grants. Service editing and website content have their own permissions in the Services & website content guide. Team editing remains outside this contract.

تنسيق بيئة API عبر واتساب

ستفتح مسودة لفريق CRAD يمكنك تعديلها قبل الإرسال. لا ترسل مفاتيح الوصول.